This repository was archived by the owner on Jul 31, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 8 files changed +77
-7
lines changed
Expand file tree Collapse file tree 8 files changed +77
-7
lines changed Original file line number Diff line number Diff line change @@ -31,6 +31,11 @@ test_script:
3131
3232 & $_.FullName $cmdArgList
3333 }
34+ Get-ChildItem -Recurse -Path $env:APPVEYOR_BUILD_FOLDER -Filter "*_benchmark.exe" | ForEach-Object {
35+ Write-Output $_.FullName
36+
37+ & $_.FullName
38+ }
3439
3540on_finish :
3641- ps : |
Original file line number Diff line number Diff line change @@ -23,12 +23,17 @@ fetchcontent_declare(abseil
2323 GIT_REPOSITORY
2424 https://github.com/abseil/abseil-cpp
2525 GIT_TAG
26- master )
26+ 2c8421e1c6cef0da9e8a20b01c15256ec9ec116d )
2727fetchcontent_declare(prometheus
2828 GIT_REPOSITORY
2929 https://github.com/jupp0r/prometheus-cpp
3030 GIT_TAG
3131 master)
32+ fetchcontent_declare(benchmark
33+ GIT_REPOSITORY
34+ https://github.com/google/benchmark
35+ GIT_TAG
36+ master)
3237
3338fetchcontent_getproperties(googletest)
3439if (BUILD_TESTING)
@@ -72,3 +77,16 @@ if(NOT prometheus_POPULATED)
7277 add_subdirectory (${prometheus_SOURCE_DIR} ${prometheus_BINARY_DIR}
7378 EXCLUDE_FROM_ALL )
7479endif ()
80+
81+ fetchcontent_getproperties(benchmark)
82+ if (NOT benchmark_POPULATED)
83+ set (BENCHMARK_ENABLE_TESTING OFF
84+ CACHE BOOL "Enable testing of the benchmark library."
85+ FORCE)
86+ set (BENCHMARK_ENABLE_GTEST_TESTS OFF
87+ CACHE BOOL "Enable building the unit tests which depend on gtest"
88+ FORCE)
89+ fetchcontent_populate(benchmark)
90+ add_subdirectory (${benchmark_SOURCE_DIR} ${benchmark_BINARY_DIR}
91+ EXCLUDE_FROM_ALL )
92+ endif ()
Original file line number Diff line number Diff line change @@ -38,6 +38,19 @@ function(opencensus_test NAME SRC)
3838 endif ()
3939endfunction ()
4040
41+ # Helper function like bazel's cc_benchmark. Usage:
42+ #
43+ # opencensus_benchmark(trace_some_benchmark internal/some_benchmark.cc dep1
44+ # dep2...)
45+ function (opencensus_benchmark NAME SRC)
46+ if (BUILD_TESTING)
47+ set (_NAME "opencensus_${NAME} " )
48+ add_executable (${_NAME} ${SRC} )
49+ prepend_opencensus(DEPS "${ARGN} " )
50+ target_link_libraries (${_NAME} "${DEPS} " benchmark)
51+ endif ()
52+ endfunction ()
53+
4154# Helper function like bazel's cc_library. Libraries are namespaced as
4255# opencensus_* and public libraries are also aliased as opencensus-cpp::*.
4356function (opencensus_lib NAME )
Original file line number Diff line number Diff line change @@ -32,10 +32,10 @@ opencensus_lib(common_string_vector_hash)
3232
3333opencensus_test(common_random_test random_test.cc common_random)
3434
35+ opencensus_benchmark(common_random_benchmark random_benchmark.cc common_random)
36+
3537opencensus_test(common_stats_object_test
3638 stats_object_test.cc
3739 common_stats_object
3840 absl::strings
3941 absl::span)
40-
41- # TODO: random_benchmark
Original file line number Diff line number Diff line change @@ -31,4 +31,5 @@ opencensus_test(context_context_test
3131
3232opencensus_test(context_with_context_test internal /with_context_test.cc context)
3333
34- # TODO: context_benchmark
34+ opencensus_benchmark(context_context_benchmark internal /context_benchmark.cc
35+ context)
Original file line number Diff line number Diff line change @@ -116,4 +116,10 @@ opencensus_test(stats_view_data_impl_test
116116 stats_core
117117 absl::time)
118118
119- # TODO: benchmarks
119+ opencensus_benchmark(stats_stats_manager_benchmark
120+ internal /stats_manager_benchmark.cc
121+ stats_core
122+ stats_recording
123+ absl::memory
124+ absl::strings
125+ absl::time)
Original file line number Diff line number Diff line change @@ -57,4 +57,7 @@ opencensus_test(tags_with_tag_map_test
5757 tags_with_tag_map
5858 context)
5959
60- # TODO: benchmarks
60+ opencensus_benchmark(tags_tag_map_benchmark
61+ internal /tag_map_benchmark.cc
62+ tags
63+ absl::strings )
Original file line number Diff line number Diff line change @@ -190,4 +190,28 @@ opencensus_test(trace_with_span_test
190190 trace_with_span
191191 context)
192192
193- # TODO: benchmarks
193+ opencensus_benchmark(trace_attribute_value_ref_benchmark
194+ internal /attribute_value_ref_benchmark.cc trace)
195+
196+ opencensus_benchmark(trace_cloud_trace_context_benchmark
197+ internal /cloud_trace_context_benchmark.cc
198+ trace_cloud_trace_context)
199+
200+ opencensus_benchmark(trace_grpc_trace_bin_benchmark
201+ internal /grpc_trace_bin_benchmark.cc trace_grpc_trace_bin)
202+
203+ opencensus_benchmark(trace_span_benchmark
204+ internal /span_benchmark.cc
205+ trace_span_context
206+ trace)
207+
208+ opencensus_benchmark(trace_span_id_benchmark internal /span_id_benchmark.cc
209+ trace_span_context)
210+
211+ opencensus_benchmark(trace_context_benchmark internal /trace_context_benchmark.cc
212+ trace_trace_context)
213+
214+ opencensus_benchmark(trace_with_span_benchmark
215+ internal /with_span_benchmark.cc
216+ trace
217+ trace_with_span)
You can’t perform that action at this time.
0 commit comments