summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Just <sam.just@inktank.com>2013-05-28 10:41:52 -0700
committerSamuel Just <sam.just@inktank.com>2013-05-28 10:41:52 -0700
commit4d53e9c9409eb512c2e6f326d28fe12f788daaa7 (patch)
treee6d8ac40f66298070b33f5945f1ded6cd1df3ebe
parent08c39b84308f17afef776e08c09be3faa2b9eab4 (diff)
downloadceph-4d53e9c9409eb512c2e6f326d28fe12f788daaa7.tar.gz
WBThrottle: add perfcounters
Signed-off-by: Samuel Just <sam.just@inktank.com>
-rw-r--r--src/os/WBThrottle.cc28
-rw-r--r--src/os/WBThrottle.h12
2 files changed, 40 insertions, 0 deletions
diff --git a/src/os/WBThrottle.cc b/src/os/WBThrottle.cc
index 24f7730c47f..12186445bc1 100644
--- a/src/os/WBThrottle.cc
+++ b/src/os/WBThrottle.cc
@@ -2,10 +2,12 @@
// vim: ts=8 sw=2 smarttab
#include "os/WBThrottle.h"
+#include "common/perf_counters.h"
WBThrottle::WBThrottle(CephContext *cct) :
cur_ios(0), cur_size(0),
cct(cct),
+ logger(NULL),
stopping(false),
lock("WBThrottle::lock", false, true, false, cct),
fs(XFS)
@@ -15,6 +17,20 @@ WBThrottle::WBThrottle(CephContext *cct) :
set_from_conf();
}
assert(cct);
+ PerfCountersBuilder b(
+ cct, string("WBThrottle"),
+ l_wbthrottle_first, l_wbthrottle_last);
+ b.add_u64(l_wbthrottle_bytes_dirtied, "bytes_dirtied");
+ b.add_u64(l_wbthrottle_bytes_wb, "bytes_wb");
+ b.add_u64(l_wbthrottle_ios_dirtied, "ios_dirtied");
+ b.add_u64(l_wbthrottle_ios_wb, "ios_wb");
+ b.add_u64(l_wbthrottle_inodes_dirtied, "inodes_dirtied");
+ b.add_u64(l_wbthrottle_inodes_wb, "inodes_wb");
+ logger = b.create_perf_counters();
+ cct->get_perfcounters_collection()->add(logger);
+ for (unsigned i = l_wbthrottle_first + 1; i != l_wbthrottle_last; ++i)
+ logger->set(i, 0);
+
cct->_conf->add_observer(this);
create();
}
@@ -27,6 +43,8 @@ WBThrottle::~WBThrottle() {
cond.Signal();
}
join();
+ cct->get_perfcounters_collection()->remove(logger);
+ delete logger;
cct->_conf->remove_observer(this);
}
@@ -133,7 +151,10 @@ void *WBThrottle::entry()
lock.Lock();
clearing = hobject_t();
cur_ios -= wb.get<2>().ios;
+ logger->dec(l_wbthrottle_ios_dirtied, wb.get<2>().ios);
cur_size -= wb.get<2>().size;
+ logger->dec(l_wbthrottle_bytes_dirtied, wb.get<2>().size);
+ logger->dec(l_wbthrottle_inodes_dirtied);
cond.Signal();
wb = boost::tuple<hobject_t, FDRef, PendingWB>();
}
@@ -153,12 +174,16 @@ void WBThrottle::queue_wb(
make_pair(
PendingWB(),
fd))).first;
+ logger->inc(l_wbthrottle_inodes_dirtied);
} else {
remove_object(hoid);
}
cur_ios++;
+ logger->inc(l_wbthrottle_ios_dirtied);
cur_size += len;
+ logger->inc(l_wbthrottle_bytes_dirtied, len);
+
wbiter->second.first.add(replica, len, 1);
insert_object(hoid);
cond.Signal();
@@ -172,7 +197,10 @@ void WBThrottle::clear()
i != pending_wbs.end();
++i) {
cur_ios -= i->second.first.ios;
+ logger->dec(l_wbthrottle_ios_dirtied, i->second.first.ios);
cur_size -= i->second.first.size;
+ logger->dec(l_wbthrottle_bytes_dirtied, i->second.first.size);
+ logger->dec(l_wbthrottle_inodes_dirtied);
}
pending_wbs.clear();
lru.clear();
diff --git a/src/os/WBThrottle.h b/src/os/WBThrottle.h
index 2ac7234bd44..a188855b268 100644
--- a/src/os/WBThrottle.h
+++ b/src/os/WBThrottle.h
@@ -26,6 +26,17 @@
#include "common/Thread.h"
#include "common/ceph_context.h"
+class PerfCounters;
+enum {
+ l_wbthrottle_first = 999090,
+ l_wbthrottle_bytes_dirtied,
+ l_wbthrottle_bytes_wb,
+ l_wbthrottle_ios_dirtied,
+ l_wbthrottle_ios_wb,
+ l_wbthrottle_inodes_dirtied,
+ l_wbthrottle_inodes_wb,
+ l_wbthrottle_last
+};
/**
* WBThrottle
@@ -65,6 +76,7 @@ class WBThrottle : Thread, public md_config_obs_t {
};
CephContext *cct;
+ PerfCounters *logger;
bool stopping;
Mutex lock;
Cond cond;