MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / benchmark

Function benchmark

src/redis-benchmark.cpp:994–1034  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

992}
993
994static void benchmark(const char *title, const char *cmd, int len) {
995 client c;
996
997 config.title = title;
998 config.requests_issued = 0;
999 config.requests_finished = 0;
1000 config.previous_requests_finished = 0;
1001 config.last_printed_bytes = 0;
1002 hdr_init(
1003 CONFIG_LATENCY_HISTOGRAM_MIN_VALUE, // Minimum value
1004 CONFIG_LATENCY_HISTOGRAM_MAX_VALUE, // Maximum value
1005 config.precision, // Number of significant figures
1006 &config.latency_histogram); // Pointer to initialise
1007 hdr_init(
1008 CONFIG_LATENCY_HISTOGRAM_MIN_VALUE, // Minimum value
1009 CONFIG_LATENCY_HISTOGRAM_INSTANT_MAX_VALUE, // Maximum value
1010 config.precision, // Number of significant figures
1011 &config.current_sec_latency_histogram); // Pointer to initialise
1012
1013 if (config.num_threads) initBenchmarkThreads();
1014
1015 int thread_id = config.num_threads > 0 ? 0 : -1;
1016 c = createClient(cmd,len,NULL,thread_id);
1017 createMissingClients(c);
1018
1019 config.start = mstime();
1020 if (!config.num_threads) {
1021 aeThreadOnline();
1022 aeMain(config.el);
1023 aeThreadOffline();
1024 }
1025 else startBenchmarkThreads();
1026 config.totlatency = mstime()-config.start;
1027
1028 showLatencyReport();
1029 freeAllClients();
1030 if (config.threads) freeBenchmarkThreads();
1031 if (config.current_sec_latency_histogram) hdr_close(config.current_sec_latency_histogram);
1032 if (config.latency_histogram) hdr_close(config.latency_histogram);
1033
1034}
1035
1036/* Thread functions. */
1037

Callers 1

mainFunction · 0.85

Calls 13

hdr_initFunction · 0.85
createMissingClientsFunction · 0.85
aeThreadOnlineFunction · 0.85
aeMainFunction · 0.85
aeThreadOfflineFunction · 0.85
startBenchmarkThreadsFunction · 0.85
showLatencyReportFunction · 0.85
hdr_closeFunction · 0.85
initBenchmarkThreadsFunction · 0.70
createClientFunction · 0.70
mstimeFunction · 0.70
freeAllClientsFunction · 0.70

Tested by

no test coverage detected