From 334c2d9c67da7aade6c4756d9c751c5727bbe904 Mon Sep 17 00:00:00 2001 From: Anjan Roy Date: Sun, 29 Sep 2024 12:17:02 +0400 Subject: [PATCH] Hardcode which time unit to use for reporting benchmark results Signed-off-by: Anjan Roy --- Makefile | 4 ++-- benches/bench_client_prepare_query.cpp | 15 ++++++++++----- benches/bench_client_process_response.cpp | 15 ++++++++++----- benches/bench_client_query.cpp | 15 ++++++++++----- benches/bench_server_respond.cpp | 15 ++++++++++----- benches/bench_server_setup.cpp | 15 ++++++++++----- 6 files changed, 52 insertions(+), 27 deletions(-) diff --git a/Makefile b/Makefile index 7e096ec..3f6d0d5 100644 --- a/Makefile +++ b/Makefile @@ -133,14 +133,14 @@ $(BENCHMARK_BINARY): $(BENCHMARK_OBJECTS) benchmark: $(BENCHMARK_BINARY) # Must *not* build google-benchmark with libPFM - ./$< --benchmark_time_unit=ms --benchmark_min_warmup_time=.5 --benchmark_enable_random_interleaving=true --benchmark_repetitions=10 --benchmark_min_time=0.1s --benchmark_display_aggregates_only=true --benchmark_report_aggregates_only=true --benchmark_counters_tabular=true --benchmark_out_format=json --benchmark_out=$(BENCHMARK_OUT_FILE) + ./$< --benchmark_min_warmup_time=.5 --benchmark_enable_random_interleaving=true --benchmark_repetitions=10 --benchmark_min_time=0.1s --benchmark_display_aggregates_only=true --benchmark_report_aggregates_only=true --benchmark_counters_tabular=true --benchmark_out_format=json --benchmark_out=$(BENCHMARK_OUT_FILE) $(PERF_BINARY): $(BENCHMARK_OBJECTS) $(CXX) $(RELEASE_FLAGS) $(LINK_OPT_FLAGS) $^ $(PERF_LINK_FLAGS) -o $@ perf: $(PERF_BINARY) # Must build google-benchmark with libPFM, follow https://gist.github.com/itzmeanjan/05dc3e946f635d00c5e0b21aae6203a7 - ./$< --benchmark_time_unit=ms --benchmark_min_warmup_time=.5 --benchmark_enable_random_interleaving=true --benchmark_repetitions=10 --benchmark_min_time=0.1s --benchmark_display_aggregates_only=true --benchmark_report_aggregates_only=true --benchmark_counters_tabular=true --benchmark_perf_counters=CYCLES --benchmark_out_format=json --benchmark_out=$(BENCHMARK_OUT_FILE) + ./$< --benchmark_min_warmup_time=.5 --benchmark_enable_random_interleaving=true --benchmark_repetitions=10 --benchmark_min_time=0.1s --benchmark_display_aggregates_only=true --benchmark_report_aggregates_only=true --benchmark_counters_tabular=true --benchmark_perf_counters=CYCLES --benchmark_out_format=json --benchmark_out=$(BENCHMARK_OUT_FILE) .PHONY: format clean diff --git a/benches/bench_client_prepare_query.cpp b/benches/bench_client_prepare_query.cpp index 9b8e5d1..56a33bd 100644 --- a/benches/bench_client_prepare_query.cpp +++ b/benches/bench_client_prepare_query.cpp @@ -82,32 +82,37 @@ BENCHMARK(bench_client_prepare_query<128, 1ul << 16, 256, 10, 1774>) ->ComputeStatistics("min", compute_min) ->ComputeStatistics("max", compute_max) ->MeasureProcessCPUTime() - ->UseRealTime(); + ->UseRealTime() + ->Unit(benchmark::kMillisecond); BENCHMARK(bench_client_prepare_query<128, 1ul << 17, 256, 10, 1774>) ->Name("frodoPIR/client_prepare_query/2^17/256B") ->ComputeStatistics("min", compute_min) ->ComputeStatistics("max", compute_max) ->MeasureProcessCPUTime() - ->UseRealTime(); + ->UseRealTime() + ->Unit(benchmark::kMillisecond); BENCHMARK(bench_client_prepare_query<128, 1ul << 18, 256, 10, 1774>) ->Name("frodoPIR/client_prepare_query/2^18/256B") ->ComputeStatistics("min", compute_min) ->ComputeStatistics("max", compute_max) ->MeasureProcessCPUTime() - ->UseRealTime(); + ->UseRealTime() + ->Unit(benchmark::kMillisecond); BENCHMARK(bench_client_prepare_query<128, 1ul << 19, 256, 9, 1774>) ->Name("frodoPIR/client_prepare_query/2^19/256B") ->ComputeStatistics("min", compute_min) ->ComputeStatistics("max", compute_max) ->MeasureProcessCPUTime() - ->UseRealTime(); + ->UseRealTime() + ->Unit(benchmark::kMillisecond); BENCHMARK(bench_client_prepare_query<128, 1ul << 20, 256, 9, 1774>) ->Name("frodoPIR/client_prepare_query/2^20/256B") ->ComputeStatistics("min", compute_min) ->ComputeStatistics("max", compute_max) ->MeasureProcessCPUTime() - ->UseRealTime(); + ->UseRealTime() + ->Unit(benchmark::kMillisecond); diff --git a/benches/bench_client_process_response.cpp b/benches/bench_client_process_response.cpp index d243867..bce4444 100644 --- a/benches/bench_client_process_response.cpp +++ b/benches/bench_client_process_response.cpp @@ -84,32 +84,37 @@ BENCHMARK(bench_client_process_response<128, 1ul << 16, 256, 10, 1774>) ->ComputeStatistics("min", compute_min) ->ComputeStatistics("max", compute_max) ->MeasureProcessCPUTime() - ->UseRealTime(); + ->UseRealTime() + ->Unit(benchmark::kMicrosecond); BENCHMARK(bench_client_process_response<128, 1ul << 17, 256, 10, 1774>) ->Name("frodoPIR/client_process_response/2^17/256B") ->ComputeStatistics("min", compute_min) ->ComputeStatistics("max", compute_max) ->MeasureProcessCPUTime() - ->UseRealTime(); + ->UseRealTime() + ->Unit(benchmark::kMicrosecond); BENCHMARK(bench_client_process_response<128, 1ul << 18, 256, 10, 1774>) ->Name("frodoPIR/client_process_response/2^18/256B") ->ComputeStatistics("min", compute_min) ->ComputeStatistics("max", compute_max) ->MeasureProcessCPUTime() - ->UseRealTime(); + ->UseRealTime() + ->Unit(benchmark::kMicrosecond); BENCHMARK(bench_client_process_response<128, 1ul << 19, 256, 9, 1774>) ->Name("frodoPIR/client_process_response/2^19/256B") ->ComputeStatistics("min", compute_min) ->ComputeStatistics("max", compute_max) ->MeasureProcessCPUTime() - ->UseRealTime(); + ->UseRealTime() + ->Unit(benchmark::kMicrosecond); BENCHMARK(bench_client_process_response<128, 1ul << 20, 256, 9, 1774>) ->Name("frodoPIR/client_process_response/2^20/256B") ->ComputeStatistics("min", compute_min) ->ComputeStatistics("max", compute_max) ->MeasureProcessCPUTime() - ->UseRealTime(); + ->UseRealTime() + ->Unit(benchmark::kMicrosecond); diff --git a/benches/bench_client_query.cpp b/benches/bench_client_query.cpp index 64ddb93..bc15b23 100644 --- a/benches/bench_client_query.cpp +++ b/benches/bench_client_query.cpp @@ -83,32 +83,37 @@ BENCHMARK(bench_client_query<128, 1ul << 16, 256, 10, 1774>) ->ComputeStatistics("min", compute_min) ->ComputeStatistics("max", compute_max) ->MeasureProcessCPUTime() - ->UseRealTime(); + ->UseRealTime() + ->Unit(benchmark::kMicrosecond); BENCHMARK(bench_client_query<128, 1ul << 17, 256, 10, 1774>) ->Name("frodoPIR/client_query/2^17/256B") ->ComputeStatistics("min", compute_min) ->ComputeStatistics("max", compute_max) ->MeasureProcessCPUTime() - ->UseRealTime(); + ->UseRealTime() + ->Unit(benchmark::kMicrosecond); BENCHMARK(bench_client_query<128, 1ul << 18, 256, 10, 1774>) ->Name("frodoPIR/client_query/2^18/256B") ->ComputeStatistics("min", compute_min) ->ComputeStatistics("max", compute_max) ->MeasureProcessCPUTime() - ->UseRealTime(); + ->UseRealTime() + ->Unit(benchmark::kMicrosecond); BENCHMARK(bench_client_query<128, 1ul << 19, 256, 9, 1774>) ->Name("frodoPIR/client_query/2^19/256B") ->ComputeStatistics("min", compute_min) ->ComputeStatistics("max", compute_max) ->MeasureProcessCPUTime() - ->UseRealTime(); + ->UseRealTime() + ->Unit(benchmark::kMicrosecond); BENCHMARK(bench_client_query<128, 1ul << 20, 256, 9, 1774>) ->Name("frodoPIR/client_query/2^20/256B") ->ComputeStatistics("min", compute_min) ->ComputeStatistics("max", compute_max) ->MeasureProcessCPUTime() - ->UseRealTime(); + ->UseRealTime() + ->Unit(benchmark::kMicrosecond); diff --git a/benches/bench_server_respond.cpp b/benches/bench_server_respond.cpp index d0d052f..6bd20d0 100644 --- a/benches/bench_server_respond.cpp +++ b/benches/bench_server_respond.cpp @@ -68,32 +68,37 @@ BENCHMARK(bench_server_respond<128, 1ul << 16, 256, 10, 1774>) ->ComputeStatistics("min", compute_min) ->ComputeStatistics("max", compute_max) ->MeasureProcessCPUTime() - ->UseRealTime(); + ->UseRealTime() + ->Unit(benchmark::kMillisecond); BENCHMARK(bench_server_respond<128, 1ul << 17, 256, 10, 1774>) ->Name("frodoPIR/server_respond/2^17/256B") ->ComputeStatistics("min", compute_min) ->ComputeStatistics("max", compute_max) ->MeasureProcessCPUTime() - ->UseRealTime(); + ->UseRealTime() + ->Unit(benchmark::kMillisecond); BENCHMARK(bench_server_respond<128, 1ul << 18, 256, 10, 1774>) ->Name("frodoPIR/server_respond/2^18/256B") ->ComputeStatistics("min", compute_min) ->ComputeStatistics("max", compute_max) ->MeasureProcessCPUTime() - ->UseRealTime(); + ->UseRealTime() + ->Unit(benchmark::kMillisecond); BENCHMARK(bench_server_respond<128, 1ul << 19, 256, 9, 1774>) ->Name("frodoPIR/server_respond/2^19/256B") ->ComputeStatistics("min", compute_min) ->ComputeStatistics("max", compute_max) ->MeasureProcessCPUTime() - ->UseRealTime(); + ->UseRealTime() + ->Unit(benchmark::kMillisecond); BENCHMARK(bench_server_respond<128, 1ul << 20, 256, 9, 1774>) ->Name("frodoPIR/server_respond/2^20/256B") ->ComputeStatistics("min", compute_min) ->ComputeStatistics("max", compute_max) ->MeasureProcessCPUTime() - ->UseRealTime(); + ->UseRealTime() + ->Unit(benchmark::kMillisecond); diff --git a/benches/bench_server_setup.cpp b/benches/bench_server_setup.cpp index 87cfd2a..0946430 100644 --- a/benches/bench_server_setup.cpp +++ b/benches/bench_server_setup.cpp @@ -37,32 +37,37 @@ BENCHMARK(bench_server_setup<128, 1ul << 16, 256, 10, 1774>) ->ComputeStatistics("min", compute_min) ->ComputeStatistics("max", compute_max) ->MeasureProcessCPUTime() - ->UseRealTime(); + ->UseRealTime() + ->Unit(benchmark::kSecond); BENCHMARK(bench_server_setup<128, 1ul << 17, 256, 10, 1774>) ->Name("frodoPIR/server_setup/2^17/256B") ->ComputeStatistics("min", compute_min) ->ComputeStatistics("max", compute_max) ->MeasureProcessCPUTime() - ->UseRealTime(); + ->UseRealTime() + ->Unit(benchmark::kSecond); BENCHMARK(bench_server_setup<128, 1ul << 18, 256, 10, 1774>) ->Name("frodoPIR/server_setup/2^18/256B") ->ComputeStatistics("min", compute_min) ->ComputeStatistics("max", compute_max) ->MeasureProcessCPUTime() - ->UseRealTime(); + ->UseRealTime() + ->Unit(benchmark::kSecond); BENCHMARK(bench_server_setup<128, 1ul << 19, 256, 9, 1774>) ->Name("frodoPIR/server_setup/2^19/256B") ->ComputeStatistics("min", compute_min) ->ComputeStatistics("max", compute_max) ->MeasureProcessCPUTime() - ->UseRealTime(); + ->UseRealTime() + ->Unit(benchmark::kSecond); BENCHMARK(bench_server_setup<128, 1ul << 20, 256, 9, 1774>) ->Name("frodoPIR/server_setup/2^20/256B") ->ComputeStatistics("min", compute_min) ->ComputeStatistics("max", compute_max) ->MeasureProcessCPUTime() - ->UseRealTime(); + ->UseRealTime() + ->Unit(benchmark::kSecond);