10 int tSize = 0, resident = 0, share = 0;
11 ifstream
buffer(
"/proc/self/statm");
12 buffer >> tSize >> resident >> share;
15 long page_size_kb = sysconf(_SC_PAGE_SIZE) / 1024;
16 double rss = resident * page_size_kb;
21 int tSize = 0, resident = 0, share = 0;
22 ifstream
buffer(
"/proc/self/statm");
23 buffer >> tSize >> resident >> share;
26 long page_size_kb = sysconf(_SC_PAGE_SIZE) / 1024;
27 double shm = share * page_size_kb;
32 int tSize = 0, resident = 0, share = 0;
33 ifstream
buffer(
"/proc/self/statm");
34 buffer >> tSize >> resident >> share;
37 long page_size_kb = sysconf(_SC_PAGE_SIZE) / 1024;
38 double siz = tSize * page_size_kb;
81 if (mu.first < 0 && mu.second < 0) {
84 m_events.push_back(
event(mu,msg));
96 while (ind < 0) { ind += m_events.size();}
104 for (
size_t ind=0; ind<m_events.size(); ++ind) {
105 ss << this->emit(ind) <<
"\n";
112 while (ind < 0) { ind += m_events.size();}
113 int prev_ind = ind-1;
114 if (prev_ind<0) prev_ind=0;
116 const memusage& prev_mem = (*this)[prev_ind].first;
117 const memusage& evt_mem = (*this)[ind].first;
118 const string& evt_msg = (*this)[ind].second;
120 memusage from_prev(evt_mem.first - prev_mem.first, evt_mem.second - prev_mem.second);
123 ss <<
"MEM: total: size=" << evt_mem.first <<
"K, res=" << evt_mem.second <<
"K " 124 <<
"increment: size=" << from_prev.first <<
"K, res=" << from_prev.second <<
"K "
void msg(const char *fmt,...)
static double memusage_linux_size()
internal::basic_buffer< FMT_CHAR(S)> buffer
std::pair< memusage, std::string > event
static double memusage_linux_shared()
double memusage_resident()
std::pair< double, double > memusage
static double memusage_linux_resident()