#endif
static atomic_t buffer_total_alloc;
+ static atomic64_t buffer_history_alloc_bytes;
+ static atomic64_t buffer_history_alloc_num;
const bool buffer_track_alloc = get_env_bool("CEPH_BUFFER_TRACK");
void buffer::inc_total_alloc(unsigned len) {
if (buffer_track_alloc)
buffer_total_alloc.sub(len);
}
+ void buffer::inc_history_alloc(uint64_t len) {
+ if (buffer_track_alloc) {
+ buffer_history_alloc_bytes.add(len);
+ buffer_history_alloc_num.inc();
+ }
+ }
int buffer::get_total_alloc() {
return buffer_total_alloc.read();
}
+ uint64_t buffer::get_history_alloc_bytes() {
+ return buffer_history_alloc_bytes.read();
+ }
+ uint64_t buffer::get_history_alloc_num() {
+ return buffer_history_alloc_num.read();
+ }
static atomic_t buffer_cached_crc;
static atomic_t buffer_cached_crc_adjusted;
data = 0;
}
inc_total_alloc(len);
+ inc_history_alloc(len);
bdout << "raw_malloc " << this << " alloc " << (void *)data << " " << l << " " << buffer::get_total_alloc() << bendl;
}
raw_malloc(unsigned l, char *b) : raw(b, l) {
if (!data)
throw bad_alloc();
inc_total_alloc(len);
+ inc_history_alloc(len);
bdout << "raw_mmap " << this << " alloc " << (void *)data << " " << l << " " << buffer::get_total_alloc() << bendl;
}
~raw_mmap_pages() {
if (!data)
throw bad_alloc();
inc_total_alloc(len);
+ inc_history_alloc(len);
bdout << "raw_posix_aligned " << this << " alloc " << (void *)data << " l=" << l << ", align=" << align << " total_alloc=" << buffer::get_total_alloc() << bendl;
}
~raw_posix_aligned() {
else
data = realdata;
inc_total_alloc(len+align-1);
+ inc_history_alloc(len+align-1);
//cout << "hack aligned " << (unsigned)data
//<< " in raw " << (unsigned)realdata
//<< " off " << off << std::endl;
}
inc_total_alloc(len);
+ inc_history_alloc(len);
bdout << "raw_pipe " << this << " alloc " << len << " "
<< buffer::get_total_alloc() << bendl;
}
else
data = 0;
inc_total_alloc(len);
+ inc_history_alloc(len);
bdout << "raw_char " << this << " alloc " << (void *)data << " " << l << " " << buffer::get_total_alloc() << bendl;
}
raw_char(unsigned l, char *b) : raw(b, l) {
/// total bytes allocated
static int get_total_alloc();
+ /// history total bytes allocated
+ static uint64_t get_history_alloc_bytes();
+
+ /// total num allocated
+ static uint64_t get_history_alloc_num();
+
/// enable/disable alloc tracking
static void track_alloc(bool b);
/* hack for memory utilization debugging. */
static void inc_total_alloc(unsigned len);
+ static void inc_history_alloc(uint64_t len);
static void dec_total_alloc(unsigned len);
/*
osd_plb.add_u64(l_osd_loadavg, "loadavg", "CPU load");
osd_plb.add_u64(l_osd_buf, "buffer_bytes", "Total allocated buffer size"); // total ceph::buffer bytes
+ osd_plb.add_u64(l_osd_history_alloc_bytes, "history_alloc_Mbytes"); // total ceph::buffer bytes in history
+ osd_plb.add_u64(l_osd_history_alloc_num, "history_alloc_num"); // total ceph::buffer num in history
osd_plb.add_u64(l_osd_pg, "numpg", "Placement groups"); // num pgs
osd_plb.add_u64(l_osd_pg_primary, "numpg_primary", "Placement groups for which this osd is primary"); // num primary pgs
dout(5) << "tick" << dendl;
logger->set(l_osd_buf, buffer::get_total_alloc());
+ logger->set(l_osd_history_alloc_bytes, SHIFT_ROUND_UP(buffer::get_history_alloc_bytes(), 20));
+ logger->set(l_osd_history_alloc_num, buffer::get_history_alloc_num());
if (is_active() || is_waiting_for_healthy()) {
map_lock.get_read();
dout(20) << "_dispatch " << m << " " << *m << dendl;
logger->set(l_osd_buf, buffer::get_total_alloc());
+ logger->set(l_osd_history_alloc_bytes, SHIFT_ROUND_UP(buffer::get_history_alloc_bytes(), 20));
+ logger->set(l_osd_history_alloc_num, buffer::get_history_alloc_num());
switch (m->get_type()) {
}
logger->set(l_osd_buf, buffer::get_total_alloc());
+ logger->set(l_osd_history_alloc_bytes, SHIFT_ROUND_UP(buffer::get_history_alloc_bytes(), 20));
+ logger->set(l_osd_history_alloc_num, buffer::get_history_alloc_num());
}
l_osd_loadavg,
l_osd_buf,
+ l_osd_history_alloc_bytes,
+ l_osd_history_alloc_num,
l_osd_pg,
l_osd_pg_primary,