diff options
-rw-r--r-- | rpc/rpc-lib/src/rpc-transport.h | 3 | ||||
-rw-r--r-- | rpc/rpc-transport/socket/src/socket.c | 2 | ||||
-rw-r--r-- | xlators/protocol/client/src/client.c | 8 | ||||
-rw-r--r-- | xlators/protocol/server/src/server.c | 21 |
4 files changed, 34 insertions, 0 deletions
diff --git a/rpc/rpc-lib/src/rpc-transport.h b/rpc/rpc-lib/src/rpc-transport.h index cccae5f261d..2ba46fba9f7 100644 --- a/rpc/rpc-lib/src/rpc-transport.h +++ b/rpc/rpc-lib/src/rpc-transport.h @@ -198,6 +198,9 @@ struct rpc_transport { peer_info_t peerinfo; peer_info_t myinfo; + uint64_t total_bytes_read; + uint64_t total_bytes_write; + struct list_head list; }; diff --git a/rpc/rpc-transport/socket/src/socket.c b/rpc/rpc-transport/socket/src/socket.c index 9e85c3ca902..1d6ebc803fb 100644 --- a/rpc/rpc-transport/socket/src/socket.c +++ b/rpc/rpc-transport/socket/src/socket.c @@ -176,12 +176,14 @@ __socket_rwv (rpc_transport_t *this, struct iovec *vector, int count, /* done for now */ break; } + this->total_bytes_write += ret; } else { ret = readv (sock, opvector, opcount); if (ret == -1 && errno == EAGAIN) { /* done for now */ break; } + this->total_bytes_read += ret; } if (ret == 0) { diff --git a/xlators/protocol/client/src/client.c b/xlators/protocol/client/src/client.c index c1a56722f72..03e0ec44266 100644 --- a/xlators/protocol/client/src/client.c +++ b/xlators/protocol/client/src/client.c @@ -1868,6 +1868,14 @@ client_priv_dump (xlator_t *this) gf_proc_dump_build_key(key, key_prefix, "last_received"); gf_proc_dump_write(key, "%s", ctime(&conf->last_received.tv_sec)); + gf_proc_dump_build_key(key, key_prefix, "total_bytes_read"); + gf_proc_dump_write(key, "%"PRIu64, + conf->rpc->conn.trans->total_bytes_read); + + gf_proc_dump_build_key(key, key_prefix, "total_bytes_written"); + gf_proc_dump_write(key, "%"PRIu64, + conf->rpc->conn.trans->total_bytes_write); + pthread_mutex_unlock(&conf->lock); return 0; diff --git a/xlators/protocol/server/src/server.c b/xlators/protocol/server/src/server.c index 98a832faf55..5d1f3aabea8 100644 --- a/xlators/protocol/server/src/server.c +++ b/xlators/protocol/server/src/server.c @@ -232,6 +232,27 @@ server_fd (xlator_t *this) int server_priv (xlator_t *this) { + server_conf_t *conf = NULL; + rpc_transport_t *xprt = NULL; + char key[GF_DUMP_MAX_BUF_LEN] = {0,}; + uint64_t total_read = 0; + uint64_t total_write = 0; + + conf = this->private; + if (!conf) + return 0; + + list_for_each_entry (xprt, &conf->xprt_list, list) { + total_read += xprt->total_bytes_read; + total_write += xprt->total_bytes_write; + } + + gf_proc_dump_build_key(key, "server", "total-bytes-read"); + gf_proc_dump_write(key, "%"PRIu64, total_read); + + gf_proc_dump_build_key(key, "server", "total-bytes-write"); + gf_proc_dump_write(key, "%"PRIu64, total_write); + return 0; } |