Randomize the random number generator's seed used in redis-benchmark (#8174)
The pid of the benchmark process is used to randomize the random number generator's seed. This ensures that when multiple benchmark processes are started at the same time to generate load on a server, they use different seeds. This will ensure randomness in the keys generated by different benchmark processes.
This commit is contained in:
parent
872a6c09e1
commit
3a47cd8d41
@ -1676,7 +1676,7 @@ int main(int argc, const char **argv) {
|
|||||||
|
|
||||||
client c;
|
client c;
|
||||||
|
|
||||||
srandom(time(NULL));
|
srandom(time(NULL) ^ getpid());
|
||||||
signal(SIGHUP, SIG_IGN);
|
signal(SIGHUP, SIG_IGN);
|
||||||
signal(SIGPIPE, SIG_IGN);
|
signal(SIGPIPE, SIG_IGN);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user