diff options
author | chappedm@gmail.com <chappedm@gmail.com@6b5cf1ce-ec42-a296-1ba9-69fdba395a50> | 2012-11-05 04:45:01 +0000 |
---|---|---|
committer | chappedm@gmail.com <chappedm@gmail.com@6b5cf1ce-ec42-a296-1ba9-69fdba395a50> | 2012-11-05 04:45:01 +0000 |
commit | 8de78fd85b69bc569ac8fc9e75144e02f5cae851 (patch) | |
tree | 86b70143bc8a648a42cc93aa9d0c7683db822c8f /doc | |
parent | 46f06ca0db41d3f598750caefdaf3c6063969e64 (diff) | |
download | gperftools-8de78fd85b69bc569ac8fc9e75144e02f5cae851.tar.gz |
issue-452: Adds a control mechanism to the cpu profiler to be switched on and off using a user defined signal.
CPUPROFILESIGNAL - Takes a signal number between the value of 1 and 64 inclusive which represents a signal
number as defined by signal.h. The signal must not be in use by the program. Sending this
signal to the program turns profiling on and off like a switch. By default the switch is
off when the program starts. Successive profiles are suffixed with a monotonically increasing
number.
git-svn-id: http://gperftools.googlecode.com/svn/trunk@182 6b5cf1ce-ec42-a296-1ba9-69fdba395a50
Diffstat (limited to 'doc')
-rw-r--r-- | doc/cpuprofile.html | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/doc/cpuprofile.html b/doc/cpuprofile.html index 769ec68..c81feb6 100644 --- a/doc/cpuprofile.html +++ b/doc/cpuprofile.html @@ -54,12 +54,27 @@ for a given run of an executable:</p> <code>/bin/ls</code> that had been linked against libprofiler, you could run:</p> <pre>% env CPUPROFILE=ls.prof /bin/ls</pre> - + </li> + <li> <p>In addition to defining the environment variable CPUPROFILE + you can also define CPUPROFILESIGNAL. This allows profiling to be + controlled via the signal number that you specify. The signal number + must be unused by the program under normal operation. Internally it + acts as a switch, triggered by the signal, which is off by default. + For instance, if you had a copy of <code>/bin/chrome</code> that had been + been linked against libprofiler, you could run:</p> + <pre>% env CPUPROFILE=chrome.prof CPUPROFILESIGNAL=12 /bin/chrome &</pre> + <p>You can then trigger profiling to start:</p> + <pre>% killall -12 chrome</pre> + <p>Then after a period of time you can tell it to stop which will + generate the profile:</p> + <pre>% killall -12 chrome</pre> + </li> <li> <p>In your code, bracket the code you want profiled in calls to <code>ProfilerStart()</code> and <code>ProfilerStop()</code>. (These functions are declared in <code><gperftools/profiler.h></code>.) <code>ProfilerStart()</code> will take the profile-filename as an argument.</p> + </li> </ol> <p>In Linux 2.6 and above, profiling works correctly with threads, |