diff options
author | Greg Farnum <gregory.farnum@dreamhost.com> | 2011-03-03 01:18:45 +0100 |
---|---|---|
committer | Greg Farnum <gregory.farnum@dreamhost.com> | 2011-03-03 01:18:45 +0100 |
commit | f12e1a98fc94011e1a40f43ac014d115565862f8 (patch) | |
tree | 1b082486b6575ed4c6dc3f593642fd07329d98f0 /src/perfglue/heap_profiler.cc | |
parent | tcmalloc: create perfglue handle_command functionality. (diff) | |
download | ceph-f12e1a98fc94011e1a40f43ac014d115565862f8.tar.xz ceph-f12e1a98fc94011e1a40f43ac014d115565862f8.zip |
tcmalloc: warn if you try and dump without the profiler running.
Signed-off-by: Greg Farnum <gregory.farnum@dreamhost.com>
Diffstat (limited to 'src/perfglue/heap_profiler.cc')
-rw-r--r-- | src/perfglue/heap_profiler.cc | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/perfglue/heap_profiler.cc b/src/perfglue/heap_profiler.cc index 3c4d6f155b5..aead1cf89f0 100644 --- a/src/perfglue/heap_profiler.cc +++ b/src/perfglue/heap_profiler.cc @@ -79,11 +79,15 @@ void ceph_heap_profiler_handle_command(const std::vector<std::string>& cmd, LogClient &clog) { if (cmd.size() == 2 && cmd[1] == "dump") { - char *heap_stats = new char[1024]; - ceph_heap_profiler_stats(heap_stats, 1024); - clog.info() << g_conf.name << "dumping heap profile now.\n" - << heap_stats << std::endl; - ceph_heap_profiler_dump("admin request"); + if (!ceph_heap_profiler_running()) + clog.info() << "heap profiler not running; can't dump!\n"; + else { + char *heap_stats = new char[1024]; + ceph_heap_profiler_stats(heap_stats, 1024); + clog.info() << g_conf.name << "dumping heap profile now.\n" + << heap_stats << std::endl; + ceph_heap_profiler_dump("admin request"); + } } else if (cmd.size() == 2 && cmd[1] == "export_config") { char val[sizeof(int)*8+1]; snprintf(val, sizeof(val), "%i", g_conf.profiler_allocation_interval); |