diff options
author | Itamar Haber <itamar@redislabs.com> | 2020-08-11 14:31:11 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-11 14:31:11 +0300 |
commit | 28a84651029c56b951e2dcfd149292135fc922a1 (patch) | |
tree | 32a362f6ea10dffe2e1ec9a721e4ad64abe0de0b /src/redis-benchmark.c | |
parent | 5dd499c6d45dcd2c8bd082b03895847d3e8c465b (diff) | |
parent | 6a06a5a597b349be4cf587e59613bbf4cd2f2c43 (diff) | |
download | redis-28a84651029c56b951e2dcfd149292135fc922a1.tar.gz |
Merge pull request #7618 from ShooterIT/benchmark-zset
[Redis-benchmark] Support zset type
Diffstat (limited to 'src/redis-benchmark.c')
-rw-r--r-- | src/redis-benchmark.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/redis-benchmark.c b/src/redis-benchmark.c index f47cbe333..9ba381409 100644 --- a/src/redis-benchmark.c +++ b/src/redis-benchmark.c @@ -1433,7 +1433,8 @@ usage: " --cluster Enable cluster mode.\n" " --enable-tracking Send CLIENT TRACKING on before starting benchmark.\n" " -k <boolean> 1=keep alive 0=reconnect (default 1)\n" -" -r <keyspacelen> Use random keys for SET/GET/INCR, random values for SADD\n" +" -r <keyspacelen> Use random keys for SET/GET/INCR, random values for SADD,\n" +" random members and scores for ZADD.\n" " Using this option the benchmark will expand the string __rand_int__\n" " inside an argument with a 12 digits number in the specified range\n" " from 0 to keyspacelen-1. The substitution changes every time a command\n" @@ -1733,6 +1734,21 @@ int main(int argc, const char **argv) { free(cmd); } + if (test_is_selected("zadd")) { + char *score = "0"; + if (config.randomkeys) score = "__rand_int__"; + len = redisFormatCommand(&cmd, + "ZADD myzset:{tag} %s element:__rand_int__",score); + benchmark("ZADD",cmd,len); + free(cmd); + } + + if (test_is_selected("zpopmin")) { + len = redisFormatCommand(&cmd,"ZPOPMIN myzset:{tag}"); + benchmark("ZPOPMIN",cmd,len); + free(cmd); + } + if (test_is_selected("lrange") || test_is_selected("lrange_100") || test_is_selected("lrange_300") || |