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

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

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 // SPDX-License-Identifier: GPL-2.0
  2 /*
  3  * procfs-based user access to knfsd statistics
  4  *
  5  * /proc/net/rpc/nfsd
  6  *
  7  * Format:
  8  *      rc <hits> <misses> <nocache>
  9  *                      Statistsics for the reply cache
 10  *      fh <stale> <deprecated filehandle cache stats>
 11  *                      statistics for filehandle lookup
 12  *      io <bytes-read> <bytes-written>
 13  *                      statistics for IO throughput
 14  *      th <threads> <deprecated thread usage histogram stats>
 15  *                      number of threads
 16  *      ra <deprecated ra-cache stats>
 17  *
 18  *      plus generic RPC stats (see net/sunrpc/stats.c)
 19  *
 20  * Copyright (C) 1995, 1996, 1997 Olaf Kirch <okir@monad.swb.de>
 21  */
 22 
 23 #include <linux/seq_file.h>
 24 #include <linux/module.h>
 25 #include <linux/sunrpc/stats.h>
 26 #include <net/net_namespace.h>
 27 
 28 #include "nfsd.h"
 29 
 30 static int nfsd_show(struct seq_file *seq, void *v)
 31 {
 32         struct net *net = pde_data(file_inode(seq->file));
 33         struct nfsd_net *nn = net_generic(net, nfsd_net_id);
 34         int i;
 35 
 36         seq_printf(seq, "rc %lld %lld %lld\nfh %lld 0 0 0 0\nio %lld %lld\n",
 37                    percpu_counter_sum_positive(&nn->counter[NFSD_STATS_RC_HITS]),
 38                    percpu_counter_sum_positive(&nn->counter[NFSD_STATS_RC_MISSES]),
 39                    percpu_counter_sum_positive(&nn->counter[NFSD_STATS_RC_NOCACHE]),
 40                    percpu_counter_sum_positive(&nn->counter[NFSD_STATS_FH_STALE]),
 41                    percpu_counter_sum_positive(&nn->counter[NFSD_STATS_IO_READ]),
 42                    percpu_counter_sum_positive(&nn->counter[NFSD_STATS_IO_WRITE]));
 43 
 44         /* thread usage: */
 45         seq_printf(seq, "th %u 0", atomic_read(&nfsd_th_cnt));
 46 
 47         /* deprecated thread usage histogram stats */
 48         for (i = 0; i < 10; i++)
 49                 seq_puts(seq, " 0.000");
 50 
 51         /* deprecated ra-cache stats */
 52         seq_puts(seq, "\nra 0 0 0 0 0 0 0 0 0 0 0 0\n");
 53 
 54         /* show my rpc info */
 55         svc_seq_show(seq, &nn->nfsd_svcstats);
 56 
 57 #ifdef CONFIG_NFSD_V4
 58         /* Show count for individual nfsv4 operations */
 59         /* Writing operation numbers 0 1 2 also for maintaining uniformity */
 60         seq_printf(seq, "proc4ops %u", LAST_NFS4_OP + 1);
 61         for (i = 0; i <= LAST_NFS4_OP; i++) {
 62                 seq_printf(seq, " %lld",
 63                            percpu_counter_sum_positive(&nn->counter[NFSD_STATS_NFS4_OP(i)]));
 64         }
 65         seq_printf(seq, "\nwdeleg_getattr %lld",
 66                 percpu_counter_sum_positive(&nn->counter[NFSD_STATS_WDELEG_GETATTR]));
 67 
 68         seq_putc(seq, '\n');
 69 #endif
 70 
 71         return 0;
 72 }
 73 
 74 DEFINE_PROC_SHOW_ATTRIBUTE(nfsd);
 75 
 76 void nfsd_proc_stat_init(struct net *net)
 77 {
 78         struct nfsd_net *nn = net_generic(net, nfsd_net_id);
 79 
 80         svc_proc_register(net, &nn->nfsd_svcstats, &nfsd_proc_ops);
 81 }
 82 
 83 void nfsd_proc_stat_shutdown(struct net *net)
 84 {
 85         svc_proc_unregister(net, "nfsd");
 86 }
 87 

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

kernel.org | git.kernel.org | LWN.net | Project Home | 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.

sflogo.php