2 * linux/include/linux/sunrpc/metrics.h
4 * Declarations for RPC client per-operation metrics
6 * Copyright (C) 2005 Chuck Lever <cel@netapp.com>
8 * RPC client per-operation statistics provide latency and retry
9 * information about each type of RPC procedure in a given RPC program.
10 * These statistics are not for detailed problem diagnosis, but simply
11 * to indicate whether the problem is local or remote.
13 * These counters are not meant to be human-readable, but are meant to be
14 * integrated into system monitoring tools such as "sar" and "iostat". As
15 * such, the counters are sampled by the tools over time, and are never
16 * zeroed after a file system is mounted. Moving averages can be computed
17 * by the tools by taking the difference between two instantaneous samples
18 * and dividing that by the time between the samples.
20 * The counters are maintained in a single array per RPC client, indexed
21 * by procedure number. There is no need to maintain separate counter
22 * arrays per-CPU because these counters are always modified behind locks.
25 #ifndef _LINUX_SUNRPC_METRICS_H
26 #define _LINUX_SUNRPC_METRICS_H
28 #include <linux/seq_file.h>
30 #define RPC_IOSTATS_VERS "1.0"
34 * These counters give an idea about how many request
35 * transmissions are required, on average, to complete that
36 * particular procedure. Some procedures may require more
37 * than one transmission because the server is unresponsive,
38 * the client is retransmitting too aggressively, or the
39 * requests are large and the network is congested.
41 unsigned long om_ops, /* count of operations */
42 om_ntrans, /* count of RPC transmissions */
43 om_timeouts; /* count of major timeouts */
46 * These count how many bytes are sent and received for a
47 * given RPC procedure type. This indicates how much load a
48 * particular procedure is putting on the network. These
49 * counts include the RPC and ULP headers, and the request
52 unsigned long long om_bytes_sent, /* count of bytes out */
53 om_bytes_recv; /* count of bytes in */
56 * The length of time an RPC request waits in queue before
57 * transmission, the network + server latency of the request,
58 * and the total time the request spent from init to release
61 unsigned long long om_queue, /* jiffies queued for xmit */
62 om_rtt, /* jiffies for RPC RTT */
63 om_execute; /* jiffies for RPC execution */
64 } ____cacheline_aligned;
70 * EXPORTed functions for managing rpc_iostats structures
75 struct rpc_iostats * rpc_alloc_iostats(struct rpc_clnt *);
76 void rpc_count_iostats(struct rpc_task *);
77 void rpc_print_iostats(struct seq_file *, struct rpc_clnt *);
78 void rpc_free_iostats(struct rpc_iostats *);
80 #else /* CONFIG_PROC_FS */
82 static inline struct rpc_iostats *rpc_alloc_iostats(struct rpc_clnt *clnt) { return NULL; }
83 static inline void rpc_count_iostats(struct rpc_task *task) {}
84 static inline void rpc_print_iostats(struct seq_file *seq, struct rpc_clnt *clnt) {}
85 static inline void rpc_free_iostats(struct rpc_iostats *stats) {}
87 #endif /* CONFIG_PROC_FS */
89 #endif /* _LINUX_SUNRPC_METRICS_H */