summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorAmar Tumballi <amar@gluster.com>2010-09-14 03:54:39 +0000
committerVijay Bellur <vijay@dev.gluster.com>2010-09-14 04:37:12 -0700
commitbc4f737210bc0971d031cf9b3ff8fe941482eabc (patch)
tree9a42376cc79e4ae195567626a8ab377f236db8c6 /xlators
parentff9eb1d536f2c57ec216b9ce8b96d1f536984008 (diff)
socket: add xfer data counts
* keeping track of data transfered over wire helps to identify the protocol overhead, and also can help us in debugging more on server loads Signed-off-by: Amar Tumballi <amar@gluster.com> Signed-off-by: Vijay Bellur <vijay@dev.gluster.com> BUG: 971 (dynamic volume management) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=971
Diffstat (limited to 'xlators')
-rw-r--r--xlators/protocol/client/src/client.c8
-rw-r--r--xlators/protocol/server/src/server.c21
2 files changed, 29 insertions, 0 deletions
diff --git a/xlators/protocol/client/src/client.c b/xlators/protocol/client/src/client.c
index c1a56722f..03e0ec442 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 98a832faf..5d1f3aabe 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;
}