Skip to content

Commit 8271fbd

Browse files
--wip-- [skip ci]
1 parent 27168f4 commit 8271fbd

File tree

3 files changed

+18
-10
lines changed

3 files changed

+18
-10
lines changed

core/src/codspeed.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ std::string join(const std::vector<std::string> &elements,
1818

1919
CodSpeed::CodSpeed() : is_instrumented(measurement_is_instrumented()) {
2020
if (!is_instrumented) {
21-
std::cout
21+
std::cerr
2222
<< "NOTICE: codspeed is enabled, but no performance measurement will "
2323
"be made since it's running in an unknown environment."
2424
<< std::endl;
@@ -48,6 +48,6 @@ void CodSpeed::end_benchmark() {
4848
std::string action_str = is_instrumented ? "Measured" : "Checked";
4949
std::string group_str =
5050
group_stack.empty() ? "" : " (group: " + join(group_stack, "/") + ")";
51-
std::cout << action_str << ": " << current_benchmark << group_str
51+
std::cerr << action_str << ": " << current_benchmark << group_str
5252
<< std::endl;
5353
}

flake.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
buildInputs =
3939
with pkgs;
4040
[
41-
cmake-language-server
41+
gersemi
4242
clang-tools
4343
]
4444
++ commonBuildInputs;

google_benchmark/cmake/Codspeed.cmake

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,19 @@ execute_process(
44
COMMAND git rev-parse --show-toplevel
55
OUTPUT_VARIABLE GIT_ROOT_DIR
66
OUTPUT_STRIP_TRAILING_WHITESPACE
7+
RESULT_VARIABLE GIT_COMMAND_RESULT
78
)
89

10+
if(NOT GIT_COMMAND_RESULT EQUAL 0)
11+
message(
12+
WARNING
13+
"Failed to determine the git root directory.\
14+
Check that git is in your PATH, and that you are in a git repository.\
15+
Continuing, but Codspeed features will not be useable"
16+
)
17+
set(GIT_ROOT_DIR ${CMAKE_SOURCE_DIR})
18+
endif()
19+
920
target_compile_definitions(
1021
codspeed
1122
INTERFACE -DCODSPEED_GIT_ROOT_DIR="${GIT_ROOT_DIR}"
@@ -21,14 +32,11 @@ if(DEFINED CODSPEED_MODE)
2132
elseif(CODSPEED_MODE STREQUAL "walltime")
2233
target_compile_definitions(codspeed INTERFACE -DCODSPEED_WALLTIME)
2334
else()
24-
# Step 3: Default to "instrumentation" if no value is provided
25-
set(CODSPEED_MODE "instrumentation")
26-
endif()
27-
endif()
2835
message(
2936
FATAL_ERROR
3037
"Invalid build mode: ${CODSPEED_MODE}. Use 'instrumentation' or 'walltime'."
3138
)
32-
if(CODSPEED_MODE STREQUAL "instrumentation")
33-
target_compile_definitions(codspeed INTERFACE -DCODSPEED_INSTRUMENTATION)
34-
elseif(CODSPEED_MODE STREQUAL "walltime")
39+
endif()
40+
endif()
41+
42+
message(STATUS "Build mode set to: ${CODSPEED_MODE}")

0 commit comments

Comments
 (0)