Skip to content

Commit 7141b20

Browse files
committed
feat: define shared CODSPEED_MODE_DISPLAY
1 parent fd7b4db commit 7141b20

File tree

3 files changed

+6
-10
lines changed

3 files changed

+6
-10
lines changed

core/BUILD

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,10 @@ cc_library(
8181
defines = [
8282
"CODSPEED_VERSION=\\\"{}\\\"".format(CODSPEED_VERSION),
8383
] + select({
84-
":instrumentation_mode": ["CODSPEED_ENABLED", "CODSPEED_ANALYSIS"],
85-
":simulation_mode": ["CODSPEED_ENABLED", "CODSPEED_ANALYSIS"],
86-
":memory_mode": ["CODSPEED_ENABLED", "CODSPEED_ANALYSIS"],
87-
":walltime_mode": ["CODSPEED_ENABLED", "CODSPEED_WALLTIME"],
84+
":instrumentation_mode": ["CODSPEED_ENABLED", "CODSPEED_ANALYSIS", "CODSPEED_MODE_DISPLAY=\\\"instrumentation\\\""],
85+
":simulation_mode": ["CODSPEED_ENABLED", "CODSPEED_ANALYSIS", "CODSPEED_MODE_DISPLAY=\\\"simulation\\\""],
86+
":memory_mode": ["CODSPEED_ENABLED", "CODSPEED_ANALYSIS", "CODSPEED_MODE_DISPLAY=\\\"memory\\\""],
87+
":walltime_mode": ["CODSPEED_ENABLED", "CODSPEED_WALLTIME", "CODSPEED_MODE_DISPLAY=\\\"walltime\\\""],
8888
"//conditions:default": [],
8989
}),
9090
deps = [":instrument_hooks"],

core/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ set_property(
152152

153153
if(NOT CODSPEED_MODE STREQUAL "off")
154154
target_compile_definitions(codspeed PUBLIC -DCODSPEED_ENABLED)
155+
target_compile_definitions(codspeed PUBLIC -DCODSPEED_MODE_DISPLAY="${CODSPEED_MODE}")
155156

156157
if(NOT CMAKE_BUILD_TYPE)
157158
message(

google_benchmark/src/benchmark.cc

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -464,12 +464,7 @@ void RunBenchmarks(const std::vector<BenchmarkInstance>& benchmarks,
464464

465465
#ifdef CODSPEED_ENABLED
466466
auto& Err = display_reporter->GetErrorStream();
467-
// Determine the width of the name field using a minimum width of 10.
468-
#ifdef CODSPEED_ANALYSIS
469-
Err << "Codspeed mode: simulation" << "\n";
470-
#elif defined(CODSPEED_WALLTIME)
471-
Err << "Codspeed mode: walltime" << "\n";
472-
#endif
467+
Err << "Codspeed mode: " << CODSPEED_MODE_DISPLAY << "\n";
473468
#endif // CODSPEED_ENABLED
474469

475470
bool might_have_aggregates = FLAGS_benchmark_repetitions > 1;

0 commit comments

Comments
 (0)