<!DOCTYPE html>
<html data-lt-installed="true">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body style="padding-bottom: 1px;">
<p>Hi, Sergey,</p>
<p>thanks for the patch!<br>
</p>
<div class="moz-cite-prefix">On 6/3/25 20:35, Sergey Kaplun wrote:<br>
</div>
<blockquote type="cite"
cite="mid:20250603173559.24591-1-skaplun@tarantool.org">
<pre wrap="" class="moz-quote-pre">This patch provides the LUAJIT_USE_PERFTOOLS flag via the CMake build
system. It allows you to avoid the definition of the cognominal macro</pre>
</blockquote>
<p>it's better to write <span class="HwtZe" lang="en"><span
class="jCAhz"><span class="ryNqvb">impersonally: It allows
avoiding the definition of ...</span></span></span></p>
<p><span class="HwtZe" lang="en"><span class="jCAhz"><span
class="ryNqvb">Feel free to ignore.<br>
</span></span></span><span class="ZSCsVd"></span></p>
<div class="OvtS8d"><br>
</div>
<blockquote type="cite"
cite="mid:20250603173559.24591-1-skaplun@tarantool.org">
<pre wrap="" class="moz-quote-pre">
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 record script -f luajit test.lua</pre>
</blockquote>
<p>seems command is incorrect, because it does not work for me:</p>
<p><snipped><br>
</p>
<p>script: unexpected number of arguments<br>
Try 'script --help' for more information.<br>
<snipped></p>
<p>I've used instead:</p>
<p>$ sudo perf record -F 2000 ./build/src/luajit fib.lua <br>
[ perf record: Woken up 1 times to write data ]<br>
[ perf record: Captured and wrote 0.024 MB perf.data (8 samples) ]<br>
<br>
</p>
<blockquote type="cite"
cite="mid:20250603173559.24591-1-skaplun@tarantool.org">
<pre wrap="" class="moz-quote-pre">
| perf report -s symbol
</pre>
</blockquote>
and "perf report /tmp/perf-1699839.map" to check that luajit report
symbols in map file.<br>
<blockquote type="cite"
cite="mid:20250603173559.24591-1-skaplun@tarantool.org">
<pre wrap="" class="moz-quote-pre">[1]: <a class="moz-txt-link-freetext" href="https://github.com/torvalds/linux/blob/master/tools/perf/Documentation/jit-interface.txt">https://github.com/torvalds/linux/blob/master/tools/perf/Documentation/jit-interface.txt</a>
Resolves tarantool/tarantool#11300
---
Branch: <a class="moz-txt-link-freetext" href="https://github.com/tarantool/luajit/tree/skaplun/gh-11300-use-perftools-flag">https://github.com/tarantool/luajit/tree/skaplun/gh-11300-use-perftools-flag</a>
Issue: <a class="moz-txt-link-freetext" href="https://github.com/tarantool/tarantool/issues/11300">https://github.com/tarantool/tarantool/issues/11300</a>
CMakeLists.txt | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 854b3613..c0da4362 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -259,6 +259,14 @@ if(LUAJIT_USE_VALGRIND)
AppendFlags(TARGET_C_FLAGS -DLUAJIT_USE_VALGRIND)
endif()
+# This creates a symbol table of the JIT-compiled code in
+# a </tmp/perf-%d.map> (%d = pid of process) file. It should be
+# used with Linux perf tools. See <src/lj_trace.c> for details.
+option(LUAJIT_USE_PERFTOOLS "Linux perf JIT support" OFF)
+if(LUAJIT_USE_PERFTOOLS)
+ AppendFlags(TARGET_C_FLAGS -DLUAJIT_USE_PERFTOOLS)
+endif()</pre>
</blockquote>
<p>Adding a CMake flag means that we support it in our fork (users
will rely on this functionality).</p>
<p>Do want a regression test for this option?<br>
</p>
<blockquote type="cite"
cite="mid:20250603173559.24591-1-skaplun@tarantool.org">
<pre wrap="" class="moz-quote-pre">
+
# This is the client for the GDB JIT API. GDB 7.0 or higher is
# required to make use of it. See lj_gdbjit.c for details.
# Enabling this causes a non-negligible overhead, even when not
</pre>
</blockquote>
</body>
<lt-container></lt-container>
</html>