[Tarantool-patches] [PATCH v1 luajit 40/41] perf: provide CMake option to setup the benchmark

Sergey Kaplun skaplun at tarantool.org
Fri Oct 24 14:00:34 MSK 2025


This patch introduces the `LUAJIT_BENCH_INIT` option to determine the
shell command to be run before the benchmark itself. It may be useful to
set taskset, etc.
---
 perf/CMakeLists.txt | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/perf/CMakeLists.txt b/perf/CMakeLists.txt
index 68e561fd..c315597f 100644
--- a/perf/CMakeLists.txt
+++ b/perf/CMakeLists.txt
@@ -7,6 +7,13 @@ if(CMAKE_BUILD_TYPE STREQUAL "Debug")
                   "Timings may be affected.")
 endif()
 
+# The shell command needs to be run before benchmarks are started.
+if(LUAJIT_BENCH_INIT)
+  message(STATUS
+    "The following command will run before benchmarks: '${LUAJIT_BENCH_INIT}'."
+  )
+endif()
+
 set(PERF_OUTPUT_DIR ${PROJECT_BINARY_DIR}/perf/output)
 file(MAKE_DIRECTORY ${PERF_OUTPUT_DIR})
 
@@ -51,7 +58,7 @@ macro(AddBench bench_name bench_path perf_suite LUA_PATH)
   set(bench_out_file
     ${PERF_OUTPUT_DIR}/${perf_suite}/${bench_name_stripped}.json
   )
-  set(bench_command "${LUAJIT_BINARY} ${bench_path}")
+  set(bench_command "${LUAJIT_BENCH_INIT} ${LUAJIT_BINARY} ${bench_path}")
   if(${ARGC} GREATER 4)
     set(input_file ${ARGV4})
     set(bench_command "${bench_command} < ${input_file}")
-- 
2.51.0



More information about the Tarantool-patches mailing list