Skip to content
Snippets Groups Projects
Commit b9de09f2 authored by Craig Tiller's avatar Craig Tiller
Browse files

Allow specifying warmup, benchmark times

parent fb0edb86
No related branches found
No related tags found
No related merge requests found
......@@ -74,7 +74,9 @@ static vector<string> get_hosts(const string& name) {
ScenarioResult RunScenario(const ClientConfig& initial_client_config,
size_t num_clients,
const ServerConfig& server_config,
size_t num_servers) {
size_t num_servers,
int warmup_seconds,
int benchmark_seconds) {
// ClientContext allocator (all are destroyed at scope exit)
list<ClientContext> contexts;
auto alloc_context = [&contexts]() {
......@@ -146,7 +148,7 @@ ScenarioResult RunScenario(const ClientConfig& initial_client_config,
// Let everything warmup
gpr_log(GPR_INFO, "Warming up");
gpr_timespec start = gpr_now();
gpr_sleep_until(gpr_time_add(start, gpr_time_from_seconds(5)));
gpr_sleep_until(gpr_time_add(start, gpr_time_from_seconds(warmup_seconds)));
// Start a run
gpr_log(GPR_INFO, "Starting");
......@@ -171,7 +173,7 @@ ScenarioResult RunScenario(const ClientConfig& initial_client_config,
// Wait some time
gpr_log(GPR_INFO, "Running");
gpr_sleep_until(gpr_time_add(start, gpr_time_from_seconds(15)));
gpr_sleep_until(gpr_time_add(start, gpr_time_from_seconds(benchmark_seconds)));
// Finish a run
ScenarioResult result;
......
......@@ -54,7 +54,10 @@ struct ScenarioResult {
ScenarioResult RunScenario(const grpc::testing::ClientConfig& client_config,
size_t num_clients,
const grpc::testing::ServerConfig& server_config,
size_t num_servers);
size_t num_servers,
int warmup_seconds,
int benchmark_seconds);
} // namespace testing
} // namespace grpc
......
......@@ -40,6 +40,9 @@
DEFINE_int32(num_clients, 1, "Number of client binaries");
DEFINE_int32(num_servers, 1, "Number of server binaries");
DEFINE_int32(warmup_seconds, 5, "Warmup time (in seconds)");
DEFINE_int32(benchmark_seconds, 30, "Benchmark time (in seconds)");
// Common config
DEFINE_bool(enable_ssl, false, "Use SSL");
DEFINE_string(rpc_type, "UNARY", "Type of RPC: UNARY or STREAMING");
......@@ -98,8 +101,9 @@ int main(int argc, char** argv) {
server_config.set_threads(FLAGS_server_threads);
server_config.set_enable_ssl(FLAGS_enable_ssl);
auto result = RunScenario(client_config, FLAGS_num_clients, server_config,
FLAGS_num_servers);
auto result = RunScenario(client_config, FLAGS_num_clients,
server_config, FLAGS_num_servers,
FLAGS_warmup_seconds, FLAGS_benchmark_seconds);
gpr_log(GPR_INFO, "QPS: %.1f",
result.latencies.Count() /
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment