virtual void get_db_statistics(Formatter *f) { }
virtual void generate_db_histogram(Formatter *f) { }
- virtual int flush_cache(ostream *os = NULL) { return 0; }
+ virtual int flush_cache(ostream *os = NULL) { return -1; }
virtual void dump_perf_counters(Formatter *f) {}
- virtual int get_cache_obj_count() {
- return -1;
- }
+ virtual void dump_cache_stats(Formatter *f) {}
+ virtual void dump_cache_stats(ostream& os) {}
virtual string get_type() = 0;
int _fsck(bool deep, bool repair);
void set_cache_shards(unsigned num) override;
- int get_cache_obj_count() {
- int count = 0;
+ void dump_cache_stats(Formatter *f) override {
+ int onode_count = 0, buffers_bytes = 0;
for (auto i: cache_shards) {
- count += i->_get_num_onodes();
+ onode_count += i->_get_num_onodes();
+ buffers_bytes += i->_get_buffer_bytes();
}
- return count;
+ f->dump_int("bluestore_onode", onode_count);
+ f->dump_int("bluestore_buffers", buffers_bytes);
+ }
+ void dump_cache_stats(ostream& ss) override {
+ int onode_count = 0, buffers_bytes = 0;
+ for (auto i: cache_shards) {
+ onode_count += i->_get_num_onodes();
+ buffers_bytes += i->_get_buffer_bytes();
+ }
+ ss << "bluestore_onode: " << onode_count;
+ ss << "bluestore_buffers: " << buffers_bytes;
}
int validate_hobject_key(const hobject_t &obj) const override {
COMMAND("drop cache",
"Drop all OSD caches",
"osd", "rw", "cli,rest")
-COMMAND("get_cache_object_count",
- "Get OSD caches object count",
+COMMAND("get cache stats",
+ "Get OSD caches statistics",
"osd", "r", "cli,rest")
};
}
}
- else if (prefix == "get_cache_object_count") {
- int store_cache_count = store->get_cache_obj_count();
+ else if (prefix == "get cache stats") {
int obj_ctx_count = 0;
int osd_map_count = service.map_cache.get_count();
vector<PGRef> pgs;
obj_ctx_count += pg->get_cache_obj_count();
}
if (f) {
- f->open_object_section("caches_object_count");
+ f->open_object_section("cache_stats");
f->dump_int("object_ctx", obj_ctx_count);
- f->dump_int("objectstore_onode", store_cache_count);
+ store->dump_cache_stats(f.get());
f->dump_int("osd_map", osd_map_count);
f->close_section();
f->flush(ds);
} else {
ds << "object_ctx: " << obj_ctx_count;
- ds << "objectstore_onode: " << store_cache_count;
+ store->dump_cache_stats(ds);
ds << "osd_map: " << osd_map_count;
}
}