mirror of
https://github.com/facebook/rocksdb.git
synced 2024-11-30 22:41:48 +00:00
76383bea5d
Summary: Add basic microbenchmark document Pull Request resolved: https://github.com/facebook/rocksdb/pull/9781 Reviewed By: gitbw95 Differential Revision: D35272866 Pulled By: jay-zhuang fbshipit-source-id: f482e652151fd05ca46e29629261833f038a6075
18 lines
782 B
CMake
18 lines
782 B
CMake
find_package(benchmark REQUIRED)
|
|
find_package(Threads REQUIRED)
|
|
|
|
file(GLOB_RECURSE ALL_BENCH_CPP *.cc)
|
|
foreach(ONE_BENCH_CPP ${ALL_BENCH_CPP})
|
|
get_filename_component(TARGET_NAME ${ONE_BENCH_CPP} NAME_WE)
|
|
add_executable(${TARGET_NAME} ${ONE_BENCH_CPP})
|
|
target_link_libraries(${TARGET_NAME} ${ROCKSDB_LIB} benchmark::benchmark
|
|
${CMAKE_THREAD_LIBS_INIT})
|
|
# run benchmark like a test, if added, the benchmark tests could be run by `ctest -R Bench_`
|
|
# add_test(Bench_${TARGET_NAME} ${TARGET_NAME})
|
|
list(APPEND ALL_BENCH_TARGETS ${TARGET_NAME})
|
|
endforeach()
|
|
add_custom_target(microbench DEPENDS ${ALL_BENCH_TARGETS})
|
|
add_custom_target(run_microbench
|
|
COMMAND for t in ${ALL_BENCH_TARGETS}\; do \.\/$$t \|\| exit 1\; done
|
|
DEPENDS ${ALL_BENCH_TARGETS})
|