aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Craig Tiller <craig.tiller@gmail.com>2015-04-08 17:08:05 -0700
committerGravatar Craig Tiller <craig.tiller@gmail.com>2015-04-08 17:08:05 -0700
commitb9de09f2acd9f85a222a1cc410051832bcc7d91c (patch)
treeb6034caa48100c97e4576a0c491f5b0d50051b80
parentfb0edb86cdcabfcc4e07e6d6a08101b6dc7f5cef (diff)
Allow specifying warmup, benchmark times
-rw-r--r--test/cpp/qps/driver.cc8
-rw-r--r--test/cpp/qps/driver.h5
-rw-r--r--test/cpp/qps/qps_driver.cc8
3 files changed, 15 insertions, 6 deletions
diff --git a/test/cpp/qps/driver.cc b/test/cpp/qps/driver.cc
index 64a53496ae..f44883783d 100644
--- a/test/cpp/qps/driver.cc
+++ b/test/cpp/qps/driver.cc
@@ -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;
diff --git a/test/cpp/qps/driver.h b/test/cpp/qps/driver.h
index d87e80dc55..7a81b701c4 100644
--- a/test/cpp/qps/driver.h
+++ b/test/cpp/qps/driver.h
@@ -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
diff --git a/test/cpp/qps/qps_driver.cc b/test/cpp/qps/qps_driver.cc
index f7aa8e2aba..f42d538b16 100644
--- a/test/cpp/qps/qps_driver.cc
+++ b/test/cpp/qps/qps_driver.cc
@@ -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() /