// 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)
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();
}
cond.Signal();
}
join();
+ cct->get_perfcounters_collection()->remove(logger);
+ delete logger;
cct->_conf->remove_observer(this);
}
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>();
}
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();
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();
#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
};
CephContext *cct;
+ PerfCounters *logger;
bool stopping;
Mutex lock;
Cond cond;