All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Griffith <grif@michaelgriffith.com>
To: nfs@lists.sourceforge.net, okir@monad.swb.de
Cc: neilb@cse.unsw.edu.au, hjl@lucon.org
Subject: nfsstat printing overflow
Date: Thu, 29 May 2003 16:26:54 -0700	[thread overview]
Message-ID: <20030529232654.GA32598@doubt> (raw)

[-- Attachment #1: Type: text/plain, Size: 131 bytes --]

A small patch to handle when the RPC call counts are > 2^32/100.

-- 
Michael A. Griffith
<grif@acm.org>
408-907-2151
650-292-1516

[-- Attachment #2: nfsstat.diff --]
[-- Type: text/plain, Size: 2042 bytes --]



Without this patch, nfsstat reports the wrong percentage for
any RPC which has more than 2^32/100 calls.  For example
my machine running 1.0.1 reports:

l-sim-208-11:diag/testgen/batch_0/nv40_curie_ogtest/000001> nfsstat at
-c
Client rpc stats:
calls      retrans    authrefrsh
61096094   181        0
Client nfs v2:
null       getattr    setattr    root       lookup     readlink
0       0% 0       0% 0       0% 0       0% 0       0% 0       0%
read       wrcache    write      create     remove     rename
0       0% 0       0% 0       0% 0       0% 0       0% 0       0%
link       symlink    mkdir      rmdir      readdir    fsstat
0       0% 0       0% 0       0% 0       0% 0       0% 0       0%

Client nfs v3:
null       getattr    setattr    lookup     access     readlink
0       0% 2661431  4% 76995   0% 4938464  8% 3254610  5% 131     0%
read       write      create     mkdir      symlink    mknod
138409  0% 259382  0% 185867  0% 3570    0% 49      0% 0       0%
remove     rmdir      rename     link       readdir    readdirplus
4035088  6% 318094  0% 157     0% 0       0% 1626490  2% 43597144  1%
fsstat     fsinfo     pathconf   commit
18      0% 195     0% 0       0% 0       0%


Note that readdir plus should be 71%, not 1%. 



--- 1.0.1/nfsstat.c	Sun May  5 16:33:30 2002
+++ nfsstat.c	Thu May 29 16:10:21 2003
@@ -307,7 +307,8 @@
 print_callstats(const char *hdr, const char **names,
 				 unsigned int *info, unsigned int nr)
 {
-	unsigned int	total;
+	unsigned long long	total;
+        unsigned long long      pct;
 	int		i, j;
 
 	fputs(hdr, stdout);
@@ -319,9 +320,10 @@
 		for (j = 0; j < 6 && i + j < nr; j++)
 			printf("%-11s", names[i+j]);
 		printf("\n");
-		for (j = 0; j < 6 && i + j < nr; j++)
-			printf("%-6d %2d%% ",
-				info[i+j], 100 * info[i+j] / total);
+		for (j = 0; j < 6 && i + j < nr; j++) {
+                        pct = ((unsigned long long) info[i+j]*100)/total;
+                        printf("%-6d %2d%% ", info[i+j], pct);
+                }
 		printf("\n");
 	}
 	printf("\n");

             reply	other threads:[~2003-05-29 23:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-29 23:26 Michael Griffith [this message]
2003-05-30  5:43 ` nfsstat printing overflow Neil Brown
2003-06-02  7:10   ` Greg Lindahl

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=20030529232654.GA32598@doubt \
    --to=grif@michaelgriffith.com \
    --cc=hjl@lucon.org \
    --cc=neilb@cse.unsw.edu.au \
    --cc=nfs@lists.sourceforge.net \
    --cc=okir@monad.swb.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.