17 # pragma warning( disable : 2259 ) 22 #if defined( __linux__ ) or defined( __APPLE__ ) 25 # include <sys/signal.h> 26 # include <sys/syscall.h> 28 # include <sys/procfs.h> 240 #endif // __linux__ or __APPLE__ 258 #if defined( __linux__ ) or defined( __APPLE__ ) 259 pg_size = sysconf( _SC_PAGESIZE );
265 cerr <<
"Failed to open " <<
fname << endl;
268 #endif // __linux__ or __APPLE__ 273 if (
valid ==
false )
return false;
275 #if defined( __linux__ ) or defined( __APPLE__ ) 276 double pr_size, pr_rssize;
280 fd.lseek( 0, SEEK_SET );
282 if ( ( cnt =
fd.read(
buf,
sizeof(
buf ) ) ) < 0 ) {
283 cout <<
"LINUX Read of Proc file failed:" << endl;
288 buf[
std::min( static_cast<std::size_t>( cnt ),
sizeof(
buf ) - 1 )] =
'\0';
293 "%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 " 294 "%lu %lu %lu %lu %lu %lu %lu",
303 pr_size = (double)pinfo.
vsize;
304 pr_rssize = (
double)pinfo.
rss;
306 f.
vsize = pr_size / ( 1024 * 1024 );
307 f.
rss = pr_rssize *
pg_size / ( 1024 * 1024 );
313 #endif // __linux__ or __APPLE__ 315 bool rc = (
curr == f ) ?
false :
true;
static ProcStats * instance()
unique_fd & open(Args &&... args)
unsigned long long starttime
bool fetch(procInfo &fill_me)