summaryrefslogtreecommitdiffstats
path: root/glusterfsd/src/glusterfsd-mgmt.c
diff options
context:
space:
mode:
authorDmitry Antipov <dmantipov@yandex.ru>2020-08-14 11:05:12 +0300
committerAmar Tumballi <amar@kadalu.io>2020-08-21 03:56:52 +0000
commit3de807a14721ec9e963f1de4d4b805cdaf1212d6 (patch)
tree8675526202938e798f0e57ac6c2248f1901b025e /glusterfsd/src/glusterfsd-mgmt.c
parent41b9616435cbdf671805856e487e373060c9455b (diff)
libglusterfs: add functions to calculate time difference
Add gf_tvdiff() and gf_tsdiff() to calculate the difference between 'struct timeval' and 'struct timespec' values, use them where appropriate. Change-Id: I172be06ee84e99a1da76847c15e5ea3fbc059338 Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru> Updates: #1002
Diffstat (limited to 'glusterfsd/src/glusterfsd-mgmt.c')
-rw-r--r--glusterfsd/src/glusterfsd-mgmt.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/glusterfsd/src/glusterfsd-mgmt.c b/glusterfsd/src/glusterfsd-mgmt.c
index 793f27ab67f..eaf6796e4c3 100644
--- a/glusterfsd/src/glusterfsd-mgmt.c
+++ b/glusterfsd/src/glusterfsd-mgmt.c
@@ -629,7 +629,7 @@ glusterfs_volume_top_perf(const char *brick_path, dict_t *dict,
goto out;
}
- time = (end.tv_sec - begin.tv_sec) * 1e6 + (end.tv_usec - begin.tv_usec);
+ time = gf_tvdiff(&begin, &end);
throughput = total_blks / time;
gf_log("glusterd", GF_LOG_INFO,
"Throughput %.2f Mbps time %.2f secs "
@@ -685,7 +685,7 @@ glusterfs_volume_top_perf(const char *brick_path, dict_t *dict,
goto out;
}
- time = (end.tv_sec - begin.tv_sec) * 1e6 + (end.tv_usec - begin.tv_usec);
+ time = gf_tvdiff(&begin, &end);
throughput = total_blks / time;
gf_log("glusterd", GF_LOG_INFO,
"Throughput %.2f Mbps time %.2f secs "