Skip to content

Commit 6d02bb9

Browse files
feat: accept rename instrumentation to simulation
`instrumentation` is still accepted as an input, but it maps to simulation internally, as we plan to phase it out.
1 parent da312ec commit 6d02bb9

File tree

7 files changed

+31
-24
lines changed

7 files changed

+31
-24
lines changed

core/BUILD

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,8 @@ cc_library(
8181
defines = [
8282
"CODSPEED_VERSION=\\\"{}\\\"".format(CODSPEED_VERSION),
8383
] + select({
84-
":instrumentation_mode": ["CODSPEED_ENABLED", "CODSPEED_INSTRUMENTATION"],
84+
":instrumentation_mode": ["CODSPEED_ENABLED", "CODSPEED_SIMULATION"],
85+
":simulation_mode": ["CODSPEED_ENABLED", "CODSPEED_SIMULATION"],
8586
":walltime_mode": ["CODSPEED_ENABLED", "CODSPEED_WALLTIME"],
8687
"//conditions:default": [],
8788
}),
@@ -96,6 +97,7 @@ string_flag(
9697
values = [
9798
"off",
9899
"instrumentation",
100+
"simulation",
99101
"walltime",
100102
],
101103
visibility = ["//visibility:public"],
@@ -106,6 +108,11 @@ config_setting(
106108
flag_values = {":codspeed_mode": "instrumentation"},
107109
)
108110

111+
config_setting(
112+
name = "simulation_mode",
113+
flag_values = {":codspeed_mode": "simulation"},
114+
)
115+
109116
config_setting(
110117
name = "walltime_mode",
111118
flag_values = {":codspeed_mode": "walltime"},

core/CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ target_compile_definitions(
143143

144144
message(STATUS "Using codspeed root directory: ${CODSPEED_ROOT_DIR}")
145145

146-
set(CODSPEED_MODE_ALLOWED_VALUES "off" "instrumentation" "walltime")
146+
set(CODSPEED_MODE_ALLOWED_VALUES "off" "instrumentation" "simulation" "walltime")
147147
set(CODSPEED_MODE "off" CACHE STRING "Build mode for Codspeed")
148148
set_property(
149149
CACHE CODSPEED_MODE
@@ -166,10 +166,10 @@ if(NOT CODSPEED_MODE STREQUAL "off")
166166
endif()
167167

168168
# Define a preprocessor macro based on the build mode
169-
if(CODSPEED_MODE STREQUAL "instrumentation")
169+
if(CODSPEED_MODE STREQUAL "instrumentation" OR CODSPEED_MODE STREQUAL "simulation")
170170
target_compile_definitions(
171171
codspeed
172-
PUBLIC -DCODSPEED_INSTRUMENTATION
172+
PUBLIC -DCODSPEED_SIMULATION
173173
)
174174
elseif(CODSPEED_MODE STREQUAL "walltime")
175175
target_compile_definitions(codspeed PUBLIC -DCODSPEED_WALLTIME)

google_benchmark/include/benchmark/benchmark.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -946,7 +946,7 @@ class BENCHMARK_EXPORT BENCHMARK_INTERNAL_CACHELINE_ALIGNED State {
946946

947947
public:
948948
const IterationCount max_iterations;
949-
#if defined(CODSPEED_INSTRUMENTATION) || defined(CODSPEED_WALLTIME)
949+
#if defined(CODSPEED_SIMULATION) || defined(CODSPEED_WALLTIME)
950950
codspeed::CodSpeed* codspeed_;
951951
#endif
952952
#ifdef CODSPEED_WALLTIME
@@ -973,7 +973,7 @@ class BENCHMARK_EXPORT BENCHMARK_INTERNAL_CACHELINE_ALIGNED State {
973973
internal::ThreadTimer* timer, internal::ThreadManager* manager,
974974
internal::PerfCountersMeasurement* perf_counters_measurement,
975975
ProfilerManager* profiler_manager
976-
#if defined(CODSPEED_INSTRUMENTATION) || defined(CODSPEED_WALLTIME)
976+
#if defined(CODSPEED_SIMULATION) || defined(CODSPEED_WALLTIME)
977977
,
978978
codspeed::CodSpeed* codspeed = NULL
979979
#endif
@@ -1071,12 +1071,12 @@ struct State::StateIterator {
10711071
if (BENCHMARK_BUILTIN_EXPECT(cached_ != 0, true)) {
10721072
return true;
10731073
}
1074-
#ifdef CODSPEED_INSTRUMENTATION
1074+
#ifdef CODSPEED_SIMULATION
10751075
measurement_stop();
10761076
#endif
10771077
parent_->FinishKeepRunning();
10781078

1079-
#ifdef CODSPEED_INSTRUMENTATION
1079+
#ifdef CODSPEED_SIMULATION
10801080
if (parent_->codspeed_ != NULL) {
10811081
parent_->codspeed_->end_benchmark();
10821082
}
@@ -1093,14 +1093,14 @@ inline BENCHMARK_ALWAYS_INLINE State::StateIterator State::begin() {
10931093
return StateIterator(this);
10941094
}
10951095
inline BENCHMARK_ALWAYS_INLINE State::StateIterator State::end() {
1096-
#ifdef CODSPEED_INSTRUMENTATION
1096+
#ifdef CODSPEED_SIMULATION
10971097
if (this->codspeed_ != NULL) {
10981098
this->codspeed_->start_benchmark(name_);
10991099
}
11001100
#endif
1101-
1101+
11021102
StartKeepRunning();
1103-
#ifdef CODSPEED_INSTRUMENTATION
1103+
#ifdef CODSPEED_SIMULATION
11041104
measurement_start();
11051105
#endif
11061106
return StateIterator();

google_benchmark/src/benchmark.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -186,15 +186,15 @@ State::State(std::string name, IterationCount max_iters,
186186
internal::ThreadTimer* timer, internal::ThreadManager* manager,
187187
internal::PerfCountersMeasurement* perf_counters_measurement,
188188
ProfilerManager* profiler_manager
189-
#if defined(CODSPEED_INSTRUMENTATION) || defined(CODSPEED_WALLTIME)
189+
#if defined(CODSPEED_SIMULATION) || defined(CODSPEED_WALLTIME)
190190
,
191191
codspeed::CodSpeed* codspeed
192192
#endif
193193
)
194194
: total_iterations_(0),
195195
batch_leftover_(0),
196196
max_iterations(max_iters),
197-
#if defined(CODSPEED_INSTRUMENTATION) || defined(CODSPEED_WALLTIME)
197+
#if defined(CODSPEED_SIMULATION) || defined(CODSPEED_WALLTIME)
198198
codspeed_(codspeed),
199199
#endif
200200
#ifdef CODSPEED_WALLTIME
@@ -462,8 +462,8 @@ void RunBenchmarks(const std::vector<BenchmarkInstance>& benchmarks,
462462
#ifdef CODSPEED_ENABLED
463463
auto& Err = display_reporter->GetErrorStream();
464464
// Determine the width of the name field using a minimum width of 10.
465-
#ifdef CODSPEED_INSTRUMENTATION
466-
Err << "Codspeed mode: instrumentation" << "\n";
465+
#ifdef CODSPEED_SIMULATION
466+
Err << "Codspeed mode: simulation" << "\n";
467467
#elif defined(CODSPEED_WALLTIME)
468468
Err << "Codspeed mode: walltime" << "\n";
469469
#endif

google_benchmark/src/benchmark_api_internal.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@ BenchmarkInstance::BenchmarkInstance(Benchmark* benchmark, int family_idx,
9191
teardown_ = benchmark_.teardown_;
9292
}
9393

94-
#ifdef CODSPEED_INSTRUMENTATION
95-
State BenchmarkInstance::RunInstrumented(
94+
#ifdef CODSPEED_SIMULATION
95+
State BenchmarkInstance::RunSimulation(
9696
codspeed::CodSpeed* codspeed, internal::ThreadTimer* timer,
9797
internal::ThreadManager* manager,
9898
internal::PerfCountersMeasurement* perf_counters_measurement,

google_benchmark/src/benchmark_api_internal.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#include <vector>
1010

1111
#include "benchmark/benchmark.h"
12-
#ifdef CODSPEED_INSTRUMENTATION
12+
#ifdef CODSPEED_SIMULATION
1313
#include "codspeed.h"
1414
#endif
1515
#include "commandlineflags.h"
@@ -38,7 +38,7 @@ class BenchmarkInstance {
3838
BigOFunc* complexity_lambda() const { return complexity_lambda_; }
3939
const std::vector<Statistics>& statistics() const { return statistics_; }
4040
int repetitions() const {
41-
#ifdef CODSPEED_INSTRUMENTATION
41+
#ifdef CODSPEED_SIMULATION
4242
(void)repetitions_;
4343
return 1;
4444
#else
@@ -57,8 +57,8 @@ class BenchmarkInstance {
5757
internal::PerfCountersMeasurement* perf_counters_measurement,
5858
ProfilerManager* profiler_manager) const;
5959

60-
#ifdef CODSPEED_INSTRUMENTATION
61-
State RunInstrumented(
60+
#ifdef CODSPEED_SIMULATION
61+
State RunSimulation(
6262
codspeed::CodSpeed* codspeed, internal::ThreadTimer* timer,
6363
internal::ThreadManager* manager,
6464
internal::PerfCountersMeasurement* perf_counters_measurement,

google_benchmark/src/benchmark_runner.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -461,14 +461,14 @@ void BenchmarkRunner::RunProfilerManager(IterationCount profile_iterations) {
461461
}
462462

463463
void BenchmarkRunner::DoOneRepetition() {
464-
#ifdef CODSPEED_INSTRUMENTATION
464+
#ifdef CODSPEED_SIMULATION
465465
std::unique_ptr<internal::ThreadManager> manager;
466466
manager.reset(new internal::ThreadManager(b.threads()));
467467
internal::ThreadTimer timer = internal::ThreadTimer::Create();
468468
b.Setup();
469469
measurement_start();
470-
State st = b.RunInstrumented(codspeed::CodSpeed::getInstance(), &timer,
471-
manager.get(), nullptr, nullptr);
470+
State st = b.RunSimulation(codspeed::CodSpeed::getInstance(), &timer,
471+
manager.get(), nullptr, nullptr);
472472
measurement_stop();
473473
b.Teardown();
474474

0 commit comments

Comments
 (0)