Difference between revisions of "ProfilingWesnoth"

From The Battle for Wesnoth Wiki
(gperftools)
Line 9: Line 9:
 
# Run the executable and have it do any task(s) as needed to get relevant profiling information.
 
# Run the executable and have it do any task(s) as needed to get relevant profiling information.
 
# Generate the human-readable profiling output using the command <code>google-pprof <executable> <profiling info> > prof.txt</code> for a text file, or <code>google-pprof -gif <executable> <profiling info> > prof.gif</code> for a viewable gif image.
 
# Generate the human-readable profiling output using the command <code>google-pprof <executable> <profiling info> > prof.txt</code> for a text file, or <code>google-pprof -gif <executable> <profiling info> > prof.gif</code> for a viewable gif image.
 +
 +
Unfortunately, the output, whether graphical or text, doesn't provide any labels for what the values mean. For the text output, the columns are:
 +
# The number of profiling samples in this function
 +
# The percentage of profiling samples in this function
 +
# The percentage of profiling samples in the functions printed so far
 +
# The number of profiling samples in this function and its callees
 +
# The percentage of profiling samples in this function and its callees
 +
# The function name
 +
 +
For the graphical output, each square will contain:
 +
# The namespace/class/method profiled each on a separate line
 +
# The number of profiling samples in this function
 +
# The percentage of profiling samples in this function (in parenthesis)
 +
# The number of profiling samples in this function and its callees
 +
# The percentage of profiling samples in this function and its callees (in parenthesis)
  
 
=== perf ===
 
=== perf ===

Revision as of 04:30, 9 June 2021

Linux

When using either scons or cmake to build, there are four options available for profiling which are listed below. For cmake use -DPROFILER=<name>, for scons use profiler=<name>.

gperftools

To use gperftools:

  1. Install the packages google-perftools (needed later for running google-pprof) and libgoogle-perftools-dev (needed in order to use the -lprofiler linker option).
  2. In a terminal, export the CPUPROFILE variable, such as export CPUPROFILE=./wesnoth-prof.
  3. Build any executable while setting either -DPROFILER=gperftools (cmake) or profiler=gperftools (scons).
  4. Run the executable and have it do any task(s) as needed to get relevant profiling information.
  5. Generate the human-readable profiling output using the command google-pprof <executable> <profiling info> > prof.txt for a text file, or google-pprof -gif <executable> <profiling info> > prof.gif for a viewable gif image.

Unfortunately, the output, whether graphical or text, doesn't provide any labels for what the values mean. For the text output, the columns are:

  1. The number of profiling samples in this function
  2. The percentage of profiling samples in this function
  3. The percentage of profiling samples in the functions printed so far
  4. The number of profiling samples in this function and its callees
  5. The percentage of profiling samples in this function and its callees
  6. The function name

For the graphical output, each square will contain:

  1. The namespace/class/method profiled each on a separate line
  2. The number of profiling samples in this function
  3. The percentage of profiling samples in this function (in parenthesis)
  4. The number of profiling samples in this function and its callees
  5. The percentage of profiling samples in this function and its callees (in parenthesis)

perf

gcov

gprof