mirror of
https://github.com/ceph/ceph
synced 2025-03-11 02:39:05 +00:00
Merge pull request #612 from ceph/wip-6361
perfglue/heapprofiler: expect cmd name when handling command instead of 'heap <cmd>' This was broken by the cli rework. Reviewed-by: Samuel Just <sam.just@inktank.com>
This commit is contained in:
commit
3c64784e3f
@ -334,4 +334,11 @@ ceph pg set_full_ratio 95 2>$TMPFILE; check_response $? 22 'not in range'
|
||||
# expect "not in range" for invalid overload percentage
|
||||
ceph osd reweight-by-utilization 80 2>$TMPFILE; check_response $? 22 'not in range'
|
||||
|
||||
# expect 'heap' commands to be correctly parsed
|
||||
ceph heap stats
|
||||
ceph heap start_profiler
|
||||
ceph heap dump
|
||||
ceph heap stop_profiler
|
||||
ceph heap release
|
||||
|
||||
echo OK
|
||||
|
@ -800,7 +800,9 @@ void MDS::handle_command(MMonCommand *m)
|
||||
clog.info() << "tcmalloc not enabled, can't use heap profiler commands\n";
|
||||
else {
|
||||
ostringstream ss;
|
||||
ceph_heap_profiler_handle_command(m->cmd, ss);
|
||||
vector<std::string> cmdargs;
|
||||
cmdargs.insert(cmdargs.begin(), m->cmd.begin()+1, m->cmd.end());
|
||||
ceph_heap_profiler_handle_command(cmdargs, ss);
|
||||
clog.info() << ss.str();
|
||||
}
|
||||
} else dout(0) << "unrecognized command! " << m->cmd << dendl;
|
||||
|
@ -3948,6 +3948,10 @@ COMMAND("bench " \
|
||||
"(default 1G size 4MB). Results in log.",
|
||||
"osd", "rw", "cli,rest")
|
||||
COMMAND("flush_pg_stats", "flush pg stats", "osd", "rw", "cli,rest")
|
||||
COMMAND("heap " \
|
||||
"name=heapcmd,type=CephChoices,strings=dump|start_profiler|stop_profiler|release|stats", \
|
||||
"show heap usage info (available only if compiled with tcmalloc)", \
|
||||
"osd", "rw", "cli,rest")
|
||||
COMMAND("debug_dump_missing " \
|
||||
"name=filename,type=CephFilepath",
|
||||
"dump missing objects to a named file", "osd", "r", "cli,rest")
|
||||
|
@ -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:"
|
||||
|
Loading…
Reference in New Issue
Block a user