Changes between Version 20 and Version 21 of EngineProfiling


Ignore:
Timestamp:
Jul 31, 2022, 6:32:34 AM (21 months ago)
Author:
Andy Alt
Comment:

Add instructions for profiling with google-perf (gperftools)... Instructions pinched (and modified) from the Geany wiki https://wiki.geany.org/howtos/profiling/gperftools

Legend:

Unmodified
Added
Removed
Modified
  • EngineProfiling

    v20 v21  
    4747
    4848Additional information on Profiler2 such as screenshots and explanations of the HTML interface can be found at [wiki:Profiler2 Profiler2]
     49
     50== Profiling with google-perf or pprof
     51
     52On debian-based systems the tools are packaged under the google-perftools package. For graphical output you also need graphviz installed:
     53
     54```sudo apt-get install google-perftools graphviz```
     55
     56On arch-based systems, the package is called gperftools.
     57
     58To start profiling, run
     59
     60```LD_PRELOAD=/usr/lib/libprofiler.so CPUPROFILE=/tmp/0ad.prof 0ad```
     61
     62LD_PRELOAD is used to preload the profiler's library, CPUPROFILE determines the location of the profiler's output, and in the above example, 0ad is the name of the binary to be executed. The path to the libprofiler library may differ distribution by distribution - I have also seen it under /usr/lib/libprofiler.so.0.
     63
     64Do whatever you want to profile in 0ad. When finished, close 0ad.
     65
     66At this point, /tmp/0ad.prof contains the CPU profile information. To view it graphically, run
     67
     68```google-pprof --web /usr/bin/0ad /tmp/0ad.prof```
     69
     70(Note the absolute path to 0ad must be used here.) T
     71
     72On arch-based systems, use `pprof` instead of `google-pprof`.
     73
     74After several minutes, your default web browser will open and display the graphical profile in the svg format.
    4975
    5076== Low-overhead timer ==