xref: /linux/fs/netfs/stats.c (revision aec499c75cf8e0b599be4d559e6922b613085f8f)
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 <linux/netfs.h>
11 #include "internal.h"
12 
13 atomic_t netfs_n_rh_readahead;
14 atomic_t netfs_n_rh_readpage;
15 atomic_t netfs_n_rh_rreq;
16 atomic_t netfs_n_rh_sreq;
17 atomic_t netfs_n_rh_download;
18 atomic_t netfs_n_rh_download_done;
19 atomic_t netfs_n_rh_download_failed;
20 atomic_t netfs_n_rh_download_instead;
21 atomic_t netfs_n_rh_read;
22 atomic_t netfs_n_rh_read_done;
23 atomic_t netfs_n_rh_read_failed;
24 atomic_t netfs_n_rh_zero;
25 atomic_t netfs_n_rh_short_read;
26 atomic_t netfs_n_rh_write;
27 atomic_t netfs_n_rh_write_begin;
28 atomic_t netfs_n_rh_write_done;
29 atomic_t netfs_n_rh_write_failed;
30 atomic_t netfs_n_rh_write_zskip;
31 
32 void netfs_stats_show(struct seq_file *m)
33 {
34 	seq_printf(m, "RdHelp : RA=%u RP=%u WB=%u WBZ=%u rr=%u sr=%u\n",
35 		   atomic_read(&netfs_n_rh_readahead),
36 		   atomic_read(&netfs_n_rh_readpage),
37 		   atomic_read(&netfs_n_rh_write_begin),
38 		   atomic_read(&netfs_n_rh_write_zskip),
39 		   atomic_read(&netfs_n_rh_rreq),
40 		   atomic_read(&netfs_n_rh_sreq));
41 	seq_printf(m, "RdHelp : ZR=%u sh=%u sk=%u\n",
42 		   atomic_read(&netfs_n_rh_zero),
43 		   atomic_read(&netfs_n_rh_short_read),
44 		   atomic_read(&netfs_n_rh_write_zskip));
45 	seq_printf(m, "RdHelp : DL=%u ds=%u df=%u di=%u\n",
46 		   atomic_read(&netfs_n_rh_download),
47 		   atomic_read(&netfs_n_rh_download_done),
48 		   atomic_read(&netfs_n_rh_download_failed),
49 		   atomic_read(&netfs_n_rh_download_instead));
50 	seq_printf(m, "RdHelp : RD=%u rs=%u rf=%u\n",
51 		   atomic_read(&netfs_n_rh_read),
52 		   atomic_read(&netfs_n_rh_read_done),
53 		   atomic_read(&netfs_n_rh_read_failed));
54 	seq_printf(m, "RdHelp : WR=%u ws=%u wf=%u\n",
55 		   atomic_read(&netfs_n_rh_write),
56 		   atomic_read(&netfs_n_rh_write_done),
57 		   atomic_read(&netfs_n_rh_write_failed));
58 }
59 EXPORT_SYMBOL(netfs_stats_show);
60