xref: /linux/fs/netfs/stats.c (revision da1d9caf95def6f0320819cf941c9fd1069ba9e1)
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /* Netfs support statistics
3  *
4  * Copyright (C) 2021 Red Hat, Inc. All Rights Reserved.
5  * Written by David Howells (dhowells@redhat.com)
6  */
7 
8 #include <linux/export.h>
9 #include <linux/seq_file.h>
10 #include "internal.h"
11 
12 atomic_t netfs_n_rh_readahead;
13 atomic_t netfs_n_rh_readpage;
14 atomic_t netfs_n_rh_rreq;
15 atomic_t netfs_n_rh_sreq;
16 atomic_t netfs_n_rh_download;
17 atomic_t netfs_n_rh_download_done;
18 atomic_t netfs_n_rh_download_failed;
19 atomic_t netfs_n_rh_download_instead;
20 atomic_t netfs_n_rh_read;
21 atomic_t netfs_n_rh_read_done;
22 atomic_t netfs_n_rh_read_failed;
23 atomic_t netfs_n_rh_zero;
24 atomic_t netfs_n_rh_short_read;
25 atomic_t netfs_n_rh_write;
26 atomic_t netfs_n_rh_write_begin;
27 atomic_t netfs_n_rh_write_done;
28 atomic_t netfs_n_rh_write_failed;
29 atomic_t netfs_n_rh_write_zskip;
30 
31 void netfs_stats_show(struct seq_file *m)
32 {
33 	seq_printf(m, "RdHelp : RA=%u RP=%u WB=%u WBZ=%u rr=%u sr=%u\n",
34 		   atomic_read(&netfs_n_rh_readahead),
35 		   atomic_read(&netfs_n_rh_readpage),
36 		   atomic_read(&netfs_n_rh_write_begin),
37 		   atomic_read(&netfs_n_rh_write_zskip),
38 		   atomic_read(&netfs_n_rh_rreq),
39 		   atomic_read(&netfs_n_rh_sreq));
40 	seq_printf(m, "RdHelp : ZR=%u sh=%u sk=%u\n",
41 		   atomic_read(&netfs_n_rh_zero),
42 		   atomic_read(&netfs_n_rh_short_read),
43 		   atomic_read(&netfs_n_rh_write_zskip));
44 	seq_printf(m, "RdHelp : DL=%u ds=%u df=%u di=%u\n",
45 		   atomic_read(&netfs_n_rh_download),
46 		   atomic_read(&netfs_n_rh_download_done),
47 		   atomic_read(&netfs_n_rh_download_failed),
48 		   atomic_read(&netfs_n_rh_download_instead));
49 	seq_printf(m, "RdHelp : RD=%u rs=%u rf=%u\n",
50 		   atomic_read(&netfs_n_rh_read),
51 		   atomic_read(&netfs_n_rh_read_done),
52 		   atomic_read(&netfs_n_rh_read_failed));
53 	seq_printf(m, "RdHelp : WR=%u ws=%u wf=%u\n",
54 		   atomic_read(&netfs_n_rh_write),
55 		   atomic_read(&netfs_n_rh_write_done),
56 		   atomic_read(&netfs_n_rh_write_failed));
57 }
58 EXPORT_SYMBOL(netfs_stats_show);
59