diff --git a/trunk/research/gperftools/cpu-profiler/cpu_profiler.cc b/trunk/research/gperftools/cpu-profiler/cpu_profiler.cc index de8c7c059..32068208a 100644 --- a/trunk/research/gperftools/cpu-profiler/cpu_profiler.cc +++ b/trunk/research/gperftools/cpu-profiler/cpu_profiler.cc @@ -21,6 +21,7 @@ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** +@see: http://google-perftools.googlecode.com/svn/trunk/doc/cpuprofile.html config srs with gperf(to make gperftools): ./configure --with-gperf --jobs=3 set the pprof path if not set: diff --git a/trunk/research/gperftools/heap-checker/heap_checker.cc b/trunk/research/gperftools/heap-checker/heap_checker.cc index e13943104..8415029f1 100644 --- a/trunk/research/gperftools/heap-checker/heap_checker.cc +++ b/trunk/research/gperftools/heap-checker/heap_checker.cc @@ -21,6 +21,7 @@ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** +@see: http://google-perftools.googlecode.com/svn/trunk/doc/heap_checker.html config srs with gperf(to make gperftools): ./configure --with-gperf --jobs=3 set the pprof path if not set: @@ -56,8 +57,12 @@ void global_leak() { global_leak_imp(); } +bool loop = true; void handler(int sig) { - exit(0); + // we must use signal to notice the main thread to exit normally. + if (sig == SIGINT) { + loop = false; + } } int main(int argc, char** argv) { signal(SIGINT, handler); @@ -65,10 +70,16 @@ int main(int argc, char** argv) { global_leak(); printf("press CTRL+C if you want to abort the program.\n"); sleep(3); + if (!loop) { + return 0; + } explicit_leak(); printf("press CTRL+C if you want to abort the program.\n"); sleep(3); + if (!loop) { + return 0; + } return 0; } diff --git a/trunk/research/gperftools/heap-profiler/heap_profiler.cc b/trunk/research/gperftools/heap-profiler/heap_profiler.cc index 6b9613e70..38774cfce 100644 --- a/trunk/research/gperftools/heap-profiler/heap_profiler.cc +++ b/trunk/research/gperftools/heap-profiler/heap_profiler.cc @@ -21,6 +21,7 @@ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /** +@see: http://google-perftools.googlecode.com/svn/trunk/doc/heapprofile.html config srs with gperf(to make gperftools): ./configure --with-gperf --jobs=3 set the pprof path if not set: