From 69ba6924c99940777913d6e4b68757bd85d0d400 Mon Sep 17 00:00:00 2001 From: antirez Date: Tue, 1 Jul 2014 16:09:02 +0200 Subject: [PATCH] Latency monitor: command duration is in useconds. Convert. --- src/latency.h | 4 ++-- src/redis.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/latency.h b/src/latency.h index cba303912..b01c19214 100644 --- a/src/latency.h +++ b/src/latency.h @@ -36,7 +36,7 @@ void latencyAddSample(char *event, mstime_t latency); /* Add the sample only if the elapsed time is >= to the configured threshold. */ #define latencyAddSampleIfNeeded(event,var) \ if (server.latency_monitor_threshold && \ - var >= server.latency_monitor_threshold) \ - latencyAddSample(event,var); + (var) >= server.latency_monitor_threshold) \ + latencyAddSample((event),(var)); #endif /* __LATENCY_H */ diff --git a/src/redis.c b/src/redis.c index a520bd75b..c993dc06c 100644 --- a/src/redis.c +++ b/src/redis.c @@ -2026,7 +2026,7 @@ void call(redisClient *c, int flags) { if (flags & REDIS_CALL_SLOWLOG && c->cmd->proc != execCommand) { char *latency_event = (c->cmd->flags & REDIS_CMD_FAST) ? "fast-command" : "command"; - latencyAddSampleIfNeeded(latency_event,duration); + latencyAddSampleIfNeeded(latency_event,duration/1000); slowlogPushEntryIfNeeded(c->argv,c->argc,duration); } if (flags & REDIS_CALL_STATS) {