summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Just <sam.just@inktank.com>2013-08-13 20:32:14 -0700
committerSamuel Just <sam.just@inktank.com>2013-08-14 15:31:44 -0700
commit94c3f29a32cbf169d896015da6765febd3c724e0 (patch)
tree34491f73d416978a5a01c44cf6eaee5a114c1375
parentebde89d5602536b4bc651737e4280fdfb6634c32 (diff)
downloadceph-94c3f29a32cbf169d896015da6765febd3c724e0.tar.gz
OSDMonitor: add 'osd perf' command to dump recent osd perf information
Signed-off-by: Samuel Just <sam.just@inktank.com>
-rw-r--r--src/Makefile.am3
-rw-r--r--src/mon/MonCommands.h5
-rw-r--r--src/mon/OSDMonitor.cc14
-rw-r--r--src/mon/PGMap.cc35
-rw-r--r--src/mon/PGMap.h3
5 files changed, 58 insertions, 2 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index a9bbde32686..f2d2bec50f6 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1615,7 +1615,8 @@ libmon_a_SOURCES = \
mon/HealthMonitor.cc \
mon/DataHealthService.cc \
mon/ConfigKeyService.cc \
- common/util.cc
+ common/util.cc \
+ common/TextTable.cc
libmon_a_CXXFLAGS= ${AM_CXXFLAGS}
noinst_LIBRARIES += libmon.a
diff --git a/src/mon/MonCommands.h b/src/mon/MonCommands.h
index 8e9c2bb333b..e4cb9ce45ed 100644
--- a/src/mon/MonCommands.h
+++ b/src/mon/MonCommands.h
@@ -325,6 +325,11 @@ COMMAND("osd getmap " \
COMMAND("osd getcrushmap " \
"name=epoch,type=CephInt,range=0,req=false", \
"get CRUSH map", "osd", "r", "cli,rest")
+COMMAND("osd perf", \
+ "print dump of OSD perf summary stats", \
+ "osd", \
+ "r", \
+ "cli,rest")
COMMAND("osd getmaxosd", "show largest OSD id", "osd", "r", "cli,rest")
COMMAND("osd find " \
"name=id,type=CephInt,range=0", \
diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc
index 07022aec73b..07199ad19d3 100644
--- a/src/mon/OSDMonitor.cc
+++ b/src/mon/OSDMonitor.cc
@@ -1974,7 +1974,8 @@ bool OSDMonitor::preprocess_command(MMonCommand *m)
prefix == "osd tree" ||
prefix == "osd ls" ||
prefix == "osd getmap" ||
- prefix == "osd getcrushmap") {
+ prefix == "osd getcrushmap" ||
+ prefix == "osd perf") {
string val;
epoch_t epoch = 0;
@@ -2046,6 +2047,17 @@ bool OSDMonitor::preprocess_command(MMonCommand *m)
} else if (prefix == "osd getcrushmap") {
p->crush->encode(rdata);
ss << "got crush map from osdmap epoch " << p->get_epoch();
+ } else if (prefix == "osd perf") {
+ const PGMap &pgm = mon->pgmon()->pg_map;
+ if (f) {
+ f->open_object_section("osdstats");
+ pgm.dump_osd_perf_stats(f.get());
+ f->close_section();
+ f->flush(ds);
+ } else {
+ pgm.print_osd_perf_stats(&ds);
+ }
+ rdata.append(ds);
}
if (p != &osdmap)
delete p;
diff --git a/src/mon/PGMap.cc b/src/mon/PGMap.cc
index f6b88fcbfe0..9da4bbc71d9 100644
--- a/src/mon/PGMap.cc
+++ b/src/mon/PGMap.cc
@@ -5,6 +5,7 @@
#define dout_subsys ceph_subsys_mon
#include "common/debug.h"
+#include "common/TextTable.h"
#include "include/stringify.h"
#include "common/Formatter.h"
#include "include/ceph_features.h"
@@ -698,6 +699,40 @@ void PGMap::dump_stuck_plain(ostream& ss, PGMap::StuckPG type, utime_t cutoff) c
dump_pg_stats_plain(ss, stuck_pg_stats);
}
+void PGMap::dump_osd_perf_stats(Formatter *f) const
+{
+ f->open_array_section("osd_perf_infos");
+ for (hash_map<int32_t, osd_stat_t>::const_iterator i = osd_stat.begin();
+ i != osd_stat.end();
+ ++i) {
+ f->open_object_section("osd");
+ f->dump_int("id", i->first);
+ {
+ f->open_object_section("perf_stats");
+ i->second.fs_perf_stat.dump(f);
+ f->close_section();
+ }
+ f->close_section();
+ }
+ f->close_section();
+}
+void PGMap::print_osd_perf_stats(std::ostream *ss) const
+{
+ TextTable tab;
+ tab.define_column("osdid", TextTable::LEFT, TextTable::RIGHT);
+ tab.define_column("fs_commit_latency(ms)", TextTable::LEFT, TextTable::RIGHT);
+ tab.define_column("fs_apply_latency(ms)", TextTable::LEFT, TextTable::RIGHT);
+ for (hash_map<int32_t, osd_stat_t>::const_iterator i = osd_stat.begin();
+ i != osd_stat.end();
+ ++i) {
+ tab << i->first;
+ tab << i->second.fs_perf_stat.filestore_commit_latency;
+ tab << i->second.fs_perf_stat.filestore_apply_latency;
+ tab << TextTable::endrow;
+ }
+ (*ss) << tab;
+}
+
void PGMap::recovery_summary(Formatter *f, ostream *out) const
{
bool first = true;
diff --git a/src/mon/PGMap.h b/src/mon/PGMap.h
index e59d1b81a20..465531335d3 100644
--- a/src/mon/PGMap.h
+++ b/src/mon/PGMap.h
@@ -168,6 +168,9 @@ public:
void dump(ostream& ss) const;
+ void dump_osd_perf_stats(Formatter *f) const;
+ void print_osd_perf_stats(std::ostream *ss) const;
+
void recovery_summary(Formatter *f, ostream *out) const;
void print_summary(Formatter *f, ostream *out) const;