From: Michael Vrable Date: Fri, 2 Apr 2010 20:59:41 +0000 (-0700) Subject: Improve statistics gathered. X-Git-Url: https://git.vrable.net/?a=commitdiff_plain;h=ea7099e8f1f6319cf6d20087d71209fa79cecf6f;p=bluesky.git Improve statistics gathered. --- diff --git a/bluesky/store.c b/bluesky/store.c index 2043806..427112b 100644 --- a/bluesky/store.c +++ b/bluesky/store.c @@ -231,10 +231,12 @@ void bluesky_store_async_mark_complete(BlueSkyStoreAsync *async) async, elapsed, latency); } - if (async->op == STORE_OP_GET) { - bluesky_stats_add(async->store->stats_get, 1); - } else if (async->op == STORE_OP_PUT) { - bluesky_stats_add(async->store->stats_put, 1); + if (async->data) { + if (async->op == STORE_OP_GET) { + bluesky_stats_add(async->store->stats_get, async->data->len); + } else if (async->op == STORE_OP_PUT) { + bluesky_stats_add(async->store->stats_put, async->data->len); + } } } diff --git a/nfs3/rpc.c b/nfs3/rpc.c index dbe0a64..5341f20 100644 --- a/nfs3/rpc.c +++ b/nfs3/rpc.c @@ -28,6 +28,7 @@ extern BlueSkyFS *fs; static int outstanding_rpcs = 0; +static struct bluesky_stats *rpc_recv_stats, *rpc_send_stats; /* TCP port number to use for NFS protocol. (Should be 2049.) */ #define NFS_SERVICE_PORT 2051 @@ -194,6 +195,7 @@ async_rpc_send_reply(RPCRequest *req, void *result) } g_atomic_int_add(&outstanding_rpcs, -1); + bluesky_stats_add(rpc_send_stats, str->len); struct rpc_reply header; header.xid = htonl(req->xid); @@ -569,6 +571,8 @@ static gboolean async_rpc_dispatch(RPCConnection *rpc) GString *msg = rpc->msgbuf; const char *buf = msg->str; + bluesky_stats_add(rpc_recv_stats, msg->len); + if (msg->len < sizeof(struct rpc_call_header)) { fprintf(stderr, "Short RPC message: only %zd bytes!\n", msg->len); return FALSE; @@ -861,6 +865,9 @@ void register_rpc() { SVCXPRT *transp; + rpc_recv_stats = bluesky_stats_new("NFS RPC Messages In"); + rpc_send_stats = bluesky_stats_new("NFS RPC Messages Out"); + async_rpc_init(); /* MOUNT protocol */