7 #pragma warning( disable : 2259 ) 12 #if defined( __linux__ ) or defined( __APPLE__ ) 15 #include <sys/signal.h> 16 #include <sys/syscall.h> 18 #include <sys/procfs.h> 230 #endif // __linux__ or __APPLE__ 251 #if defined( __linux__ ) or defined( __APPLE__ ) 252 pg_size = sysconf( _SC_PAGESIZE );
258 cerr <<
"Failed to open " <<
fname << endl;
261 #endif // __linux__ or __APPLE__ 267 if (
valid ==
false )
return false;
269 #if defined( __linux__ ) or defined( __APPLE__ ) 270 double pr_size, pr_rssize;
274 fd.lseek( 0, SEEK_SET );
276 if ( ( cnt =
fd.read(
buf,
sizeof(
buf ) ) ) < 0 ) {
277 cout <<
"LINUX Read of Proc file failed:" << endl;
282 buf[
std::min( static_cast<std::size_t>( cnt ),
sizeof(
buf ) - 1 )] =
'\0';
287 "%d %s %c %d %d %d %d %d %lu %lu %lu %lu %lu %lu %lu %ld %ld %ld %ld %ld %ld %llu %lu %ld %lu %lu %lu %lu " 288 "%lu %lu %lu %lu %lu %lu %lu",
297 pr_size = (double)pinfo.
vsize;
298 pr_rssize = (
double)pinfo.
rss;
300 f.
vsize = pr_size / ( 1024 * 1024 );
301 f.
rss = pr_rssize *
pg_size / ( 1024 * 1024 );
307 #endif // __linux__ or __APPLE__ 309 bool rc = (
curr == f ) ?
false :
true;
static ProcStats * instance()
unique_fd & open(Args &&...args)
unsigned long long starttime
bool fetch(procInfo &fill_me)