File tree 16 files changed +78
-43
lines changed
16 files changed +78
-43
lines changed Original file line number Diff line number Diff line change @@ -164,6 +164,8 @@ option(WITH_NO_GETENV "Whether the platform supports environment variables" OFF)
164
164
165
165
option (BUILD_TESTING "Whether to enable tests" ON )
166
166
167
+ option (WITH_BENCHMARK "Whether to build benchmark program" ON )
168
+
167
169
option (BUILD_W3CTRACECONTEXT_TEST "Whether to build w3c trace context" OFF )
168
170
169
171
option (OTELCPP_MAINTAINER_MODE "Build in maintainer mode (-Wall -Werror)" OFF )
@@ -478,8 +480,10 @@ if(BUILD_TESTING)
478
480
message ("GTEST_INCLUDE_DIRS = ${GTEST_INCLUDE_DIRS} " )
479
481
message ("GTEST_BOTH_LIBRARIES = ${GTEST_BOTH_LIBRARIES} " )
480
482
enable_testing ()
481
- # Benchmark respects the CMAKE_PREFIX_PATH
482
- find_package (benchmark CONFIG REQUIRED)
483
+ if (WITH_BENCHMARK)
484
+ # Benchmark respects the CMAKE_PREFIX_PATH
485
+ find_package (benchmark CONFIG REQUIRED)
486
+ endif ()
483
487
endif ()
484
488
485
489
include (CMakePackageConfigHelpers)
Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ otel_cc_benchmark(
20
20
srcs = ["baggage_benchmark.cc" ],
21
21
tags = [
22
22
"api" ,
23
+ "benchmark" ,
23
24
"test" ,
24
25
],
25
26
deps = ["//api" ],
Original file line number Diff line number Diff line change @@ -9,7 +9,10 @@ foreach(testname baggage_test)
9
9
TEST_PREFIX baggage.
10
10
TEST_LIST ${testname} )
11
11
endforeach ()
12
- add_executable (baggage_benchmark baggage_benchmark.cc)
13
- target_link_libraries (baggage_benchmark benchmark::benchmark
14
- ${CMAKE_THREAD_LIBS_INIT} opentelemetry_api)
12
+
13
+ if (WITH_BENCHMARK)
14
+ add_executable (baggage_benchmark baggage_benchmark.cc)
15
+ target_link_libraries (baggage_benchmark benchmark::benchmark
16
+ ${CMAKE_THREAD_LIBS_INIT} opentelemetry_api)
17
+ endif ()
15
18
add_subdirectory (propagation)
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ otel_cc_benchmark(
5
5
srcs = ["spinlock_benchmark.cc" ],
6
6
tags = [
7
7
"api" ,
8
+ "benchmark" ,
8
9
"test" ,
9
10
],
10
11
deps = ["//api" ],
Original file line number Diff line number Diff line change @@ -10,6 +10,8 @@ foreach(testname kv_properties_test string_util_test)
10
10
TEST_LIST ${testname} )
11
11
endforeach ()
12
12
13
- add_executable (spinlock_benchmark spinlock_benchmark.cc)
14
- target_link_libraries (spinlock_benchmark benchmark::benchmark
15
- ${CMAKE_THREAD_LIBS_INIT} opentelemetry_api)
13
+ if (WITH_BENCHMARK)
14
+ add_executable (spinlock_benchmark spinlock_benchmark.cc)
15
+ target_link_libraries (spinlock_benchmark benchmark::benchmark
16
+ ${CMAKE_THREAD_LIBS_INIT} opentelemetry_api)
17
+ endif ()
Original file line number Diff line number Diff line change @@ -53,6 +53,7 @@ otel_cc_benchmark(
53
53
srcs = ["span_id_benchmark.cc" ],
54
54
tags = [
55
55
"api" ,
56
+ "benchmark" ,
56
57
"test" ,
57
58
"trace" ,
58
59
],
@@ -64,6 +65,7 @@ otel_cc_benchmark(
64
65
srcs = ["span_benchmark.cc" ],
65
66
tags = [
66
67
"api" ,
68
+ "benchmark" ,
67
69
"test" ,
68
70
"trace" ,
69
71
],
Original file line number Diff line number Diff line change @@ -21,9 +21,11 @@ foreach(
21
21
TEST_LIST api_${testname} )
22
22
endforeach ()
23
23
24
- add_executable (span_id_benchmark span_id_benchmark.cc)
25
- target_link_libraries (span_id_benchmark benchmark::benchmark
26
- ${CMAKE_THREAD_LIBS_INIT} opentelemetry_api)
27
- add_executable (span_benchmark span_benchmark.cc)
28
- target_link_libraries (span_benchmark benchmark::benchmark
29
- ${CMAKE_THREAD_LIBS_INIT} opentelemetry_api)
24
+ if (WITH_BENCHMARK)
25
+ add_executable (span_id_benchmark span_id_benchmark.cc)
26
+ target_link_libraries (span_id_benchmark benchmark::benchmark
27
+ ${CMAKE_THREAD_LIBS_INIT} opentelemetry_api)
28
+ add_executable (span_benchmark span_benchmark.cc)
29
+ target_link_libraries (span_benchmark benchmark::benchmark
30
+ ${CMAKE_THREAD_LIBS_INIT} opentelemetry_api)
31
+ endif ()
Original file line number Diff line number Diff line change @@ -32,8 +32,6 @@ if(BUILD_TESTING)
32
32
add_executable (etw_tracer_test test /etw_tracer_test.cc)
33
33
add_executable (etw_logger_test test /etw_logger_test.cc)
34
34
35
- add_executable (etw_perf_test test /etw_perf_test.cc)
36
-
37
35
target_link_libraries (etw_provider_test ${GTEST_BOTH_LIBRARIES}
38
36
opentelemetry_exporter_etw ${CMAKE_THREAD_LIBS_INIT} )
39
37
@@ -43,9 +41,12 @@ if(BUILD_TESTING)
43
41
target_link_libraries (etw_logger_test ${GTEST_BOTH_LIBRARIES}
44
42
opentelemetry_exporter_etw ${CMAKE_THREAD_LIBS_INIT} )
45
43
46
- target_link_libraries (
47
- etw_perf_test benchmark::benchmark ${GTEST_BOTH_LIBRARIES}
48
- opentelemetry_exporter_etw ${CMAKE_THREAD_LIBS_INIT} )
44
+ if (WITH_BENCHMARK)
45
+ add_executable (etw_perf_test test /etw_perf_test.cc)
46
+ target_link_libraries (
47
+ etw_perf_test benchmark::benchmark ${GTEST_BOTH_LIBRARIES}
48
+ opentelemetry_exporter_etw ${CMAKE_THREAD_LIBS_INIT} )
49
+ endif ()
49
50
50
51
gtest_add_tests(
51
52
TARGET etw_provider_test
Original file line number Diff line number Diff line change @@ -487,6 +487,7 @@ otel_cc_benchmark(
487
487
name = "otlp_grpc_exporter_benchmark" ,
488
488
srcs = ["test/otlp_grpc_exporter_benchmark.cc" ],
489
489
tags = [
490
+ "benchmark" ,
490
491
"otlp" ,
491
492
"otlp_grpc" ,
492
493
"test" ,
Original file line number Diff line number Diff line change @@ -27,7 +27,10 @@ cc_test(
27
27
otel_cc_benchmark (
28
28
name = "random_benchmark" ,
29
29
srcs = ["random_benchmark.cc" ],
30
- tags = ["test" ],
30
+ tags = [
31
+ "benchmark" ,
32
+ "test" ,
33
+ ],
31
34
deps = ["//sdk/src/common:random" ],
32
35
)
33
36
@@ -82,7 +85,10 @@ cc_library(
82
85
otel_cc_benchmark (
83
86
name = "circular_buffer_benchmark" ,
84
87
srcs = ["circular_buffer_benchmark.cc" ],
85
- tags = ["test" ],
88
+ tags = [
89
+ "benchmark" ,
90
+ "test" ,
91
+ ],
86
92
deps = [
87
93
":baseline_circular_buffer" ,
88
94
"//sdk:headers" ,
@@ -145,7 +151,10 @@ cc_test(
145
151
otel_cc_benchmark (
146
152
name = "attributemap_hash_benchmark" ,
147
153
srcs = ["attributemap_hash_benchmark.cc" ],
148
- tags = ["test" ],
154
+ tags = [
155
+ "benchmark" ,
156
+ "test" ,
157
+ ],
149
158
deps = [
150
159
"//api" ,
151
160
"//sdk:headers" ,
Original file line number Diff line number Diff line change @@ -24,14 +24,16 @@ add_executable(random_fork_test random_fork_test.cc)
24
24
target_link_libraries (random_fork_test opentelemetry_common)
25
25
add_test (random_fork_test random_fork_test)
26
26
27
- add_executable (random_benchmark random_benchmark.cc)
28
- target_link_libraries (random_benchmark benchmark::benchmark
29
- ${CMAKE_THREAD_LIBS_INIT} opentelemetry_common)
27
+ if (WITH_BENCHMARK)
28
+ add_executable (random_benchmark random_benchmark.cc)
29
+ target_link_libraries (random_benchmark benchmark::benchmark
30
+ ${CMAKE_THREAD_LIBS_INIT} opentelemetry_common)
30
31
31
- add_executable (circular_buffer_benchmark circular_buffer_benchmark.cc)
32
- target_link_libraries (circular_buffer_benchmark benchmark::benchmark
33
- ${CMAKE_THREAD_LIBS_INIT} opentelemetry_api)
32
+ add_executable (circular_buffer_benchmark circular_buffer_benchmark.cc)
33
+ target_link_libraries (circular_buffer_benchmark benchmark::benchmark
34
+ ${CMAKE_THREAD_LIBS_INIT} opentelemetry_api)
34
35
35
- add_executable (attributemap_hash_benchmark attributemap_hash_benchmark.cc)
36
- target_link_libraries (attributemap_hash_benchmark benchmark::benchmark
37
- ${CMAKE_THREAD_LIBS_INIT} opentelemetry_common)
36
+ add_executable (attributemap_hash_benchmark attributemap_hash_benchmark.cc)
37
+ target_link_libraries (attributemap_hash_benchmark benchmark::benchmark
38
+ ${CMAKE_THREAD_LIBS_INIT} opentelemetry_common)
39
+ endif ()
Original file line number Diff line number Diff line change 1
- load ("//bazel:otel_cc_benchmark.bzl" , "otel_cc_benchmark" )
2
-
3
1
cc_test (
4
2
name = "instrumentationscope_test" ,
5
3
srcs = [
Original file line number Diff line number Diff line change @@ -242,6 +242,7 @@ otel_cc_benchmark(
242
242
"attributes_processor_benchmark.cc" ,
243
243
],
244
244
tags = [
245
+ "benchmark" ,
245
246
"metrics" ,
246
247
"test" ,
247
248
],
@@ -256,6 +257,7 @@ otel_cc_benchmark(
256
257
"attributes_hashmap_benchmark.cc" ,
257
258
],
258
259
tags = [
260
+ "benchmark" ,
259
261
"metrics" ,
260
262
"test" ,
261
263
],
Original file line number Diff line number Diff line change @@ -28,12 +28,15 @@ foreach(
28
28
TEST_LIST ${testname} )
29
29
endforeach ()
30
30
31
- add_executable (attributes_processor_benchmark attributes_processor_benchmark.cc)
32
- target_link_libraries (attributes_processor_benchmark benchmark::benchmark
33
- ${CMAKE_THREAD_LIBS_INIT} opentelemetry_common)
31
+ if (WITH_BENCHMARK)
32
+ add_executable (attributes_processor_benchmark
33
+ attributes_processor_benchmark.cc)
34
+ target_link_libraries (attributes_processor_benchmark benchmark::benchmark
35
+ ${CMAKE_THREAD_LIBS_INIT} opentelemetry_common)
34
36
35
- add_executable (attributes_hashmap_benchmark attributes_hashmap_benchmark.cc)
36
- target_link_libraries (attributes_hashmap_benchmark benchmark::benchmark
37
- ${CMAKE_THREAD_LIBS_INIT} opentelemetry_common)
37
+ add_executable (attributes_hashmap_benchmark attributes_hashmap_benchmark.cc)
38
+ target_link_libraries (attributes_hashmap_benchmark benchmark::benchmark
39
+ ${CMAKE_THREAD_LIBS_INIT} opentelemetry_common)
40
+ endif ()
38
41
39
42
add_subdirectory (exemplar)
Original file line number Diff line number Diff line change @@ -144,6 +144,7 @@ otel_cc_benchmark(
144
144
name = "sampler_benchmark" ,
145
145
srcs = ["sampler_benchmark.cc" ],
146
146
tags = [
147
+ "benchmark" ,
147
148
"test" ,
148
149
"trace" ,
149
150
],
Original file line number Diff line number Diff line change @@ -24,7 +24,10 @@ foreach(
24
24
TEST_LIST ${testname} )
25
25
endforeach ()
26
26
27
- add_executable (sampler_benchmark sampler_benchmark.cc)
28
- target_link_libraries (
29
- sampler_benchmark benchmark::benchmark ${CMAKE_THREAD_LIBS_INIT}
30
- opentelemetry_trace opentelemetry_resources opentelemetry_exporter_in_memory)
27
+ if (WITH_BENCHMARK)
28
+ add_executable (sampler_benchmark sampler_benchmark.cc)
29
+ target_link_libraries (
30
+ sampler_benchmark benchmark::benchmark ${CMAKE_THREAD_LIBS_INIT}
31
+ opentelemetry_trace opentelemetry_resources
32
+ opentelemetry_exporter_in_memory)
33
+ endif ()
You can’t perform that action at this time.
0 commit comments