added config option for time to spin up new client threads (diagnostic tool)
Former-commit-id: 3d0f729572b175457d4874b6e381754ac47e9055
This commit is contained in:
parent
e6900c37c1
commit
6ca00c68f4
@ -76,6 +76,7 @@ static struct config {
|
||||
const char *hostsocket;
|
||||
int numclients;
|
||||
int liveclients;
|
||||
int period_ms;
|
||||
int requests;
|
||||
int requests_issued;
|
||||
int requests_finished;
|
||||
@ -662,6 +663,7 @@ void initConfigDefaults() {
|
||||
config.keepalive = 1;
|
||||
config.datasize = 3;
|
||||
config.pipeline = 1;
|
||||
config.period_ms = 5000;
|
||||
config.showerrors = 0;
|
||||
config.randomkeys = 0;
|
||||
config.randomkeys_keyspacelen = 0;
|
||||
@ -708,6 +710,9 @@ int parseOptions(int argc, const char **argv) {
|
||||
} else if (!strcmp(argv[i],"-k")) {
|
||||
if (lastarg) goto invalid;
|
||||
config.keepalive = atoi(argv[++i]);
|
||||
} else if (!strcmp(argv[i],"--ms")) {
|
||||
if (lastarg) goto invalid;
|
||||
config.period_ms = atoi(argv[++i]);
|
||||
} else if (!strcmp(argv[i],"-h")) {
|
||||
if (lastarg) goto invalid;
|
||||
config.hostip = strdup(argv[++i]);
|
||||
@ -808,6 +813,7 @@ usage:
|
||||
" -h <hostname> Server hostname (default 127.0.0.1)\n"
|
||||
" -p <port> Server port (default 6379)\n"
|
||||
" -s <socket> Server socket (overrides host and port)\n"
|
||||
" --ms <milliseconds> Time between spinning up new client threads\n"
|
||||
" -a <password> Password for Redis Auth\n"
|
||||
" --user <username> Used to send ACL style 'AUTH username pass'. Needs -a.\n"
|
||||
" -c <clients> Number of parallel connections (default 50)\n"
|
||||
@ -941,7 +947,6 @@ int main(int argc, const char **argv) {
|
||||
|
||||
const char *set_value = "abcdefghijklmnopqrstuvwxyz";
|
||||
int self_threads = 0;
|
||||
unsigned int period = 5;
|
||||
char command[63];
|
||||
|
||||
initBenchmarkThreads();
|
||||
@ -983,12 +988,12 @@ int main(int argc, const char **argv) {
|
||||
}
|
||||
self_threads++;
|
||||
|
||||
sleep(period);
|
||||
usleep(config.period_ms * 1000);
|
||||
|
||||
server_cpu_time = getServerCpuTime(ctx);
|
||||
self_cpu_time = getSelfCpuTime(&self_ru);
|
||||
server_cpu_load = (server_cpu_time - last_server_cpu_time) * 100 / period;
|
||||
self_cpu_load = (self_cpu_time - last_self_cpu_time) * 100 / period;
|
||||
server_cpu_load = (server_cpu_time - last_server_cpu_time) * 100000 / config.period_ms;
|
||||
self_cpu_load = (self_cpu_time - last_self_cpu_time) * 100000 / config.period_ms;
|
||||
if (server_cpu_time < 0) {
|
||||
break;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user