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__ 248 #if defined( __linux__ ) or defined( __APPLE__ ) 249 pg_size = sysconf( _SC_PAGESIZE );
255 cerr <<
"Failed to open " <<
fname << endl;
258 #endif // __linux__ or __APPLE__ 263 if (
valid ==
false )
return false;
265 #if defined( __linux__ ) or defined( __APPLE__ ) 266 double pr_size, pr_rssize;
270 fd.lseek( 0, SEEK_SET );
272 if ( ( cnt =
fd.read(
buf,
sizeof(
buf ) ) ) < 0 ) {
273 cout <<
"LINUX Read of Proc file failed:" << endl;
278 buf[
std::min( static_cast<std::size_t>( cnt ),
sizeof(
buf ) - 1 )] =
'\0';
283 "%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 " 284 "%lu %lu %lu %lu %lu %lu %lu",
293 pr_size = (double)pinfo.
vsize;
294 pr_rssize = (
double)pinfo.
rss;
296 f.
vsize = pr_size / ( 1024 * 1024 );
297 f.
rss = pr_rssize *
pg_size / ( 1024 * 1024 );
303 #endif // __linux__ or __APPLE__ 305 bool rc = (
curr == f ) ?
false :
true;
static ProcStats * instance()
unique_fd & open(Args &&...args)
unsigned long long starttime
bool fetch(procInfo &fill_me)