Make the benchmark timeout a floating point, not integer, flag. Allows running benchmarks at very low times like 0.02 seconds. Useful for making graphs like https://screenshot.googleplex.com/87RUcHaF7Sqmwij (internal) where exact values aren't super important but quick results are nice. Change-Id: Ia45f0299b392c5cae4258c88cd9ae2f2cc63070f Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/85067 Auto-Submit: Rudolf Polzer <rpolzer@google.com> Reviewed-by: Adam Langley <agl@google.com> Commit-Queue: Adam Langley <agl@google.com>
diff --git a/tool/speed.cc b/tool/speed.cc index ddbfa85..1a6f3c7 100644 --- a/tool/speed.cc +++ b/tool/speed.cc
@@ -191,7 +191,7 @@ uint64_t (*time_now)() = time_now_realtime; -static uint64_t g_timeout_seconds = 1; +static double g_timeout_seconds = 1; static std::vector<size_t> g_chunk_lengths = {16, 256, 1350, 8192, 16384}; // IterationsBetweenTimeChecks returns the number of iterations of |func| to run @@ -1905,7 +1905,7 @@ } if (args_map.count("-timeout") != 0) { - g_timeout_seconds = atoi(args_map["-timeout"].c_str()); + g_timeout_seconds = atof(args_map["-timeout"].c_str()); } #if defined(OPENSSL_TIME_NOW_CPUTIME)