mirror of
https://github.com/abseil/abseil-cpp.git
synced 2026-06-04 12:07:05 +08:00
Report 1ns instead of 0ns for probe_benchmarks. Some tools incorrectly assume that benchmark was not run if 0ns reported.
PiperOrigin-RevId: 852831533 Change-Id: Ibf2e60dcb308928358ddf80dc4d2f7eda8a78530
This commit is contained in:
committed by
Copybara-Service
parent
7599e36e7c
commit
6bd8e2b51a
@@ -556,9 +556,11 @@ int main(int argc, char** argv) {
|
||||
// Check the regex again. We might had have enabled only one of the
|
||||
// stats for the benchmark.
|
||||
if (!CanRunBenchmark(name)) return;
|
||||
// Report at least 1, because benchy drops results with zero.
|
||||
double reported_value = std::max(1e9 * result.ratios.*val, 1.0);
|
||||
absl::PrintF(" %s{\n", comma);
|
||||
absl::PrintF(" \"cpu_time\": %f,\n", 1e9 * result.ratios.*val);
|
||||
absl::PrintF(" \"real_time\": %f,\n", 1e9 * result.ratios.*val);
|
||||
absl::PrintF(" \"cpu_time\": %f,\n", reported_value);
|
||||
absl::PrintF(" \"real_time\": %f,\n", reported_value);
|
||||
absl::PrintF(" \"iterations\": 1,\n");
|
||||
absl::PrintF(" \"name\": \"%s\",\n", name);
|
||||
absl::PrintF(" \"time_unit\": \"ns\"\n");
|
||||
|
||||
Reference in New Issue
Block a user