Difference between revisions of "UsingGooglePerformanceTools"

From The Battle for Wesnoth Wiki
(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…')
 
(wikify)
 
(3 intermediate revisions by 2 users not shown)
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 [[ProfilingWesnoth|profiling Wesnoth's CPU and memory usage]], especially on Linux.
  
[http://goog-perftools.sourceforge.net/doc/cpu_profiler.html]
+
* [http://goog-perftools.sourceforge.net/doc/cpu_profiler.html Documentation: CPU Profiler]
[http://goog-perftools.sourceforge.net/doc/heap_profiler.html]
+
* [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.
+
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].
  
 
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:
 
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 LD_PRELOAD=/path/to/libprofiler.so
export CPUPROFILE=./cpu-profile.dat
+
export CPUPROFILE=./cpu-profile.dat
  
 
To profile the CPU, or,
 
To profile the CPU, or,
  
export LD_PRELOAD=/path/to/libtcmalloc.so
+
export LD_PRELOAD=/path/to/libtcmalloc.so
export HEAPPROFILE=./heap-profile.dat
+
export HEAPPROFILE=./heap-profile.dat
  
 
To profile memory usage.
 
To profile memory usage.
Line 22: Line 22:
 
Then use,
 
Then use,
  
pprof /path/to/wesnoth/binary ./cpu-profile.dat
+
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.
 
To read a profile file. There are a number of commands you can run, but suggested is 'gv' to get graphical output.
 +
 +
 +
[[Category:Development]]

Latest revision as of 04:49, 8 May 2023

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.