This helps tracking if/how effective is the CRC cache in bufferlists.
Signed-off-by: Piotr Dałek <piotr.dalek@corp.ovh.com>
static atomic_t buffer_cached_crc;
static atomic_t buffer_cached_crc_adjusted;
+ static atomic_t buffer_missed_crc;
static bool buffer_track_crc = get_env_bool("CEPH_BUFFER_TRACK");
void buffer::track_cached_crc(bool b) {
return buffer_cached_crc_adjusted.read();
}
+ int buffer::get_missed_crc() {
+ return buffer_missed_crc.read();
+ }
+
static atomic_t buffer_c_str_accesses;
static bool buffer_track_c_str = get_env_bool("CEPH_BUFFER_TRACK");
buffer_cached_crc_adjusted.inc();
}
} else {
+ if (buffer_track_crc)
+ buffer_missed_crc.inc();
uint32_t base = crc;
crc = ceph_crc32c(crc, (unsigned char*)it->c_str(), it->length());
r->set_crc(ofs, make_pair(base, crc));
int get_cached_crc();
/// count of cached crc hits (mismatching input, required adjustment)
int get_cached_crc_adjusted();
+ /// count of crc cache misses
+ int get_missed_crc();
/// enable/disable tracking of cached crcs
void track_cached_crc(bool b);
osd_plb.add_u64(
l_osd_cached_crc_adjusted, "cached_crc_adjusted",
"Total number getting crc from crc_cache with adjusting");
+ osd_plb.add_u64(l_osd_missed_crc, "missed_crc",
+ "Total number of crc cache misses");
osd_plb.add_u64(l_osd_pg, "numpg", "Placement groups",
"pgs", PerfCountersBuilder::PRIO_USEFUL);
logger->set(l_osd_history_alloc_num, buffer::get_history_alloc_num());
logger->set(l_osd_cached_crc, buffer::get_cached_crc());
logger->set(l_osd_cached_crc_adjusted, buffer::get_cached_crc_adjusted());
+ logger->set(l_osd_missed_crc, buffer::get_missed_crc());
// osd_lock is not being held, which means the OSD state
// might change when doing the monitor report
l_osd_history_alloc_num,
l_osd_cached_crc,
l_osd_cached_crc_adjusted,
+ l_osd_missed_crc,
l_osd_pg,
l_osd_pg_primary,