Skip to content

Commit e48dedf

Browse files
committed
build: provide LUAJIT_USE_PERFTOOLS option
This patch provides the LUAJIT_USE_PERFTOOLS flag via the CMake build system. It allows avoiding the definition of the cognominal macro definition via CMAKE_C_FLAGS to use integration with the Linux perf tools interface [1] to resolve symbols for traces generated by a JIT. It may be used like the following: | perf script record luajit test.lua | perf report -s symbol [1]: https://github.com/torvalds/linux/blob/master/tools/perf/Documentation/jit-interface.txt Resolves tarantool/tarantool#11300
1 parent d86738f commit e48dedf

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,14 @@ if(LUAJIT_USE_VALGRIND)
259259
AppendFlags(TARGET_C_FLAGS -DLUAJIT_USE_VALGRIND)
260260
endif()
261261

262+
# This creates a symbol table of the JIT-compiled code in
263+
# a </tmp/perf-%d.map> (%d = pid of process) file. It should be
264+
# used with Linux perf tools. See <src/lj_trace.c> for details.
265+
option(LUAJIT_USE_PERFTOOLS "Linux perf JIT support" OFF)
266+
if(LUAJIT_USE_PERFTOOLS)
267+
AppendFlags(TARGET_C_FLAGS -DLUAJIT_USE_PERFTOOLS)
268+
endif()
269+
262270
# This is the client for the GDB JIT API. GDB 7.0 or higher is
263271
# required to make use of it. See lj_gdbjit.c for details.
264272
# Enabling this causes a non-negligible overhead, even when not

0 commit comments

Comments
 (0)