From c2548a5c429558ed504250fff2e4aa73b2137c80 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Mon, 19 Aug 2013 21:37:00 -0700 Subject: [PATCH] mon: add 'pg dump delta' to get just the rate info Still include it in the basic 'pg dump summary' info. Signed-off-by: Sage Weil --- src/mon/MonCommands.h | 2 +- src/mon/PGMap.cc | 13 +++++++++---- src/mon/PGMap.h | 1 + src/mon/PGMonitor.cc | 5 +++++ 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/mon/MonCommands.h b/src/mon/MonCommands.h index 8d85e03ed9967..ec1ee71c9e1c3 100644 --- a/src/mon/MonCommands.h +++ b/src/mon/MonCommands.h @@ -111,7 +111,7 @@ COMMAND("pg getmap", "get binary pg map to -o/stdout", "pg", "r", "cli,rest") COMMAND("pg send_pg_creates", "trigger pg creates to be issued",\ "pg", "rw", "cli,rest") COMMAND("pg dump " \ - "name=dumpcontents,type=CephChoices,strings=all|summary|sum|pools|osds|pgs|pgs_brief,n=N,req=false", \ + "name=dumpcontents,type=CephChoices,strings=all|summary|sum|delta|pools|osds|pgs|pgs_brief,n=N,req=false", \ "show human-readable versions of pg map", "pg", "r", "cli,rest") COMMAND("pg dump_json " \ "name=dumpcontents,type=CephChoices,strings=all|summary|sum|pools|osds|pgs,n=N,req=false", \ diff --git a/src/mon/PGMap.cc b/src/mon/PGMap.cc index 40d84e6a5a526..a6072d3f1cc8c 100644 --- a/src/mon/PGMap.cc +++ b/src/mon/PGMap.cc @@ -513,13 +513,18 @@ void PGMap::dump_basic(Formatter *f) const pg_sum.dump(f); f->close_section(); - f->open_object_section("pg_stats_delta"); - pg_sum_delta.dump(f); - f->close_section(); - f->open_object_section("osd_stats_sum"); osd_sum.dump(f); f->close_section(); + + dump_delta(f); +} + +void PGMap::dump_delta(Formatter *f) const +{ + f->open_object_section("pg_stats_delta"); + pg_sum_delta.dump(f); + f->close_section(); } void PGMap::dump_pg_stats(Formatter *f, bool brief) const diff --git a/src/mon/PGMap.h b/src/mon/PGMap.h index 00aa01ed07b4a..84d89f875175f 100644 --- a/src/mon/PGMap.h +++ b/src/mon/PGMap.h @@ -158,6 +158,7 @@ public: void dump_pg_stats(Formatter *f, bool brief) const; void dump_pool_stats(Formatter *f) const; void dump_osd_stats(Formatter *f) const; + void dump_delta(Formatter *f) const; void dump_pg_stats_plain(ostream& ss, const hash_map& pg_stats) const; diff --git a/src/mon/PGMonitor.cc b/src/mon/PGMonitor.cc index bb5f447a4e3b9..ff2d1fe4947af 100644 --- a/src/mon/PGMonitor.cc +++ b/src/mon/PGMonitor.cc @@ -1406,6 +1406,11 @@ bool PGMonitor::preprocess_command(MMonCommand *m) if (what.count("pgs_brief")) { pg_map.dump_pg_stats(f.get(), true); } + if (what.count("delta")) { + f->open_object_section("delta"); + pg_map.dump_delta(f.get()); + f->close_section(); + } } f->flush(ds); } else { -- 2.39.5