Re: [RFC][PATCH] iowait statistics

Rik van Riel (riel@conectiva.com.br)
Wed, 15 May 2002 16:00:56 -0300 (BRT)


On Wed, 15 May 2002, William Lee Irwin III wrote:

> $ vmstat 1
> procs memory swap io system cpu
> r b w swpd free buff cache si so bi bo in cs us sy id
> 17 0 0 0 182880 32364 55180 0 0 2 77 29 229 84 6 10
> 16 0 0 0 175224 32408 57524 0 0 0 0 104 961 95 5 0
>
> All good there. OTOH:
>
> $ top
> fscanf failed on /proc/stat for cpu 1

Doh, take a look at top.c around line 1460:

for(i = 0; i < nr_cpu; i++) {
if(fscanf(file, "cpu%*d %d %d %d %d\n",
&u_ticks, &n_ticks, &s_ticks, &i_ticks) != 4) {
fprintf(stderr, "fscanf failed on /proc/stat for cpu %d\n", i);

It would have been ok (like vmstat) if it didn't expect the \n
after the fourth number ;/

Oh well, time for another procps patch ;)

cheers,

Rik

-- 
Bravely reimplemented by the knights who say "NIH".

http://www.surriel.com/ http://distro.conectiva.com/

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/