35#if ( defined(__MACH__) && defined(__clang__) && defined(__x86_64__) ) || \
36 ( defined(__MACH__) && defined(__GNUC__) && __GNUC__>=4 && __GNUC_MINOR__>=7 ) || \
37 defined(__linux__) || defined(_AIX)
59#if ( defined(__MACH__) && defined(__clang__) && defined(__x86_64__) ) || \
60 ( defined(__MACH__) && defined(__GNUC__) && __GNUC__>=4 && __GNUC_MINOR__>=7 ) || \
61 defined(__linux__) || defined(_AIX)
65 ifstream stat_stream(
"/proc/self/stat", ios_base::in);
69 string pid, comm, state, ppid, pgrp, session, tty_nr;
70 string tpgid, flags, minflt, cminflt, majflt, cmajflt;
71 string utime, stime, cutime, cstime, priority, nice;
72 string O, itrealvalue, starttime;
79 stat_stream >> pid >> comm >> state >> ppid >> pgrp >> session >> tty_nr
80 >> tpgid >> flags >> minflt >> cminflt >> majflt >> cmajflt >> utime
81 >> stime >> cutime >> cstime >> priority >> nice >> O >> itrealvalue
82 >> starttime >> vsize >> rss;
86 long page_size_kb = sysconf(_SC_PAGE_SIZE) / 1024;
87 output.
vmz = vsize / 1024.0;
88 output.
mem = rss * page_size_kb;
96 return os <<
"( vmz: " << memStat.
vmz <<
", " <<
"mem: " << memStat.
mem
std::ostream & operator<<(std::ostream &os, const MemStat &p)