From e400ae60f5fb51ac2be4544f522d30298372d998 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 cba30391..b01c1921 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 159cb0b4..b7f03c22 100644 --- a/src/redis.c +++ b/src/redis.c @@ -1934,7 +1934,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) { -- GitLab