endif(GPERFTOOLS_FOUND)
endif(ALLOCATOR)
-# jemalloc does not support mallinfo
-if(NOT JEMALLOC_FOUND)
- CHECK_FUNCTION_EXISTS(mallinfo HAVE_MALLINFO)
-endif()
if(WITH_LIBCEPHFS OR WITH_KRBD)
find_package(keyutils REQUIRED)
ldout(cct, 0) << "check_memory_usage unable to open /proc/self/status" << dendl;
return;
}
-
while (!f.eof()) {
string line;
getline(f, line);
if (strncmp(line.c_str(), "VmSize:", 7) == 0)
- psnap->size = atoi(line.c_str() + 7);
+ psnap->size = atol(line.c_str() + 7);
else if (strncmp(line.c_str(), "VmRSS:", 6) == 0)
- psnap->rss = atoi(line.c_str() + 7);
+ psnap->rss = atol(line.c_str() + 7);
else if (strncmp(line.c_str(), "VmHWM:", 6) == 0)
- psnap->hwm = atoi(line.c_str() + 7);
+ psnap->hwm = atol(line.c_str() + 7);
else if (strncmp(line.c_str(), "VmLib:", 6) == 0)
- psnap->lib = atoi(line.c_str() + 7);
+ psnap->lib = atol(line.c_str() + 7);
else if (strncmp(line.c_str(), "VmPeak:", 7) == 0)
- psnap->peak = atoi(line.c_str() + 7);
+ psnap->peak = atol(line.c_str() + 7);
else if (strncmp(line.c_str(), "VmData:", 7) == 0)
- psnap->data = atoi(line.c_str() + 7);
+ psnap->data = atol(line.c_str() + 7);
}
f.close();
return;
}
- int heap = 0;
+ long heap = 0;
while (f.is_open() && !f.eof()) {
string line;
getline(f, line);
if (*end)
end++;
- int size = ae - as;
+ long size = ae - as;
//ldout(cct, 0) << "size " << size << " mode is '" << mode << "' end is '" << end << "'" << dendl;
/*
psnap->heap = heap >> 10;
- // ...
-#if defined(HAVE_MALLINFO)
- struct mallinfo mi = mallinfo();
-
- psnap->malloc = mi.uordblks >> 10;
- psnap->mmap = mi.hblks >> 10;
-#else
-#warning "mallinfo not implemented"
-#endif
}
class MemoryModel {
public:
struct snap {
- int peak;
- int size;
- int hwm;
- int rss;
- int data;
- int lib;
+ long peak;
+ long size;
+ long hwm;
+ long rss;
+ long data;
+ long lib;
- int heap, malloc, mmap;
+ long heap;
snap() : peak(0), size(0), hwm(0), rss(0), data(0), lib(0),
- heap(0), malloc(0), mmap(0)
+ heap(0)
{}
- int get_total() { return size; }
- int get_rss() { return rss; }
- int get_heap() { return heap; }
+ long get_total() { return size; }
+ long get_rss() { return rss; }
+ long get_heap() { return heap; }
} last;
private:
<< " total " << last.get_total()
<< ", rss " << last.get_rss()
<< ", heap " << last.get_heap()
- << ", malloc " << last.malloc << " mmap " << last.mmap
<< ", baseline " << baseline.get_heap()
<< ", buffers " << (buffer::get_total_alloc() >> 10)
<< ", " << num_inodes_with_caps << " / " << inode_map.size() << " inodes have caps"
mds->mlogger->set(l_mdm_rss, last.get_rss());
mds->mlogger->set(l_mdm_heap, last.get_heap());
- mds->mlogger->set(l_mdm_malloc, last.malloc);
if (num_inodes_with_caps > g_conf->mds_cache_size) {
float ratio = (float)g_conf->mds_cache_size * .9 / (float)num_inodes_with_caps;
mdm_plb.add_u64_counter(l_mdm_caps, "cap-", "Capabilities removed");
mdm_plb.add_u64(l_mdm_rss, "rss", "RSS");
mdm_plb.add_u64(l_mdm_heap, "heap", "Heap size");
- mdm_plb.add_u64(l_mdm_malloc, "malloc", "Malloc size");
mdm_plb.add_u64(l_mdm_buf, "buf", "Buffer size");
mlogger = mdm_plb.create_perf_counters();
g_ceph_context->get_perfcounters_collection()->add(mlogger);
l_mdm_caps,
l_mdm_rss,
l_mdm_heap,
- l_mdm_malloc,
l_mdm_buf,
l_mdm_last,
};