4 Lua profiling
whosit edited this page 2023-06-29 21:13:18 +00:00

Using lua profilers (TODO)

Using linux perf tool to profile minetest

  1. Compile LuaJIT using LUAJIT_USE_PERFTOOLS flag:
make CFLAGS="-g -DLUAJIT_USE_PERFTOOLS"
  1. Run server using LD_PRELOAD to override the installed luajit library:
LD_PRELOAD=<your-path-here>/LuaJIT/src/libluajit.so ./bin/minetestserver
  1. run perf
perf record -Fmax -g -p `pgrep minetestserver`
  1. examine the output:
perf report

The output will now have [JIT] records with file names and line numbers of lua code.