| 521 | #pragma GCC pop_options |
| 522 | |
| 523 | int CephContext::_do_command( |
| 524 | std::string_view command, const cmdmap_t& cmdmap, |
| 525 | Formatter *f, |
| 526 | std::ostream& ss, |
| 527 | bufferlist *out) |
| 528 | { |
| 529 | int r = 0; |
| 530 | lgeneric_dout(this, 1) << "do_command '" << command << "' '" << cmdmap << "'" |
| 531 | << dendl; |
| 532 | ceph_assert_always(!(command == "assert" && _conf->debug_asok_assert_abort)); |
| 533 | if (command == "abort") { |
| 534 | if (_conf->debug_asok_assert_abort) { |
| 535 | ceph_abort(); |
| 536 | } else { |
| 537 | return -EPERM; |
| 538 | } |
| 539 | } |
| 540 | if (command == "leak_some_memory") { |
| 541 | leak_some_memory(); |
| 542 | } |
| 543 | else if (command == "perfcounters_dump" || command == "1" || |
| 544 | command == "perf dump") { |
| 545 | std::string logger; |
| 546 | std::string counter; |
| 547 | cmd_getval(cmdmap, "logger", logger); |
| 548 | cmd_getval(cmdmap, "counter", counter); |
| 549 | _perf_counters_collection->dump_formatted(f, false, select_labeled_t::unlabeled, |
| 550 | logger, counter); |
| 551 | } |
| 552 | else if (command == "perfcounters_schema" || command == "2" || |
| 553 | command == "perf schema") { |
| 554 | _perf_counters_collection->dump_formatted(f, true, select_labeled_t::unlabeled); |
| 555 | } |
| 556 | else if (command == "counter dump") { |
| 557 | _perf_counters_collection->dump_formatted(f, false, select_labeled_t::labeled); |
| 558 | } |
| 559 | else if (command == "counter schema") { |
| 560 | _perf_counters_collection->dump_formatted(f, true, select_labeled_t::labeled); |
| 561 | } |
| 562 | else if (command == "perf histogram dump") { |
| 563 | std::string logger; |
| 564 | std::string counter; |
| 565 | cmd_getval(cmdmap, "logger", logger); |
| 566 | cmd_getval(cmdmap, "counter", counter); |
| 567 | _perf_counters_collection->dump_formatted_histograms(f, false, logger, |
| 568 | counter); |
| 569 | } |
| 570 | else if (command == "perf histogram schema") { |
| 571 | _perf_counters_collection->dump_formatted_histograms(f, true); |
| 572 | } |
| 573 | else if (command == "perf reset") { |
| 574 | std::string var; |
| 575 | std::string section(command); |
| 576 | f->open_object_section(section.c_str()); |
| 577 | if (!cmd_getval(cmdmap, "var", var)) { |
| 578 | f->dump_string("error", "syntax error: 'perf reset <var>'"); |
| 579 | } else { |
| 580 | if(!_perf_counters_collection->reset(var)) |
nothing calls this directly
no test coverage detected