lgeneric_dout(this, 1) << "do_command '" << command << "' '" << args << "'" << dendl;
if (command == "perfcounters_dump" || command == "1" ||
command == "perf dump") {
- _perf_counters_collection->dump_formatted(f, *out, false);
+ _perf_counters_collection->dump_formatted(f, false);
}
else if (command == "perfcounters_schema" || command == "2" ||
command == "perf schema") {
- _perf_counters_collection->dump_formatted(f, *out, true);
+ _perf_counters_collection->dump_formatted(f, true);
}
else {
f->open_object_section(command.c_str());
assert(0 == "registered under wrong command?");
}
f->close_section();
- f->flush(*out);
}
+ f->flush(*out);
delete f;
lgeneric_dout(this, 1) << "do_command '" << command << "' '" << args << "' result is " << out->length() << " bytes" << dendl;
};
}
}
-void PerfCountersCollection::dump_formatted(Formatter *f, bufferlist &bl,
- bool schema)
+void PerfCountersCollection::dump_formatted(Formatter *f, bool schema)
{
Mutex::Locker lck(m_lock);
f->open_object_section("perfcounter_collection");
}
}
f->close_section();
- f->flush(bl);
}
// ---------------------------
void add(class PerfCounters *l);
void remove(class PerfCounters *l);
void clear();
- void dump_formatted(ceph::Formatter *f, bufferlist &bl, bool schema);
+ void dump_formatted(ceph::Formatter *f, bool schema);
private:
CephContext *m_cct;
format = "json-pretty";
Formatter *f = new_formatter(format);
if (command == "dump_ops_in_flight") {
- op_tracker.dump_ops_in_flight(f, ss);
+ op_tracker.dump_ops_in_flight(f);
} else if (command == "dump_historic_ops") {
- op_tracker.dump_historic_ops(f, ss);
+ op_tracker.dump_historic_ops(f);
} else if (command == "dump_op_pq_state") {
f->open_object_section("pq");
op_wq.dump(f);
f->close_section();
- f->flush(ss);
} else if (command == "dump_blacklist") {
list<pair<entity_addr_t,utime_t> > bl;
OSDMapRef curmap = service.get_osdmap();
f->close_section(); //entry
}
f->close_section(); //blacklist
- f->flush(ss);
} else if (command == "dump_watchers") {
list<obj_watch_item_t> watchers;
osd_lock.Lock();
}
f->close_section(); //watches
- f->flush(ss);
} else {
assert(0 == "broken asok registration");
}
+ f->flush(ss);
+ delete f;
return true;
}
f->close_section();
}
-void OpTracker::dump_historic_ops(Formatter *f, ostream &ss)
+void OpTracker::dump_historic_ops(Formatter *f)
{
Mutex::Locker locker(ops_in_flight_lock);
utime_t now = ceph_clock_now(g_ceph_context);
history.dump_ops(now, f);
- f->flush(ss);
}
-void OpTracker::dump_ops_in_flight(Formatter *f, ostream &ss)
+void OpTracker::dump_ops_in_flight(Formatter *f)
{
Mutex::Locker locker(ops_in_flight_lock);
f->open_object_section("ops_in_flight"); // overall dump
}
f->close_section(); // list of OpRequests
f->close_section(); // overall dump
- f->flush(ss);
}
void OpTracker::register_inflight_op(xlist<OpRequest*>::item *i)
public:
OpTracker() : seq(0), ops_in_flight_lock("OpTracker mutex") {}
- void dump_ops_in_flight(Formatter *f, std::ostream& ss);
- void dump_historic_ops(Formatter *f, std::ostream& ss);
+ void dump_ops_in_flight(Formatter *f);
+ void dump_historic_ops(Formatter *f);
void register_inflight_op(xlist<OpRequest*>::item *i);
void unregister_inflight_op(OpRequest *i);
void operator()(std::ostream *out) {
bufferlist bl;
Formatter *f = new_formatter("json-pretty");
- cct->get_perfcounters_collection()->dump_formatted(f, bl, 0);
+ cct->get_perfcounters_collection()->dump_formatted(f, 0);
+ f->flush(bl);
delete f;
bl.append('\0');
*out << bl.c_str() << std::endl;