From e697c55c7911487e505116452e0e7ff32d8a52a9 Mon Sep 17 00:00:00 2001 From: komaln Date: Thu, 17 Jan 2008 07:49:49 +0000 Subject: [PATCH] b=14184 r=Nathan, Wangdi To add ptlrpc client stats. --- lustre/ptlrpc/client.c | 10 ++++++++++ lustre/ptlrpc/niobuf.c | 7 ++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/lustre/ptlrpc/client.c b/lustre/ptlrpc/client.c index c0f3a1b..169f72d0 100644 --- a/lustre/ptlrpc/client.c +++ b/lustre/ptlrpc/client.c @@ -795,10 +795,14 @@ static int ptlrpc_check_status(struct ptlrpc_request *req) static int after_reply(struct ptlrpc_request *req) { struct obd_import *imp = req->rq_import; + struct obd_device *obd = req->rq_import->imp_obd; int rc; + struct timeval work_start; + long timediff; ENTRY; LASSERT(!req->rq_receiving_reply); + LASSERT(obd); /* NB Until this point, the whole of the incoming message, * including buflens, status etc is in the sender's byte order. */ @@ -808,6 +812,12 @@ static int after_reply(struct ptlrpc_request *req) if (rc) RETURN(rc); + do_gettimeofday(&work_start); + timediff = cfs_timeval_sub(&work_start, &req->rq_arrival_time, NULL); + if (obd->obd_svc_stats != NULL) + lprocfs_counter_add(obd->obd_svc_stats, PTLRPC_REQWAIT_CNTR, + timediff); + OBD_FAIL_TIMEOUT(OBD_FAIL_PTLRPC_PAUSE_REP, obd_fail_val); ptlrpc_at_adj_service(req); ptlrpc_at_adj_net_latency(req); diff --git a/lustre/ptlrpc/niobuf.c b/lustre/ptlrpc/niobuf.c index f8571ca..e9822b1 100644 --- a/lustre/ptlrpc/niobuf.c +++ b/lustre/ptlrpc/niobuf.c @@ -441,6 +441,7 @@ int ptl_send_rpc(struct ptlrpc_request *request, int noreply) struct ptlrpc_connection *connection; lnet_handle_me_t reply_me_h; lnet_md_t reply_md; + struct obd_device *obd = request->rq_import->imp_obd; ENTRY; OBD_FAIL_RETURN(OBD_FAIL_PTLRPC_DROP_RPC, 0); @@ -459,7 +460,7 @@ int ptl_send_rpc(struct ptlrpc_request *request, int noreply) request->rq_err = 1; RETURN(-ENODEV); } - + connection = request->rq_import->imp_connection; if (request->rq_bulk != NULL) { @@ -540,10 +541,14 @@ int ptl_send_rpc(struct ptlrpc_request *request, int noreply) /* add references on request and import for request_out_callback */ ptlrpc_request_addref(request); atomic_inc(&request->rq_import->imp_inflight); + if (obd->obd_svc_stats != NULL) + lprocfs_counter_add(obd->obd_svc_stats, PTLRPC_REQACTIVE_CNTR, + request->rq_import->imp_inflight.counter); OBD_FAIL_TIMEOUT(OBD_FAIL_PTLRPC_DELAY_SEND, request->rq_timeout + 5); request->rq_sent = cfs_time_current_sec(); + do_gettimeofday(&request->rq_arrival_time); /* We give the server rq_timeout secs to process the req, and add the network latency for our local timeout. */ request->rq_deadline = request->rq_sent + request->rq_timeout + -- 1.8.3.1