From b4c4be785cf5aeb480eabefd18a131655d36734f Mon Sep 17 00:00:00 2001 From: zhanghailei Date: Mon, 27 Oct 2014 14:02:52 +0800 Subject: [PATCH] FIXED redis-benchmark's idle mode.With idle mode shouldn't create write event --- src/redis-benchmark.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/redis-benchmark.c b/src/redis-benchmark.c index 2e67f1021..33e1ff7b6 100644 --- a/src/redis-benchmark.c +++ b/src/redis-benchmark.c @@ -390,7 +390,8 @@ static client createClient(char *cmd, size_t len, client from) { } } } - aeCreateFileEvent(config.el,c->context->fd,AE_WRITABLE,writeHandler,c); + if (config.idlemode == 0) + aeCreateFileEvent(config.el,c->context->fd,AE_WRITABLE,writeHandler,c); listAddNodeTail(config.clients,c); config.liveclients++; return c; @@ -599,9 +600,13 @@ int showThroughput(struct aeEventLoop *eventLoop, long long id, void *clientData if (config.liveclients == 0) { fprintf(stderr,"All clients disconnected... aborting.\n"); exit(1); - } - + } if (config.csv) return 250; + if (config.idlemode == 1) { + printf("clients: %d\r", config.liveclients); + fflush(stdout); + return 250; + } float dt = (float)(mstime()-config.start)/1000.0; float rps = (float)config.requests_finished/dt; printf("%s: %.2f\r", config.title, rps);