![]() |
|
|||
0001 /* SPDX-License-Identifier: GPL-2.0 */ 0002 /* 0003 * linux/include/linux/sunrpc/metrics.h 0004 * 0005 * Declarations for RPC client per-operation metrics 0006 * 0007 * Copyright (C) 2005 Chuck Lever <cel@netapp.com> 0008 * 0009 * RPC client per-operation statistics provide latency and retry 0010 * information about each type of RPC procedure in a given RPC program. 0011 * These statistics are not for detailed problem diagnosis, but simply 0012 * to indicate whether the problem is local or remote. 0013 * 0014 * These counters are not meant to be human-readable, but are meant to be 0015 * integrated into system monitoring tools such as "sar" and "iostat". As 0016 * such, the counters are sampled by the tools over time, and are never 0017 * zeroed after a file system is mounted. Moving averages can be computed 0018 * by the tools by taking the difference between two instantaneous samples 0019 * and dividing that by the time between the samples. 0020 * 0021 * The counters are maintained in a single array per RPC client, indexed 0022 * by procedure number. There is no need to maintain separate counter 0023 * arrays per-CPU because these counters are always modified behind locks. 0024 */ 0025 0026 #ifndef _LINUX_SUNRPC_METRICS_H 0027 #define _LINUX_SUNRPC_METRICS_H 0028 0029 #include <linux/seq_file.h> 0030 #include <linux/ktime.h> 0031 #include <linux/spinlock.h> 0032 0033 #define RPC_IOSTATS_VERS "1.1" 0034 0035 struct rpc_iostats { 0036 spinlock_t om_lock; 0037 0038 /* 0039 * These counters give an idea about how many request 0040 * transmissions are required, on average, to complete that 0041 * particular procedure. Some procedures may require more 0042 * than one transmission because the server is unresponsive, 0043 * the client is retransmitting too aggressively, or the 0044 * requests are large and the network is congested. 0045 */ 0046 unsigned long om_ops, /* count of operations */ 0047 om_ntrans, /* count of RPC transmissions */ 0048 om_timeouts; /* count of major timeouts */ 0049 0050 /* 0051 * These count how many bytes are sent and received for a 0052 * given RPC procedure type. This indicates how much load a 0053 * particular procedure is putting on the network. These 0054 * counts include the RPC and ULP headers, and the request 0055 * payload. 0056 */ 0057 unsigned long long om_bytes_sent, /* count of bytes out */ 0058 om_bytes_recv; /* count of bytes in */ 0059 0060 /* 0061 * The length of time an RPC request waits in queue before 0062 * transmission, the network + server latency of the request, 0063 * and the total time the request spent from init to release 0064 * are measured. 0065 */ 0066 ktime_t om_queue, /* queued for xmit */ 0067 om_rtt, /* RPC RTT */ 0068 om_execute; /* RPC execution */ 0069 /* 0070 * The count of operations that complete with tk_status < 0. 0071 * These statuses usually indicate error conditions. 0072 */ 0073 unsigned long om_error_status; 0074 } ____cacheline_aligned; 0075 0076 struct rpc_task; 0077 struct rpc_clnt; 0078 0079 /* 0080 * EXPORTed functions for managing rpc_iostats structures 0081 */ 0082 0083 #ifdef CONFIG_PROC_FS 0084 0085 struct rpc_iostats * rpc_alloc_iostats(struct rpc_clnt *); 0086 void rpc_count_iostats(const struct rpc_task *, 0087 struct rpc_iostats *); 0088 void rpc_count_iostats_metrics(const struct rpc_task *, 0089 struct rpc_iostats *); 0090 void rpc_clnt_show_stats(struct seq_file *, struct rpc_clnt *); 0091 void rpc_free_iostats(struct rpc_iostats *); 0092 0093 #else /* CONFIG_PROC_FS */ 0094 0095 static inline struct rpc_iostats *rpc_alloc_iostats(struct rpc_clnt *clnt) { return NULL; } 0096 static inline void rpc_count_iostats(const struct rpc_task *task, 0097 struct rpc_iostats *stats) {} 0098 static inline void rpc_count_iostats_metrics(const struct rpc_task *task, 0099 struct rpc_iostats *stats) 0100 { 0101 } 0102 0103 static inline void rpc_clnt_show_stats(struct seq_file *seq, struct rpc_clnt *clnt) {} 0104 static inline void rpc_free_iostats(struct rpc_iostats *stats) {} 0105 0106 #endif /* CONFIG_PROC_FS */ 0107 0108 #endif /* _LINUX_SUNRPC_METRICS_H */
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.1.0 LXR engine. The LXR team |
![]() ![]() |