X-Git-Url: https://git.decadent.org.uk/gitweb/?p=nfs-utils.git;a=blobdiff_plain;f=utils%2Fnfsstat%2Fnfsstat.c;h=b26b3b8a04acacad40a1a6d89311e895d615abc1;hp=afd323ede6f1f269fba68e6d9ecf998cf8c78229;hb=5fb01106f45ddbd6836d75496fb11070044a454a;hpb=43180e51d5f19a6a6b9c908bfeeef0d8d0cc99fd diff --git a/utils/nfsstat/nfsstat.c b/utils/nfsstat/nfsstat.c index afd323e..b26b3b8 100644 --- a/utils/nfsstat/nfsstat.c +++ b/utils/nfsstat/nfsstat.c @@ -59,8 +59,8 @@ static unsigned int svcfhinfo[6]; /* (for kernels >= 2.4.0) * 0 stale * 1 FH lookups * 2 'anon' FHs - * 3 noncached non-directories - * 4 noncached directories + * 3 noncached directories + * 4 noncached non-directories * leave hole to relocate stale for order * compatability. */ @@ -214,11 +214,17 @@ main(int argc, char **argv) /* * 2.2 puts all fh-related info after the 'rc' header * 2.4 puts all fh-related info after the 'fh' header, but relocates - * 'stale' to the start :-( We keep it at the end. + * 'stale' to the start and swaps dir and nondir :-( + * We preseve the 2.2 order */ if (opt_prt & PRNT_FH) { if (get_stat_info("fh", svcinfo)) { /* >= 2.4 */ + int t = svcfhinfo[3]; + svcfhinfo[3]=svcfhinfo[4]; + svcfhinfo[4]=t; + svcfhinfo[5]=svcfhinfo[0]; /* relocate 'stale' */ + print_numbers( "Server file handle cache:\n" "lookup anon ncachedir ncachedir stale\n", @@ -301,7 +307,8 @@ static void 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); @@ -313,9 +320,10 @@ print_callstats(const char *hdr, const char **names, 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 %2llu%% ", info[i+j], pct); + } printf("\n"); } printf("\n");