summaryrefslogtreecommitdiffstats
path: root/xlators/debug/io-stats
diff options
context:
space:
mode:
authorAmar Tumballi <amarts@redhat.com>2017-09-25 16:44:06 +0530
committerJeff Darcy <jeff@pl.atyp.us>2017-11-06 14:23:49 +0000
commit125fc934e7f4c669f67e5eec5b0e3dae3a2b6d72 (patch)
tree24d1aa5139ad5766c4e9bc9e6add7e55df8fe329 /xlators/debug/io-stats
parente86d71b7b4653ddd66db7f3a16074e46ed24848f (diff)
stack: change gettimeofday() to clock_gettime()
For achieving the above, needed below changes too. * more sanity into how 'frame->op' is assigned. * infra to have 'stats' as separate section in 'xlator_t' structure Updates #137 Change-Id: I36679bf9577f3ed00a695b4e7d92870dcb3db8e1 Signed-off-by: Amar Tumballi <amarts@redhat.com>
Diffstat (limited to 'xlators/debug/io-stats')
-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 9c3ca2d..b660e5a 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);