UsingGooglePerformanceTools

From The Battle for Wesnoth Wiki

The Google performance tools are recommended for profiling Wesnoth's CPU and memory usage, especially on Linux.

These performance tools are now shipped with Debian GNU/Linux and many other Linux-based systems. Those which don't have it packages should be able to get them from here as sourcecode.

Wesnoth has been tested successfully using LD_PRELOAD to load the libraries in. Thus on Linux if you just want to profile a run of Wesnoth all you have to do is have the Google performance tools on your system and use something like this before running Wesnoth:

export LD_PRELOAD=/path/to/libprofiler.so
export CPUPROFILE=./cpu-profile.dat

To profile the CPU, or,

export LD_PRELOAD=/path/to/libtcmalloc.so
export HEAPPROFILE=./heap-profile.dat

To profile memory usage.

Then run Wesnoth, exit it cleanly, and you should have a cpu-profile.dat or heap-profile.dat file. The memory profile actually dumps out profile files periodically as it runs.

Then use,

pprof /path/to/wesnoth/binary ./cpu-profile.dat

To read a profile file. There are a number of commands you can run, but suggested is 'gv' to get graphical output.

This page was last edited on 8 May 2023, at 04:49.