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

Clamp warmup time in seconds

parent 47f6dc73
Branches
Tags
No related merge requests found
...@@ -54,6 +54,8 @@ DEFINE_int32( ...@@ -54,6 +54,8 @@ DEFINE_int32(
DEFINE_int32( DEFINE_int32(
warmup_iterations, 100, warmup_iterations, 100,
"Number of megabytes to pump before collecting flow control stats"); "Number of megabytes to pump before collecting flow control stats");
DEFINE_int32(warmup_max_time_seconds, 10,
"Maximum number of seconds to run warmup loop");
namespace grpc { namespace grpc {
namespace testing { namespace testing {
...@@ -283,11 +285,17 @@ static void BM_PumpStreamServerToClient_Trickle(benchmark::State& state) { ...@@ -283,11 +285,17 @@ static void BM_PumpStreamServerToClient_Trickle(benchmark::State& state) {
} }
} }
}; };
gpr_timespec warmup_start = gpr_now(GPR_CLOCK_MONOTONIC);
for (int i = 0; for (int i = 0;
i < GPR_MAX(FLAGS_warmup_iterations, FLAGS_warmup_megabytes * 1024 * i < GPR_MAX(FLAGS_warmup_iterations, FLAGS_warmup_megabytes * 1024 *
1024 / (14 + state.range(0))); 1024 / (14 + state.range(0)));
i++) { i++) {
inner_loop(true); inner_loop(true);
if (gpr_time_cmp(gpr_time_sub(gpr_now(GPR_CLOCK_MONOTONIC), warmup_start),
gpr_time_from_seconds(FLAGS_warmup_max_time_seconds,
GPR_TIMESPAN)) > 0) {
break;
}
} }
while (state.KeepRunning()) { while (state.KeepRunning()) {
inner_loop(false); inner_loop(false);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment