Difference between revisions of "UsingGooglePerformanceTools"

From The Battle for Wesnoth Wiki
(reformat the profiling page and add a link to the sources (hopefully correct))
(make it a list instead of links in the same line)
Line 1: Line 1:
 
The Google performance tools are recommended for profiling Wesnoth's CPU and memory usage, especially on Linux.
 
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 Documentation: CPU Profiler]
+
* [http://goog-perftools.sourceforge.net/doc/cpu_profiler.html Documentation: CPU Profiler]
[http://goog-perftools.sourceforge.net/doc/heap_profiler.html Documentation: Heap Profiler]
+
* [http://goog-perftools.sourceforge.net/doc/heap_profiler.html Documentation: Heap Profiler]
  
 
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 [http://code.google.com/p/gperftools/?redir=1 get them from here as sourcecode].
 
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 [http://code.google.com/p/gperftools/?redir=1 get them from here as sourcecode].

Revision as of 10:09, 5 February 2012

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.