diff options
author | Joao Eduardo Luis <jecluis@gmail.com> | 2013-09-20 16:41:14 +0100 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2013-09-24 09:02:32 -0700 |
commit | 46dcc46617d8f35ab8433540b22343ddcbcc3716 (patch) | |
tree | ce04e020aff2595c291197a49e2b701fd34c89b6 | |
parent | 9dc5f15fbae22244ad1f62925e17c9d81e856e55 (diff) | |
download | ceph-46dcc46617d8f35ab8433540b22343ddcbcc3716.tar.gz |
perfglue/heap_profiler.cc: expect args as first element on cmd vector
We used to pass 'heap' as the first element of the cmd vector when
handling commands. We haven't been doing so for a while now, so we
needed to fix this.
Not expecting 'heap' also makes sense, considering that what we need to
know when we reach this function is what command we should handle, and
we should not care what the caller calls us when handling his business.
Fixes: #6361
Backport: dumpling
Signed-off-by: Joao Eduardo Luis <jecluis@gmail.com>
(cherry picked from commit c98b910d49bd2b46ceafdc430044a31524c29f5b)
-rw-r--r-- | src/perfglue/heap_profiler.cc | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/perfglue/heap_profiler.cc b/src/perfglue/heap_profiler.cc index 550f7f924c6..6b079b865fa 100644 --- a/src/perfglue/heap_profiler.cc +++ b/src/perfglue/heap_profiler.cc @@ -88,7 +88,7 @@ void ceph_heap_profiler_dump(const char *reason) void ceph_heap_profiler_handle_command(const std::vector<std::string>& cmd, ostream& out) { - if (cmd.size() == 2 && cmd[1] == "dump") { + if (cmd.size() == 1 && cmd[0] == "dump") { if (!ceph_heap_profiler_running()) { out << "heap profiler not running; can't dump"; return; @@ -98,16 +98,16 @@ void ceph_heap_profiler_handle_command(const std::vector<std::string>& cmd, out << g_conf->name << "dumping heap profile now.\n" << heap_stats; ceph_heap_profiler_dump("admin request"); - } else if (cmd.size() == 2 && cmd[1] == "start_profiler") { + } else if (cmd.size() == 1 && cmd[0] == "start_profiler") { ceph_heap_profiler_start(); out << g_conf->name << " started profiler"; - } else if (cmd.size() == 2 && cmd[1] == "stop_profiler") { + } else if (cmd.size() == 1 && cmd[0] == "stop_profiler") { ceph_heap_profiler_stop(); out << g_conf->name << " stopped profiler"; - } else if (cmd.size() == 2 && cmd[1] == "release") { + } else if (cmd.size() == 1 && cmd[0] == "release") { ceph_heap_release_free_memory(); out << g_conf->name << " releasing free RAM back to system."; - } else if (cmd.size() == 2 && cmd[1] == "stats") { + } else if (cmd.size() == 1 && cmd[0] == "stats") { char *heap_stats = new char[1024]; ceph_heap_profiler_stats(heap_stats, 1024); out << g_conf->name << "tcmalloc heap stats:" |