UsingGooglePerformanceTools

From The Battle for Wesnoth Wiki
Revision as of 14:04, 6 February 2011 by Dave (talk | contribs) (Created page with 'The Google performance tools are recommended for profiling Wesnoth's CPU and memory usage, especially on Linux. [http://goog-perftools.sourceforge.net/doc/cpu_profiler.html] [ht…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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

[1] [2]

These performance tools are now shipped with Debian GNU/Linux and many other Linux-based systems.

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.