Skip to content

Commit 4346cd9

Browse files
andreas-abelcopybara-github
authored andcommitted
Register proto benchmarks automatically.
PiperOrigin-RevId: 567663491 Change-Id: I4afffd88d84b86f5ba8938d20e60da53a8ab2667
1 parent e3ed735 commit 4346cd9

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

fleetbench/proto/benchmark.cc

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ void BM_Protogen_Arena(benchmark::State& state) {
3636
lifecycle.Run();
3737
}
3838
}
39-
BENCHMARK(BM_Protogen_Arena);
4039

4140
void BM_Protogen_NoArena(benchmark::State& state) {
4241
const int32_t kIterations = 10;
@@ -48,11 +47,16 @@ void BM_Protogen_NoArena(benchmark::State& state) {
4847
lifecycle.Run();
4948
}
5049
}
51-
BENCHMARK(BM_Protogen_NoArena);
50+
51+
void RegisterBenchmarks() {
52+
REGISTER_BENCHMARK(BM_Protogen_Arena);
53+
REGISTER_BENCHMARK(BM_Protogen_NoArena);
54+
}
5255

5356
class BenchmarkRegisterer {
5457
public:
5558
BenchmarkRegisterer() {
59+
DynamicRegistrar::Get()->AddCallback(RegisterBenchmarks);
5660
DynamicRegistrar::Get()->AddDefaultFilter("BM_Protogen_Arena");
5761
}
5862
};

0 commit comments

Comments
 (0)