blob: 0f9061aa3cd391ea179b1881b0785a53bb854913 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
|
# Config
# ======
option(CHECK_BENCHMARKS "Run benchmarks on check target" off)
option(BENCHMARK_DISABLE_GC "Disable gc during a measurement")
set(BENCHMARK_PARAM "N:1000" CACHE STRING "Benchmark parameters")
set(BENCHMARK_SAMPLES "20" CACHE STRING "Benchmark samples")
# Dependencies
# ============
find_package(RRB)
if (NOT RRB_FOUND)
message(STATUS "Disabling benchmarks")
return()
endif()
# These are expected to be in the include path, the nix-shell
# environment installs them:
#
# https://github.com/marcusz/steady
# https://github.com/deepsea-inria/chunkedseq.git
# https://github.com/rsms/immutable-cpp.git
# Targets
# =======
add_custom_target(benchmarks
COMMENT "Build all benchmarks.")
execute_process(
COMMAND git log -1 --format=%h
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE immer_git_commit_hash
OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(
COMMAND git status --porcelain
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE immer_git_status
OUTPUT_STRIP_TRAILING_WHITESPACE)
if (NOT immer_git_status STREQUAL "")
set(immer_git_commit_hash "${immer_git_commit_hash}+")
endif()
site_name(immer_hostname)
get_filename_component(immer_compiler_name "${CMAKE_CXX_COMPILER}" NAME)
set(immer_benchmark_report_base_dir "${CMAKE_SOURCE_DIR}/reports")
set(immer_benchmark_report_dir "${immer_benchmark_report_base_dir}/report_\
${immer_git_commit_hash}_\
${immer_hostname}_\
${immer_compiler_name}_\
${BENCHMARK_PARAM}_\
s${BENCHMARK_SAMPLES}")
if(DISABLE_FREE_LIST)
set(immer_benchmark_report_dir "${immer_benchmark_report_dir}_nofl")
endif()
if(DISABLE_THREAD_SAFETY)
set(immer_benchmark_report_dir "${immer_benchmark_report_dir}_nots")
endif()
if(BENCHMARK_DISABLE_GC)
set(immer_benchmark_report_dir "${immer_benchmark_report_dir}_nogc")
endif()
if(CHECK_BENCHMARKS)
add_dependencies(check benchmarks)
endif()
add_custom_target(benchmark-report-dir
COMMAND ${CMAKE_COMMAND}
-E make_directory ${immer_benchmark_report_dir})
file(GLOB_RECURSE immer_benchmarks "*.cpp")
foreach(_file IN LISTS immer_benchmarks)
immer_target_name_for(_target _output "${_file}")
add_executable(${_target} EXCLUDE_FROM_ALL "${_file}")
set_target_properties(${_target} PROPERTIES OUTPUT_NAME ${_output})
add_dependencies(benchmarks ${_target})
add_dependencies(${_target} benchmark-report-dir)
target_compile_options(${_target} PUBLIC -Wno-unused-function)
target_compile_definitions(${_target} PUBLIC
NONIUS_RUNNER
IMMER_BENCHMARK_LIBRRB=1
IMMER_BENCHMARK_STEADY=1
IMMER_BENCHMARK_EXPERIMENTAL=0
IMMER_BENCHMARK_DISABLE_GC=${BENCHMARK_DISABLE_GC}
IMMER_BENCHMARK_BOOST_COROUTINE=${ENABLE_BOOST_COROUTINE})
target_link_libraries(${_target} PUBLIC
immer-dev
${RRB_LIBRARIES})
target_include_directories(${_target} SYSTEM PUBLIC
${RRB_INCLUDE_DIR})
if(CHECK_BENCHMARKS)
add_test("benchmark/${_output}" "${CMAKE_SOURCE_DIR}/tools/with-tee.bash"
${immer_benchmark_report_dir}/${_target}.out
"${CMAKE_CURRENT_BINARY_DIR}/${_output}" -v
-t ${_target}
-r html
-s ${BENCHMARK_SAMPLES}
-p ${BENCHMARK_PARAM}
-o ${immer_benchmark_report_dir}/${_target}.html)
endif()
endforeach()
set(immer_ssh_method
ssh -p 5488
-o StrictHostKeyChecking=no
-i ${CMAKE_SOURCE_DIR}/tools/travis/ssh-key)
add_custom_target(upload-benchmark-reports
COMMAND
rsync -av -e \"${immer_ssh_method}\"
${immer_benchmark_report_base_dir}
raskolnikov@sinusoid.es:public/misc/immer/)
add_custom_target(copy-benchmark-reports
COMMAND
rsync -av ${immer_benchmark_report_base_dir}
~/public/misc/immer/)
|