diff options
author | Chuck Lever <cel@netapp.com> | 2006-03-20 13:44:16 -0500 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2006-03-20 13:44:16 -0500 |
commit | 262ca07de4d7f1bff20361c1353bb14b3607afb2 (patch) | |
tree | e448a66b4549bbd660f76e81da0067d762a4732e /net/sunrpc/xprtsock.c | |
parent | e19b63dafdf7d615b0d36b90990a07e7792b9d3a (diff) |
SUNRPC: add a handful of per-xprt counters
Monitor generic transport events. Add a transport switch callout to
format transport counters for export to user-land.
Test plan:
Compile kernel with CONFIG_NFS enabled.
Signed-off-by: Chuck Lever <cel@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'net/sunrpc/xprtsock.c')
-rw-r--r-- | net/sunrpc/xprtsock.c | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c index c458f8d1d6d1..6766b7f1ecf9 100644 --- a/net/sunrpc/xprtsock.c +++ b/net/sunrpc/xprtsock.c | |||
@@ -1114,6 +1114,8 @@ static void xs_tcp_connect_worker(void *args) | |||
1114 | } | 1114 | } |
1115 | 1115 | ||
1116 | /* Tell the socket layer to start connecting... */ | 1116 | /* Tell the socket layer to start connecting... */ |
1117 | xprt->stat.connect_count++; | ||
1118 | xprt->stat.connect_start = jiffies; | ||
1117 | status = sock->ops->connect(sock, (struct sockaddr *) &xprt->addr, | 1119 | status = sock->ops->connect(sock, (struct sockaddr *) &xprt->addr, |
1118 | sizeof(xprt->addr), O_NONBLOCK); | 1120 | sizeof(xprt->addr), O_NONBLOCK); |
1119 | dprintk("RPC: %p connect status %d connected %d sock state %d\n", | 1121 | dprintk("RPC: %p connect status %d connected %d sock state %d\n", |
@@ -1177,6 +1179,50 @@ static void xs_connect(struct rpc_task *task) | |||
1177 | } | 1179 | } |
1178 | } | 1180 | } |
1179 | 1181 | ||
1182 | /** | ||
1183 | * xs_udp_print_stats - display UDP socket-specifc stats | ||
1184 | * @xprt: rpc_xprt struct containing statistics | ||
1185 | * @seq: output file | ||
1186 | * | ||
1187 | */ | ||
1188 | static void xs_udp_print_stats(struct rpc_xprt *xprt, struct seq_file *seq) | ||
1189 | { | ||
1190 | seq_printf(seq, "\txprt:\tudp %u %lu %lu %lu %lu %Lu %Lu\n", | ||
1191 | xprt->port, | ||
1192 | xprt->stat.bind_count, | ||
1193 | xprt->stat.sends, | ||
1194 | xprt->stat.recvs, | ||
1195 | xprt->stat.bad_xids, | ||
1196 | xprt->stat.req_u, | ||
1197 | xprt->stat.bklog_u); | ||
1198 | } | ||
1199 | |||
1200 | /** | ||
1201 | * xs_tcp_print_stats - display TCP socket-specifc stats | ||
1202 | * @xprt: rpc_xprt struct containing statistics | ||
1203 | * @seq: output file | ||
1204 | * | ||
1205 | */ | ||
1206 | static void xs_tcp_print_stats(struct rpc_xprt *xprt, struct seq_file *seq) | ||
1207 | { | ||
1208 | long idle_time = 0; | ||
1209 | |||
1210 | if (xprt_connected(xprt)) | ||
1211 | idle_time = (long)(jiffies - xprt->last_used) / HZ; | ||
1212 | |||
1213 | seq_printf(seq, "\txprt:\ttcp %u %lu %lu %lu %ld %lu %lu %lu %Lu %Lu\n", | ||
1214 | xprt->port, | ||
1215 | xprt->stat.bind_count, | ||
1216 | xprt->stat.connect_count, | ||
1217 | xprt->stat.connect_time, | ||
1218 | idle_time, | ||
1219 | xprt->stat.sends, | ||
1220 | xprt->stat.recvs, | ||
1221 | xprt->stat.bad_xids, | ||
1222 | xprt->stat.req_u, | ||
1223 | xprt->stat.bklog_u); | ||
1224 | } | ||
1225 | |||
1180 | static struct rpc_xprt_ops xs_udp_ops = { | 1226 | static struct rpc_xprt_ops xs_udp_ops = { |
1181 | .set_buffer_size = xs_udp_set_buffer_size, | 1227 | .set_buffer_size = xs_udp_set_buffer_size, |
1182 | .reserve_xprt = xprt_reserve_xprt_cong, | 1228 | .reserve_xprt = xprt_reserve_xprt_cong, |
@@ -1191,6 +1237,7 @@ static struct rpc_xprt_ops xs_udp_ops = { | |||
1191 | .release_request = xprt_release_rqst_cong, | 1237 | .release_request = xprt_release_rqst_cong, |
1192 | .close = xs_close, | 1238 | .close = xs_close, |
1193 | .destroy = xs_destroy, | 1239 | .destroy = xs_destroy, |
1240 | .print_stats = xs_udp_print_stats, | ||
1194 | }; | 1241 | }; |
1195 | 1242 | ||
1196 | static struct rpc_xprt_ops xs_tcp_ops = { | 1243 | static struct rpc_xprt_ops xs_tcp_ops = { |
@@ -1204,6 +1251,7 @@ static struct rpc_xprt_ops xs_tcp_ops = { | |||
1204 | .set_retrans_timeout = xprt_set_retrans_timeout_def, | 1251 | .set_retrans_timeout = xprt_set_retrans_timeout_def, |
1205 | .close = xs_close, | 1252 | .close = xs_close, |
1206 | .destroy = xs_destroy, | 1253 | .destroy = xs_destroy, |
1254 | .print_stats = xs_tcp_print_stats, | ||
1207 | }; | 1255 | }; |
1208 | 1256 | ||
1209 | /** | 1257 | /** |