summaryrefslogtreecommitdiffstats
path: root/xlators/debug/io-stats/src/io-stats.c
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/debug/io-stats/src/io-stats.c')
-rw-r--r--xlators/debug/io-stats/src/io-stats.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/xlators/debug/io-stats/src/io-stats.c b/xlators/debug/io-stats/src/io-stats.c
index 9c3ca2d0a69..b660e5ac8cb 100644
--- a/xlators/debug/io-stats/src/io-stats.c
+++ b/xlators/debug/io-stats/src/io-stats.c
@@ -223,7 +223,7 @@ is_fop_latency_started (call_frame_t *frame)
\
conf = this->private; \
if (conf && conf->measure_latency) { \
- gettimeofday (&frame->end, NULL); \
+ timespec_now (&frame->end); \
update_ios_latency (conf, frame, GF_FOP_##op); \
} \
} while (0)
@@ -234,7 +234,7 @@ is_fop_latency_started (call_frame_t *frame)
\
conf = this->private; \
if (conf && conf->measure_latency) { \
- gettimeofday (&frame->begin, NULL); \
+ timespec_now (&frame->begin); \
} else { \
memset (&frame->begin, 0, sizeof (frame->begin));\
} \
@@ -262,7 +262,7 @@ is_fop_latency_started (call_frame_t *frame)
if (conf && conf->measure_latency && \
conf->count_fop_hits) { \
BUMP_FOP (op); \
- gettimeofday (&frame->end, NULL); \
+ timespec_now (&frame->end); \
update_ios_latency (conf, frame, GF_FOP_##op); \
} \
} while (0)
@@ -271,15 +271,15 @@ is_fop_latency_started (call_frame_t *frame)
do { \
struct ios_conf *conf = NULL; \
double elapsed; \
- struct timeval *begin, *end; \
+ struct timespec *begin, *end; \
double throughput; \
int flag = 0; \
\
begin = &frame->begin; \
end = &frame->end; \
\
- elapsed = (end->tv_sec - begin->tv_sec) * 1e6 \
- + (end->tv_usec - begin->tv_usec); \
+ elapsed = ((end->tv_sec - begin->tv_sec) * 1e9 \
+ + (end->tv_nsec - begin->tv_nsec)) / 1000; \
throughput = op_ret / elapsed; \
\
conf = this->private; \
@@ -1695,7 +1695,7 @@ void collect_ios_latency_sample (struct ios_conf *conf,
{
ios_sample_buf_t *ios_sample_buf = NULL;
ios_sample_t *ios_sample = NULL;
- struct timeval *timestamp = NULL;
+ struct timespec *timestamp = NULL;
call_stack_t *root = NULL;
@@ -1714,7 +1714,7 @@ void collect_ios_latency_sample (struct ios_conf *conf,
ios_sample->uid = root->uid;
ios_sample->gid = root->gid;
(ios_sample->timestamp).tv_sec = timestamp->tv_sec;
- (ios_sample->timestamp).tv_usec = timestamp->tv_usec;
+ (ios_sample->timestamp).tv_usec = timestamp->tv_nsec / 1000;
memcpy (&ios_sample->identifier, &root->identifier,
sizeof (root->identifier));
@@ -1759,13 +1759,13 @@ update_ios_latency (struct ios_conf *conf, call_frame_t *frame,
glusterfs_fop_t op)
{
double elapsed;
- struct timeval *begin, *end;
+ struct timespec *begin, *end;
begin = &frame->begin;
end = &frame->end;
- elapsed = (end->tv_sec - begin->tv_sec) * 1e6
- + (end->tv_usec - begin->tv_usec);
+ elapsed = ((end->tv_sec - begin->tv_sec) * 1e9
+ + (end->tv_nsec - begin->tv_nsec)) / 1000;
update_ios_latency_stats (&conf->cumulative, elapsed, op);
update_ios_latency_stats (&conf->incremental, elapsed, op);