Skip to content

Commit 00f7c2b

Browse files
committed
perf: provide CMake option to setup the benchmark
This patch introduces the `LUAJIT_BENCH_INIT` option to determine the shell command prefix to be run before the benchmark itself. It may be useful to set taskset, etc. Reviewed-by: Sergey Bronnikov <[email protected]> Signed-off-by: Sergey Kaplun <[email protected]>
1 parent 44d7ac8 commit 00f7c2b

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

perf/CMakeLists.txt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,13 @@ if(CMAKE_BUILD_TYPE STREQUAL "Debug")
1212
"Timings may be affected.")
1313
endif()
1414

15+
# The shell command needs to be run before benchmarks are started.
16+
if(LUAJIT_BENCH_INIT)
17+
message(STATUS
18+
"The following command will run before benchmarks: '${LUAJIT_BENCH_INIT}'."
19+
)
20+
endif()
21+
1522
set(PERF_OUTPUT_DIR ${PROJECT_BINARY_DIR}/perf/output)
1623
file(MAKE_DIRECTORY ${PERF_OUTPUT_DIR})
1724

@@ -56,7 +63,7 @@ macro(AddBench bench_name bench_path perf_suite LUA_PATH)
5663
set(bench_out_file
5764
${PERF_OUTPUT_DIR}/${perf_suite}/${bench_name_stripped}.json
5865
)
59-
set(bench_command "${LUAJIT_BINARY} ${bench_path}")
66+
set(bench_command "${LUAJIT_BENCH_INIT} ${LUAJIT_BINARY} ${bench_path}")
6067
if(${ARGC} GREATER 4)
6168
set(input_file ${ARGV4})
6269
set(bench_command "${bench_command} < ${input_file}")

0 commit comments

Comments
 (0)