~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/fs/nfsd/stats.c

Version: ~ [ linux-5.4-rc3 ] ~ [ linux-5.3.6 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.79 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.149 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.196 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.196 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.19.8 ] ~ [ linux-3.18.140 ] ~ [ linux-3.17.8 ] ~ [ linux-3.16.75 ] ~ [ linux-3.15.10 ] ~ [ linux-3.14.79 ] ~ [ linux-3.13.11 ] ~ [ linux-3.12.74 ] ~ [ linux-3.11.10 ] ~ [ linux-3.10.108 ] ~ [ linux-3.9.11 ] ~ [ linux-3.8.13 ] ~ [ linux-3.7.10 ] ~ [ linux-3.6.11 ] ~ [ linux-3.5.7 ] ~ [ linux-3.4.113 ] ~ [ linux-3.3.8 ] ~ [ linux-3.2.102 ] ~ [ linux-3.1.10 ] ~ [ linux-3.0.101 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /*
  2  * procfs-based user access to knfsd statistics
  3  *
  4  * /proc/net/rpc/nfsd
  5  *
  6  * Format:
  7  *      rc <hits> <misses> <nocache>
  8  *                      Statistsics for the reply cache
  9  *      fh <stale> <total-lookups> <anonlookups> <dir-not-in-dcache> <nondir-not-in-dcache>
 10  *                      statistics for filehandle lookup
 11  *      io <bytes-read> <bytes-written>
 12  *                      statistics for IO throughput
 13  *      th <threads> <fullcnt> <10%-20%> <20%-30%> ... <90%-100%> <100%> 
 14  *                      time (seconds) when nfsd thread usage above thresholds
 15  *                      and number of times that all threads were in use
 16  *      ra cache-size  <10%  <20%  <30% ... <100% not-found
 17  *                      number of times that read-ahead entry was found that deep in
 18  *                      the cache.
 19  *      plus generic RPC stats (see net/sunrpc/stats.c)
 20  *
 21  * Copyright (C) 1995, 1996, 1997 Olaf Kirch <okir@monad.swb.de>
 22  */
 23 
 24 #include <linux/seq_file.h>
 25 #include <linux/module.h>
 26 #include <linux/sunrpc/stats.h>
 27 #include <linux/nfsd/stats.h>
 28 #include <net/net_namespace.h>
 29 
 30 #include "nfsd.h"
 31 
 32 struct nfsd_stats       nfsdstats;
 33 struct svc_stat         nfsd_svcstats = {
 34         .program        = &nfsd_program,
 35 };
 36 
 37 static int nfsd_proc_show(struct seq_file *seq, void *v)
 38 {
 39         int i;
 40 
 41         seq_printf(seq, "rc %u %u %u\nfh %u %u %u %u %u\nio %u %u\n",
 42                       nfsdstats.rchits,
 43                       nfsdstats.rcmisses,
 44                       nfsdstats.rcnocache,
 45                       nfsdstats.fh_stale,
 46                       nfsdstats.fh_lookup,
 47                       nfsdstats.fh_anon,
 48                       nfsdstats.fh_nocache_dir,
 49                       nfsdstats.fh_nocache_nondir,
 50                       nfsdstats.io_read,
 51                       nfsdstats.io_write);
 52         /* thread usage: */
 53         seq_printf(seq, "th %u %u", nfsdstats.th_cnt, nfsdstats.th_fullcnt);
 54         for (i=0; i<10; i++) {
 55                 unsigned int jifs = nfsdstats.th_usage[i];
 56                 unsigned int sec = jifs / HZ, msec = (jifs % HZ)*1000/HZ;
 57                 seq_printf(seq, " %u.%03u", sec, msec);
 58         }
 59 
 60         /* newline and ra-cache */
 61         seq_printf(seq, "\nra %u", nfsdstats.ra_size);
 62         for (i=0; i<11; i++)
 63                 seq_printf(seq, " %u", nfsdstats.ra_depth[i]);
 64         seq_putc(seq, '\n');
 65         
 66         /* show my rpc info */
 67         svc_seq_show(seq, &nfsd_svcstats);
 68 
 69 #ifdef CONFIG_NFSD_V4
 70         /* Show count for individual nfsv4 operations */
 71         /* Writing operation numbers 0 1 2 also for maintaining uniformity */
 72         seq_printf(seq,"proc4ops %u", LAST_NFS4_OP + 1);
 73         for (i = 0; i <= LAST_NFS4_OP; i++)
 74                 seq_printf(seq, " %u", nfsdstats.nfs4_opcount[i]);
 75 
 76         seq_putc(seq, '\n');
 77 #endif
 78 
 79         return 0;
 80 }
 81 
 82 static int nfsd_proc_open(struct inode *inode, struct file *file)
 83 {
 84         return single_open(file, nfsd_proc_show, NULL);
 85 }
 86 
 87 static const struct file_operations nfsd_proc_fops = {
 88         .owner = THIS_MODULE,
 89         .open = nfsd_proc_open,
 90         .read  = seq_read,
 91         .llseek = seq_lseek,
 92         .release = single_release,
 93 };
 94 
 95 void
 96 nfsd_stat_init(void)
 97 {
 98         svc_proc_register(&init_net, &nfsd_svcstats, &nfsd_proc_fops);
 99 }
100 
101 void
102 nfsd_stat_shutdown(void)
103 {
104         svc_proc_unregister(&init_net, "nfsd");
105 }
106 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp