[libcxx] Add support for benchmark tests using Google Benchmark.
Summary:
This patch does the following:
1. Checks in a copy of the Google Benchmark library into the libc++ repo under `utils/google-benchmark`.
2. Teaches libc++ how to build Google Benchmark against both (A) in-tree libc++ and (B) the platforms native STL.
3. Allows performance benchmarks to be built as part of the libc++ build.
Building the benchmarks (and Google Benchmark) is off by default. It must be enabled using the CMake option `-DLIBCXX_INCLUDE_BENCHMARKS=ON`. When this option is enabled the tests under `libcxx/benchmarks` can be built using the `libcxx-benchmarks` target.
On Linux platforms where libstdc++ is the default STL the CMake option `-DLIBCXX_BUILD_BENCHMARKS_NATIVE_STDLIB=ON` can be used to build each benchmark test against libstdc++ as well. This is useful for comparing performance between standard libraries.
Support for benchmarks is currently very minimal. They must be manually run by the user and there is no mechanism for detecting performance regressions.
Known Issues:
* `-DLIBCXX_INCLUDE_BENCHMARKS=ON` is only supported for Clang, and not GCC, since the `-stdlib=libc++` option is needed to build Google Benchmark.
Reviewers: danalbert, dberlin, chandlerc, mclow.lists, jroelofs
Subscribers: chandlerc, dberlin, tberghammer, danalbert, srhines, hfinkel
Differential Revision: https://reviews.llvm.org/D22240
llvm-svn: 276049
2016-07-20 07:07:03 +08:00
|
|
|
include(ExternalProject)
|
|
|
|
include(CheckCXXCompilerFlag)
|
|
|
|
|
|
|
|
#==============================================================================
|
|
|
|
# Build Google Benchmark for libc++
|
|
|
|
#==============================================================================
|
|
|
|
|
|
|
|
set(BENCHMARK_LIBCXX_COMPILE_FLAGS
|
|
|
|
-Wno-unused-command-line-argument
|
|
|
|
-nostdinc++
|
2016-08-30 03:50:49 +08:00
|
|
|
-isystem ${LIBCXX_SOURCE_DIR}/include
|
[libcxx] Add support for benchmark tests using Google Benchmark.
Summary:
This patch does the following:
1. Checks in a copy of the Google Benchmark library into the libc++ repo under `utils/google-benchmark`.
2. Teaches libc++ how to build Google Benchmark against both (A) in-tree libc++ and (B) the platforms native STL.
3. Allows performance benchmarks to be built as part of the libc++ build.
Building the benchmarks (and Google Benchmark) is off by default. It must be enabled using the CMake option `-DLIBCXX_INCLUDE_BENCHMARKS=ON`. When this option is enabled the tests under `libcxx/benchmarks` can be built using the `libcxx-benchmarks` target.
On Linux platforms where libstdc++ is the default STL the CMake option `-DLIBCXX_BUILD_BENCHMARKS_NATIVE_STDLIB=ON` can be used to build each benchmark test against libstdc++ as well. This is useful for comparing performance between standard libraries.
Support for benchmarks is currently very minimal. They must be manually run by the user and there is no mechanism for detecting performance regressions.
Known Issues:
* `-DLIBCXX_INCLUDE_BENCHMARKS=ON` is only supported for Clang, and not GCC, since the `-stdlib=libc++` option is needed to build Google Benchmark.
Reviewers: danalbert, dberlin, chandlerc, mclow.lists, jroelofs
Subscribers: chandlerc, dberlin, tberghammer, danalbert, srhines, hfinkel
Differential Revision: https://reviews.llvm.org/D22240
llvm-svn: 276049
2016-07-20 07:07:03 +08:00
|
|
|
-L${LIBCXX_LIBRARY_DIR}
|
2016-08-30 03:50:49 +08:00
|
|
|
-Wl,-rpath,${LIBCXX_LIBRARY_DIR}
|
|
|
|
)
|
|
|
|
if (DEFINED LIBCXX_CXX_ABI_LIBRARY_PATH)
|
|
|
|
list(APPEND BENCHMARK_LIBCXX_COMPILE_FLAGS
|
|
|
|
-L${LIBCXX_CXX_ABI_LIBRARY_PATH}
|
|
|
|
-Wl,-rpath,${LIBCXX_CXX_ABI_LIBRARY_PATH})
|
|
|
|
endif()
|
[libcxx] Add support for benchmark tests using Google Benchmark.
Summary:
This patch does the following:
1. Checks in a copy of the Google Benchmark library into the libc++ repo under `utils/google-benchmark`.
2. Teaches libc++ how to build Google Benchmark against both (A) in-tree libc++ and (B) the platforms native STL.
3. Allows performance benchmarks to be built as part of the libc++ build.
Building the benchmarks (and Google Benchmark) is off by default. It must be enabled using the CMake option `-DLIBCXX_INCLUDE_BENCHMARKS=ON`. When this option is enabled the tests under `libcxx/benchmarks` can be built using the `libcxx-benchmarks` target.
On Linux platforms where libstdc++ is the default STL the CMake option `-DLIBCXX_BUILD_BENCHMARKS_NATIVE_STDLIB=ON` can be used to build each benchmark test against libstdc++ as well. This is useful for comparing performance between standard libraries.
Support for benchmarks is currently very minimal. They must be manually run by the user and there is no mechanism for detecting performance regressions.
Known Issues:
* `-DLIBCXX_INCLUDE_BENCHMARKS=ON` is only supported for Clang, and not GCC, since the `-stdlib=libc++` option is needed to build Google Benchmark.
Reviewers: danalbert, dberlin, chandlerc, mclow.lists, jroelofs
Subscribers: chandlerc, dberlin, tberghammer, danalbert, srhines, hfinkel
Differential Revision: https://reviews.llvm.org/D22240
llvm-svn: 276049
2016-07-20 07:07:03 +08:00
|
|
|
split_list(BENCHMARK_LIBCXX_COMPILE_FLAGS)
|
|
|
|
|
|
|
|
ExternalProject_Add(google-benchmark-libcxx
|
|
|
|
EXCLUDE_FROM_ALL ON
|
|
|
|
DEPENDS cxx
|
|
|
|
PREFIX benchmark-libcxx
|
|
|
|
SOURCE_DIR ${LIBCXX_SOURCE_DIR}/utils/google-benchmark
|
|
|
|
INSTALL_DIR ${CMAKE_CURRENT_BINARY_DIR}/benchmark-libcxx
|
2016-08-03 04:21:07 +08:00
|
|
|
CMAKE_CACHE_ARGS
|
|
|
|
-DCMAKE_C_COMPILER:STRING=${CMAKE_C_COMPILER}
|
|
|
|
-DCMAKE_CXX_COMPILER:STRING=${CMAKE_CXX_COMPILER}
|
[libcxx] Add support for benchmark tests using Google Benchmark.
Summary:
This patch does the following:
1. Checks in a copy of the Google Benchmark library into the libc++ repo under `utils/google-benchmark`.
2. Teaches libc++ how to build Google Benchmark against both (A) in-tree libc++ and (B) the platforms native STL.
3. Allows performance benchmarks to be built as part of the libc++ build.
Building the benchmarks (and Google Benchmark) is off by default. It must be enabled using the CMake option `-DLIBCXX_INCLUDE_BENCHMARKS=ON`. When this option is enabled the tests under `libcxx/benchmarks` can be built using the `libcxx-benchmarks` target.
On Linux platforms where libstdc++ is the default STL the CMake option `-DLIBCXX_BUILD_BENCHMARKS_NATIVE_STDLIB=ON` can be used to build each benchmark test against libstdc++ as well. This is useful for comparing performance between standard libraries.
Support for benchmarks is currently very minimal. They must be manually run by the user and there is no mechanism for detecting performance regressions.
Known Issues:
* `-DLIBCXX_INCLUDE_BENCHMARKS=ON` is only supported for Clang, and not GCC, since the `-stdlib=libc++` option is needed to build Google Benchmark.
Reviewers: danalbert, dberlin, chandlerc, mclow.lists, jroelofs
Subscribers: chandlerc, dberlin, tberghammer, danalbert, srhines, hfinkel
Differential Revision: https://reviews.llvm.org/D22240
llvm-svn: 276049
2016-07-20 07:07:03 +08:00
|
|
|
-DCMAKE_BUILD_TYPE:STRING=RELEASE
|
|
|
|
-DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
|
|
|
|
-DCMAKE_CXX_FLAGS:STRING=${BENCHMARK_LIBCXX_COMPILE_FLAGS}
|
2016-08-30 03:50:49 +08:00
|
|
|
-DBENCHMARK_USE_LIBCXX:BOOL=ON
|
[libcxx] Add support for benchmark tests using Google Benchmark.
Summary:
This patch does the following:
1. Checks in a copy of the Google Benchmark library into the libc++ repo under `utils/google-benchmark`.
2. Teaches libc++ how to build Google Benchmark against both (A) in-tree libc++ and (B) the platforms native STL.
3. Allows performance benchmarks to be built as part of the libc++ build.
Building the benchmarks (and Google Benchmark) is off by default. It must be enabled using the CMake option `-DLIBCXX_INCLUDE_BENCHMARKS=ON`. When this option is enabled the tests under `libcxx/benchmarks` can be built using the `libcxx-benchmarks` target.
On Linux platforms where libstdc++ is the default STL the CMake option `-DLIBCXX_BUILD_BENCHMARKS_NATIVE_STDLIB=ON` can be used to build each benchmark test against libstdc++ as well. This is useful for comparing performance between standard libraries.
Support for benchmarks is currently very minimal. They must be manually run by the user and there is no mechanism for detecting performance regressions.
Known Issues:
* `-DLIBCXX_INCLUDE_BENCHMARKS=ON` is only supported for Clang, and not GCC, since the `-stdlib=libc++` option is needed to build Google Benchmark.
Reviewers: danalbert, dberlin, chandlerc, mclow.lists, jroelofs
Subscribers: chandlerc, dberlin, tberghammer, danalbert, srhines, hfinkel
Differential Revision: https://reviews.llvm.org/D22240
llvm-svn: 276049
2016-07-20 07:07:03 +08:00
|
|
|
-DBENCHMARK_ENABLE_TESTING:BOOL=OFF)
|
|
|
|
|
|
|
|
#==============================================================================
|
|
|
|
# Build Google Benchmark for the native stdlib
|
|
|
|
#==============================================================================
|
|
|
|
if (LIBCXX_BUILD_BENCHMARK_NATIVE_STDLIB)
|
|
|
|
ExternalProject_Add(google-benchmark-native
|
|
|
|
EXCLUDE_FROM_ALL ON
|
|
|
|
PREFIX benchmark-native
|
|
|
|
SOURCE_DIR ${LIBCXX_SOURCE_DIR}/utils/google-benchmark
|
|
|
|
INSTALL_DIR ${CMAKE_CURRENT_BINARY_DIR}/benchmark-native
|
2016-08-03 04:21:07 +08:00
|
|
|
CMAKE_CACHE_ARGS
|
|
|
|
-DCMAKE_C_COMPILER:STRING=${CMAKE_C_COMPILER}
|
|
|
|
-DCMAKE_CXX_COMPILER:STRING=${CMAKE_CXX_COMPILER}
|
[libcxx] Add support for benchmark tests using Google Benchmark.
Summary:
This patch does the following:
1. Checks in a copy of the Google Benchmark library into the libc++ repo under `utils/google-benchmark`.
2. Teaches libc++ how to build Google Benchmark against both (A) in-tree libc++ and (B) the platforms native STL.
3. Allows performance benchmarks to be built as part of the libc++ build.
Building the benchmarks (and Google Benchmark) is off by default. It must be enabled using the CMake option `-DLIBCXX_INCLUDE_BENCHMARKS=ON`. When this option is enabled the tests under `libcxx/benchmarks` can be built using the `libcxx-benchmarks` target.
On Linux platforms where libstdc++ is the default STL the CMake option `-DLIBCXX_BUILD_BENCHMARKS_NATIVE_STDLIB=ON` can be used to build each benchmark test against libstdc++ as well. This is useful for comparing performance between standard libraries.
Support for benchmarks is currently very minimal. They must be manually run by the user and there is no mechanism for detecting performance regressions.
Known Issues:
* `-DLIBCXX_INCLUDE_BENCHMARKS=ON` is only supported for Clang, and not GCC, since the `-stdlib=libc++` option is needed to build Google Benchmark.
Reviewers: danalbert, dberlin, chandlerc, mclow.lists, jroelofs
Subscribers: chandlerc, dberlin, tberghammer, danalbert, srhines, hfinkel
Differential Revision: https://reviews.llvm.org/D22240
llvm-svn: 276049
2016-07-20 07:07:03 +08:00
|
|
|
-DCMAKE_BUILD_TYPE:STRING=RELEASE
|
2016-08-30 03:50:49 +08:00
|
|
|
-DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
|
|
|
|
-DBENCHMARK_ENABLE_TESTING:BOOL=OFF)
|
[libcxx] Add support for benchmark tests using Google Benchmark.
Summary:
This patch does the following:
1. Checks in a copy of the Google Benchmark library into the libc++ repo under `utils/google-benchmark`.
2. Teaches libc++ how to build Google Benchmark against both (A) in-tree libc++ and (B) the platforms native STL.
3. Allows performance benchmarks to be built as part of the libc++ build.
Building the benchmarks (and Google Benchmark) is off by default. It must be enabled using the CMake option `-DLIBCXX_INCLUDE_BENCHMARKS=ON`. When this option is enabled the tests under `libcxx/benchmarks` can be built using the `libcxx-benchmarks` target.
On Linux platforms where libstdc++ is the default STL the CMake option `-DLIBCXX_BUILD_BENCHMARKS_NATIVE_STDLIB=ON` can be used to build each benchmark test against libstdc++ as well. This is useful for comparing performance between standard libraries.
Support for benchmarks is currently very minimal. They must be manually run by the user and there is no mechanism for detecting performance regressions.
Known Issues:
* `-DLIBCXX_INCLUDE_BENCHMARKS=ON` is only supported for Clang, and not GCC, since the `-stdlib=libc++` option is needed to build Google Benchmark.
Reviewers: danalbert, dberlin, chandlerc, mclow.lists, jroelofs
Subscribers: chandlerc, dberlin, tberghammer, danalbert, srhines, hfinkel
Differential Revision: https://reviews.llvm.org/D22240
llvm-svn: 276049
2016-07-20 07:07:03 +08:00
|
|
|
endif()
|
|
|
|
|
|
|
|
#==============================================================================
|
|
|
|
# Benchmark tests configuration
|
|
|
|
#==============================================================================
|
2016-08-30 03:50:49 +08:00
|
|
|
add_custom_target(cxx-benchmarks)
|
[libcxx] Add support for benchmark tests using Google Benchmark.
Summary:
This patch does the following:
1. Checks in a copy of the Google Benchmark library into the libc++ repo under `utils/google-benchmark`.
2. Teaches libc++ how to build Google Benchmark against both (A) in-tree libc++ and (B) the platforms native STL.
3. Allows performance benchmarks to be built as part of the libc++ build.
Building the benchmarks (and Google Benchmark) is off by default. It must be enabled using the CMake option `-DLIBCXX_INCLUDE_BENCHMARKS=ON`. When this option is enabled the tests under `libcxx/benchmarks` can be built using the `libcxx-benchmarks` target.
On Linux platforms where libstdc++ is the default STL the CMake option `-DLIBCXX_BUILD_BENCHMARKS_NATIVE_STDLIB=ON` can be used to build each benchmark test against libstdc++ as well. This is useful for comparing performance between standard libraries.
Support for benchmarks is currently very minimal. They must be manually run by the user and there is no mechanism for detecting performance regressions.
Known Issues:
* `-DLIBCXX_INCLUDE_BENCHMARKS=ON` is only supported for Clang, and not GCC, since the `-stdlib=libc++` option is needed to build Google Benchmark.
Reviewers: danalbert, dberlin, chandlerc, mclow.lists, jroelofs
Subscribers: chandlerc, dberlin, tberghammer, danalbert, srhines, hfinkel
Differential Revision: https://reviews.llvm.org/D22240
llvm-svn: 276049
2016-07-20 07:07:03 +08:00
|
|
|
|
|
|
|
set(BENCHMARK_LIBCXX_INSTALL ${CMAKE_CURRENT_BINARY_DIR}/benchmark-libcxx)
|
|
|
|
set(BENCHMARK_NATIVE_INSTALL ${CMAKE_CURRENT_BINARY_DIR}/benchmark-native)
|
|
|
|
set(BENCHMARK_TEST_COMPILE_FLAGS
|
|
|
|
-std=c++14 -O2
|
|
|
|
-I${BENCHMARK_LIBCXX_INSTALL}/include
|
|
|
|
)
|
|
|
|
set(BENCHMARK_TEST_LIBCXX_COMPILE_FLAGS
|
|
|
|
-nostdinc++
|
2016-08-30 03:50:49 +08:00
|
|
|
-isystem ${LIBCXX_SOURCE_DIR}/include
|
[libcxx] Add support for benchmark tests using Google Benchmark.
Summary:
This patch does the following:
1. Checks in a copy of the Google Benchmark library into the libc++ repo under `utils/google-benchmark`.
2. Teaches libc++ how to build Google Benchmark against both (A) in-tree libc++ and (B) the platforms native STL.
3. Allows performance benchmarks to be built as part of the libc++ build.
Building the benchmarks (and Google Benchmark) is off by default. It must be enabled using the CMake option `-DLIBCXX_INCLUDE_BENCHMARKS=ON`. When this option is enabled the tests under `libcxx/benchmarks` can be built using the `libcxx-benchmarks` target.
On Linux platforms where libstdc++ is the default STL the CMake option `-DLIBCXX_BUILD_BENCHMARKS_NATIVE_STDLIB=ON` can be used to build each benchmark test against libstdc++ as well. This is useful for comparing performance between standard libraries.
Support for benchmarks is currently very minimal. They must be manually run by the user and there is no mechanism for detecting performance regressions.
Known Issues:
* `-DLIBCXX_INCLUDE_BENCHMARKS=ON` is only supported for Clang, and not GCC, since the `-stdlib=libc++` option is needed to build Google Benchmark.
Reviewers: danalbert, dberlin, chandlerc, mclow.lists, jroelofs
Subscribers: chandlerc, dberlin, tberghammer, danalbert, srhines, hfinkel
Differential Revision: https://reviews.llvm.org/D22240
llvm-svn: 276049
2016-07-20 07:07:03 +08:00
|
|
|
${BENCHMARK_TEST_COMPILE_FLAGS}
|
|
|
|
-Wno-user-defined-literals
|
|
|
|
)
|
|
|
|
set(BENCHMARK_TEST_LIBCXX_LINK_FLAGS
|
|
|
|
-nodefaultlibs
|
|
|
|
-L${BENCHMARK_LIBCXX_INSTALL}/lib/
|
|
|
|
)
|
|
|
|
set(BENCHMARK_TEST_NATIVE_LINK_FLAGS
|
|
|
|
-L${BENCHMARK_NATIVE_INSTALL}/lib/
|
|
|
|
)
|
|
|
|
split_list(BENCHMARK_TEST_COMPILE_FLAGS)
|
|
|
|
split_list(BENCHMARK_TEST_LIBCXX_COMPILE_FLAGS)
|
|
|
|
split_list(BENCHMARK_TEST_LIBCXX_LINK_FLAGS)
|
|
|
|
split_list(BENCHMARK_TEST_NATIVE_LINK_FLAGS)
|
|
|
|
macro(add_benchmark_test name source_file)
|
|
|
|
set(libcxx_target ${name}_libcxx)
|
|
|
|
add_executable(${libcxx_target} EXCLUDE_FROM_ALL ${source_file})
|
|
|
|
add_dependencies(${libcxx_target} cxx google-benchmark-libcxx)
|
2016-08-30 03:50:49 +08:00
|
|
|
add_dependencies(cxx-benchmarks ${libcxx_target})
|
2016-08-10 02:56:48 +08:00
|
|
|
if (LIBCXX_ENABLE_SHARED)
|
|
|
|
target_link_libraries(${libcxx_target} cxx_shared)
|
|
|
|
else()
|
|
|
|
target_link_libraries(${libcxx_target} cxx_static)
|
|
|
|
endif()
|
|
|
|
target_link_libraries(${libcxx_target} -lbenchmark)
|
[libcxx] Add support for benchmark tests using Google Benchmark.
Summary:
This patch does the following:
1. Checks in a copy of the Google Benchmark library into the libc++ repo under `utils/google-benchmark`.
2. Teaches libc++ how to build Google Benchmark against both (A) in-tree libc++ and (B) the platforms native STL.
3. Allows performance benchmarks to be built as part of the libc++ build.
Building the benchmarks (and Google Benchmark) is off by default. It must be enabled using the CMake option `-DLIBCXX_INCLUDE_BENCHMARKS=ON`. When this option is enabled the tests under `libcxx/benchmarks` can be built using the `libcxx-benchmarks` target.
On Linux platforms where libstdc++ is the default STL the CMake option `-DLIBCXX_BUILD_BENCHMARKS_NATIVE_STDLIB=ON` can be used to build each benchmark test against libstdc++ as well. This is useful for comparing performance between standard libraries.
Support for benchmarks is currently very minimal. They must be manually run by the user and there is no mechanism for detecting performance regressions.
Known Issues:
* `-DLIBCXX_INCLUDE_BENCHMARKS=ON` is only supported for Clang, and not GCC, since the `-stdlib=libc++` option is needed to build Google Benchmark.
Reviewers: danalbert, dberlin, chandlerc, mclow.lists, jroelofs
Subscribers: chandlerc, dberlin, tberghammer, danalbert, srhines, hfinkel
Differential Revision: https://reviews.llvm.org/D22240
llvm-svn: 276049
2016-07-20 07:07:03 +08:00
|
|
|
set_target_properties(${libcxx_target}
|
|
|
|
PROPERTIES
|
|
|
|
OUTPUT_NAME "${name}.libcxx.out"
|
|
|
|
COMPILE_FLAGS "${BENCHMARK_TEST_LIBCXX_COMPILE_FLAGS}"
|
|
|
|
LINK_FLAGS "${BENCHMARK_TEST_LIBCXX_LINK_FLAGS}")
|
|
|
|
if (LIBCXX_BUILD_BENCHMARK_NATIVE_STDLIB)
|
|
|
|
set(native_target ${name}_native)
|
|
|
|
add_executable(${native_target} EXCLUDE_FROM_ALL ${source_file})
|
|
|
|
add_dependencies(${native_target} google-benchmark-native)
|
|
|
|
target_link_libraries(${native_target} -lbenchmark)
|
|
|
|
if (LIBCXX_HAS_PTHREAD_LIB)
|
|
|
|
target_link_libraries(${native_target} -pthread)
|
|
|
|
endif()
|
2016-08-30 03:50:49 +08:00
|
|
|
add_dependencies(cxx-benchmarks ${native_target})
|
[libcxx] Add support for benchmark tests using Google Benchmark.
Summary:
This patch does the following:
1. Checks in a copy of the Google Benchmark library into the libc++ repo under `utils/google-benchmark`.
2. Teaches libc++ how to build Google Benchmark against both (A) in-tree libc++ and (B) the platforms native STL.
3. Allows performance benchmarks to be built as part of the libc++ build.
Building the benchmarks (and Google Benchmark) is off by default. It must be enabled using the CMake option `-DLIBCXX_INCLUDE_BENCHMARKS=ON`. When this option is enabled the tests under `libcxx/benchmarks` can be built using the `libcxx-benchmarks` target.
On Linux platforms where libstdc++ is the default STL the CMake option `-DLIBCXX_BUILD_BENCHMARKS_NATIVE_STDLIB=ON` can be used to build each benchmark test against libstdc++ as well. This is useful for comparing performance between standard libraries.
Support for benchmarks is currently very minimal. They must be manually run by the user and there is no mechanism for detecting performance regressions.
Known Issues:
* `-DLIBCXX_INCLUDE_BENCHMARKS=ON` is only supported for Clang, and not GCC, since the `-stdlib=libc++` option is needed to build Google Benchmark.
Reviewers: danalbert, dberlin, chandlerc, mclow.lists, jroelofs
Subscribers: chandlerc, dberlin, tberghammer, danalbert, srhines, hfinkel
Differential Revision: https://reviews.llvm.org/D22240
llvm-svn: 276049
2016-07-20 07:07:03 +08:00
|
|
|
set_target_properties(${native_target}
|
|
|
|
PROPERTIES
|
|
|
|
OUTPUT_NAME "${name}.native.out"
|
|
|
|
INCLUDE_DIRECTORIES ""
|
|
|
|
COMPILE_FLAGS "${BENCHMARK_TEST_COMPILE_FLAGS}"
|
|
|
|
LINK_FLAGS "${BENCHMARK_TEST_NATIVE_LINK_FLAGS}")
|
|
|
|
endif()
|
|
|
|
endmacro()
|
|
|
|
|
|
|
|
|
|
|
|
#==============================================================================
|
|
|
|
# Register Benchmark tests
|
|
|
|
#==============================================================================
|
|
|
|
file(GLOB BENCHMARK_TESTS "*.bench.cpp")
|
|
|
|
foreach(test_path ${BENCHMARK_TESTS})
|
|
|
|
get_filename_component(test_file "${test_path}" NAME)
|
2016-09-07 08:57:26 +08:00
|
|
|
message(STATUS "Adding Benchmark: ${test_file}")
|
[libcxx] Add support for benchmark tests using Google Benchmark.
Summary:
This patch does the following:
1. Checks in a copy of the Google Benchmark library into the libc++ repo under `utils/google-benchmark`.
2. Teaches libc++ how to build Google Benchmark against both (A) in-tree libc++ and (B) the platforms native STL.
3. Allows performance benchmarks to be built as part of the libc++ build.
Building the benchmarks (and Google Benchmark) is off by default. It must be enabled using the CMake option `-DLIBCXX_INCLUDE_BENCHMARKS=ON`. When this option is enabled the tests under `libcxx/benchmarks` can be built using the `libcxx-benchmarks` target.
On Linux platforms where libstdc++ is the default STL the CMake option `-DLIBCXX_BUILD_BENCHMARKS_NATIVE_STDLIB=ON` can be used to build each benchmark test against libstdc++ as well. This is useful for comparing performance between standard libraries.
Support for benchmarks is currently very minimal. They must be manually run by the user and there is no mechanism for detecting performance regressions.
Known Issues:
* `-DLIBCXX_INCLUDE_BENCHMARKS=ON` is only supported for Clang, and not GCC, since the `-stdlib=libc++` option is needed to build Google Benchmark.
Reviewers: danalbert, dberlin, chandlerc, mclow.lists, jroelofs
Subscribers: chandlerc, dberlin, tberghammer, danalbert, srhines, hfinkel
Differential Revision: https://reviews.llvm.org/D22240
llvm-svn: 276049
2016-07-20 07:07:03 +08:00
|
|
|
string(REPLACE ".bench.cpp" "" test_name "${test_file}")
|
|
|
|
add_benchmark_test(${test_name} ${test_file})
|
|
|
|
endforeach()
|