David Howells | 289af54 | 2020-11-03 11:32:41 +0000 | [diff] [blame] | 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; |
David Howells | e1b1240 | 2020-09-22 11:06:07 +0100 | [diff] [blame] | 27 | atomic_t netfs_n_rh_write_begin; |
David Howells | 289af54 | 2020-11-03 11:32:41 +0000 | [diff] [blame] | 28 | atomic_t netfs_n_rh_write_done; |
| 29 | atomic_t netfs_n_rh_write_failed; |
David Howells | e1b1240 | 2020-09-22 11:06:07 +0100 | [diff] [blame] | 30 | atomic_t netfs_n_rh_write_zskip; |
David Howells | 289af54 | 2020-11-03 11:32:41 +0000 | [diff] [blame] | 31 | |
| 32 | void netfs_stats_show(struct seq_file *m) |
| 33 | { |
David Howells | e1b1240 | 2020-09-22 11:06:07 +0100 | [diff] [blame] | 34 | seq_printf(m, "RdHelp : RA=%u RP=%u WB=%u WBZ=%u rr=%u sr=%u\n", |
David Howells | 289af54 | 2020-11-03 11:32:41 +0000 | [diff] [blame] | 35 | atomic_read(&netfs_n_rh_readahead), |
| 36 | atomic_read(&netfs_n_rh_readpage), |
David Howells | e1b1240 | 2020-09-22 11:06:07 +0100 | [diff] [blame] | 37 | atomic_read(&netfs_n_rh_write_begin), |
| 38 | atomic_read(&netfs_n_rh_write_zskip), |
David Howells | 289af54 | 2020-11-03 11:32:41 +0000 | [diff] [blame] | 39 | atomic_read(&netfs_n_rh_rreq), |
| 40 | atomic_read(&netfs_n_rh_sreq)); |
David Howells | e1b1240 | 2020-09-22 11:06:07 +0100 | [diff] [blame] | 41 | seq_printf(m, "RdHelp : ZR=%u sh=%u sk=%u\n", |
David Howells | 289af54 | 2020-11-03 11:32:41 +0000 | [diff] [blame] | 42 | atomic_read(&netfs_n_rh_zero), |
David Howells | e1b1240 | 2020-09-22 11:06:07 +0100 | [diff] [blame] | 43 | atomic_read(&netfs_n_rh_short_read), |
| 44 | atomic_read(&netfs_n_rh_write_zskip)); |
David Howells | 289af54 | 2020-11-03 11:32:41 +0000 | [diff] [blame] | 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); |