linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Denis Vlasenko <vda@port.imtp.ilyichevsk.odessa.ua>
To: Rik van Riel <riel@conectiva.com.br>,
	William Lee Irwin III <wli@holomorphy.com>
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [RFC][PATCH] iowait statistics
Date: Thu, 16 May 2002 09:42:52 -0200	[thread overview]
Message-ID: <200205160640.g4G6eKY16156@Port.imtp.ilyichevsk.odessa.ua> (raw)
In-Reply-To: <Pine.LNX.4.44L.0205151558180.32261-100000@imladris.surriel.com>

On 15 May 2002 17:00, Rik van Riel wrote:
> > $ 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 ;)

While you're at it:

          printf("CPU states:"
                 " %2ld.%ld%% user, %2ld.%ld%% system,"
                 " %2ld.%ld%% nice, %2ld.%ld%% idle",
                 user_ticks / 10UL, user_ticks % 10UL,
                 system_ticks / 10UL, system_ticks % 10UL,
                 nice_ticks / 10UL, nice_ticks % 10UL,
                 idle_ticks / 10UL, idle_ticks % 10UL);

" %2ld" -> "%3ld" will make 100.00% look much nicer:
Current code: " 34.56%" " 100.00%" (i.e. 100% is one char wider!)
New code:     " 34.56%" "100.00%"

Same here:

          printf ("CPU%d states: %2d.%-d%% user, %2d.%-d%% system,"
                  " %2d.%-d%% nice, %2d.%-d%% idle",
                  cpumap,

Another thing: in sight of moves towards 64bit jiffies isn't it wise to
use unsigned long long (or explicit u64) for all these numbers?
--
vda
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/

  reply	other threads:[~2002-05-16 11:42 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-05-14  1:19 Rik van Riel
2002-05-14  2:18 ` Andrew Morton
2002-05-14 12:30   ` Rik van Riel
2002-05-15 17:02   ` Denis Vlasenko
2002-05-16  7:41     ` Andrew Morton
2002-05-14 15:39 ` William Lee Irwin III
2002-05-14 16:36   ` Rik van Riel
2002-05-14 16:54     ` William Lee Irwin III
2002-05-15 17:17       ` Denis Vlasenko
2002-05-15 14:03         ` Rik van Riel
2002-05-15 20:17           ` Denis Vlasenko
2002-05-15 16:13             ` Rik van Riel
2002-05-15 16:21               ` William Lee Irwin III
2002-05-15 17:00               ` William Lee Irwin III
2002-05-15 18:16                 ` Bill Davidsen
2002-05-15 18:30                 ` William Lee Irwin III
2002-05-15 18:33                   ` Rik van Riel
2002-05-15 18:46                     ` William Lee Irwin III
2002-05-15 19:00                       ` Rik van Riel
2002-05-16 11:42                         ` Denis Vlasenko [this message]
2002-05-16  9:49               ` Leigh Brown
2002-05-16 14:51                 ` Rik van Riel
2002-05-16 16:44                   ` Leigh Brown
2002-05-17  8:02                     ` Jens Axboe
2002-05-16 11:14               ` Denis Vlasenko
2002-05-15 15:15         ` Bill Davidsen
2002-05-16 10:58           ` Denis Vlasenko
2002-05-14 18:19     ` Martin J. Bligh
2002-05-15  1:31 ` Bill Davidsen
2002-05-15  1:41   ` William Lee Irwin III
2002-05-15 14:39     ` Bill Davidsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200205160640.g4G6eKY16156@Port.imtp.ilyichevsk.odessa.ua \
    --to=vda@port.imtp.ilyichevsk.odessa.ua \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=riel@conectiva.com.br \
    --cc=wli@holomorphy.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox