diff options
author | Dmitry Antipov <dmantipov@yandex.ru> | 2020-08-14 11:05:12 +0300 |
---|---|---|
committer | gluster-ant <bugzilla-bot@gluster.org> | 2020-08-14 11:05:12 +0300 |
commit | ba7f24b1cedf2549394c21b3f0df1661227cefae (patch) | |
tree | 8675526202938e798f0e57ac6c2248f1901b025e /xlators/cluster | |
parent | 3c9d5578a623ed1da20e435ddb1283f7b1e7e965 (diff) | |
download | glusterfs-ba7f24b1cedf2549394c21b3f0df1661227cefae.tar.gz glusterfs-ba7f24b1cedf2549394c21b3f0df1661227cefae.tar.xz glusterfs-ba7f24b1cedf2549394c21b3f0df1661227cefae.zip |
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 'xlators/cluster')
-rw-r--r-- | xlators/cluster/dht/src/dht-rebalance.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/xlators/cluster/dht/src/dht-rebalance.c b/xlators/cluster/dht/src/dht-rebalance.c index d850eef62a..7e188e3b3f 100644 --- a/xlators/cluster/dht/src/dht-rebalance.c +++ b/xlators/cluster/dht/src/dht-rebalance.c @@ -2895,8 +2895,7 @@ gf_defrag_migrate_single_file(void *opaque) if (defrag->stats == _gf_true) { gettimeofday(&end, NULL); - elapsed = (end.tv_sec - start.tv_sec) * 1e6 + - (end.tv_usec - start.tv_usec); + elapsed = gf_tvdiff(&start, &end); gf_log(this->name, GF_LOG_INFO, "Migration of " "file:%s size:%" PRIu64 @@ -3500,8 +3499,7 @@ gf_defrag_process_dir(xlator_t *this, gf_defrag_info_t *defrag, loc_t *loc, } gettimeofday(&end, NULL); - elapsed = (end.tv_sec - dir_start.tv_sec) * 1e6 + - (end.tv_usec - dir_start.tv_usec); + elapsed = gf_tvdiff(&dir_start, &end); gf_log(this->name, GF_LOG_INFO, "Migration operation on dir %s took " "%.2f secs", |