We will be using a tool called "perf", which you can get by installing perf
or linux-perf
or linux-tools-common
.
To get usable results you need to build Minetest with debug symbols
(-DCMAKE_BUILD_TYPE=RelWithDebInfo
or -DCMAKE_BUILD_TYPE=Debug
).
Run the client (or server) like this and do whatever you wanted to test:
perf record -z --call-graph dwarf -- ./bin/minetest
This will leave a file called "perf.data".
You can open this file with perf built-in tools but much more interesting is the visualization using a GUI tool: Hotspot. It will give you flamegraphs, per-thread, per-function views and much more.
Attach perf to your running server, press ^C to stop:
perf record -z --call-graph dwarf -F 400 -p "$(pidof minetestserver)"
Collect a copy of the required libraries/executables:
perf buildid-list | grep -Eo '/[^ ]+(minetestserver|\.so)[^ ]*$' | \
tar -cvahf debug.tgz --files-from=- --ignore-failed-read
Give both files to the developer and also provide:
Hotspot will resolve symbols correctly when pointing the sysroot option at the collected libs.