1
- # Copyright (C) 2023 Intel Corporation
1
+ # Copyright (C) 2023-2024 Intel Corporation
2
2
# Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT.
3
3
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
4
4
5
+ include (FetchContent )
6
+ FetchContent_Declare (
7
+ googlebenchmark
8
+ GIT_REPOSITORY https://github.com/google/benchmark.git
9
+ GIT_TAG v1.9.0 )
10
+
11
+ set (BENCHMARK_ENABLE_GTEST_TESTS
12
+ OFF
13
+ CACHE BOOL "" FORCE )
14
+ set (BENCHMARK_ENABLE_TESTING
15
+ OFF
16
+ CACHE BOOL "" FORCE )
17
+ set (BENCHMARK_ENABLE_INSTALL
18
+ OFF
19
+ CACHE BOOL "" FORCE )
20
+ FetchContent_MakeAvailable (googlebenchmark )
21
+
5
22
# In MSVC builds, there is no way to determine the actual build type during the
6
23
# CMake configuration step. Therefore, this message is printed in all MSVC
7
24
# builds.
@@ -32,7 +49,7 @@ function(add_umf_benchmark)
32
49
"${multiValueArgs} "
33
50
${ARGN} )
34
51
35
- set (BENCH_NAME umf-bench- ${ARG_NAME} )
52
+ set (BENCH_NAME umf-${ARG_NAME} )
36
53
37
54
set (BENCH_LIBS ${ARG_LIBS} umf )
38
55
@@ -55,13 +72,17 @@ function(add_umf_benchmark)
55
72
COMMAND ${BENCH_NAME}
56
73
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} )
57
74
58
- # Benchmark passes if it prints "PASSED" in the output, because ubench of
59
- # scalable pool fails if the confidence interval exceeds maximum permitted
60
- # 2.5%.
61
- set_tests_properties (
62
- ${BENCH_NAME} PROPERTIES
63
- LABELS "benchmark"
64
- PASS_REGULAR_EXPRESSION "PASSED" )
75
+ if ("${BENCH_NAME} " STREQUAL "umf-ubench" )
76
+ # Benchmark passes if it prints "PASSED" in the output, because ubench
77
+ # of scalable pool fails if the confidence interval exceeds maximum
78
+ # permitted 2.5%.
79
+ set_tests_properties (
80
+ ${BENCH_NAME} PROPERTIES
81
+ LABELS "benchmark"
82
+ PASS_REGULAR_EXPRESSION "PASSED" )
83
+ else ()
84
+ set_tests_properties (${BENCH_NAME} PROPERTIES LABELS "benchmark" )
85
+ endif ()
65
86
66
87
if (WINDOWS )
67
88
# append PATH to DLLs
@@ -120,6 +141,12 @@ add_umf_benchmark(
120
141
LIBS ${LIBS_OPTIONAL}
121
142
LIBDIRS ${LIB_DIRS} )
122
143
144
+ add_umf_benchmark (
145
+ NAME benchmark
146
+ SRCS benchmark.cpp
147
+ LIBS ${LIBS_OPTIONAL} benchmark::benchmark
148
+ LIBDIRS ${LIB_DIRS} )
149
+
123
150
if (UMF_BUILD_BENCHMARKS_MT )
124
151
add_umf_benchmark (
125
152
NAME multithreaded
0 commit comments