diff options
author | Dmitry Antipov <dmantipov@yandex.ru> | 2020-08-14 11:05:12 +0300 |
---|---|---|
committer | Amar Tumballi <amar@kadalu.io> | 2020-08-21 03:56:52 +0000 |
commit | 3de807a14721ec9e963f1de4d4b805cdaf1212d6 (patch) | |
tree | 8675526202938e798f0e57ac6c2248f1901b025e /libglusterfs/src/latency.c | |
parent | 41b9616435cbdf671805856e487e373060c9455b (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 'libglusterfs/src/latency.c')
-rw-r--r-- | libglusterfs/src/latency.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/libglusterfs/src/latency.c b/libglusterfs/src/latency.c index 15b397c3799..8ec89093d41 100644 --- a/libglusterfs/src/latency.c +++ b/libglusterfs/src/latency.c @@ -30,8 +30,7 @@ gf_update_latency(call_frame_t *frame) if (!(begin->tv_sec && end->tv_sec)) goto out; - elapsed = (end->tv_sec - begin->tv_sec) * 1e9 + - (end->tv_nsec - begin->tv_nsec); + elapsed = gf_tsdiff(begin, end); if (frame->op < 0 || frame->op >= GF_FOP_MAXVALUE) { gf_log("[core]", GF_LOG_WARNING, "Invalid frame op value: %d", |