ATLAS Offline Software
Classes | Functions
read_athena_statm.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  athena_statm
 

Functions

struct athena_statm read_athena_statm ()
 

Function Documentation

◆ read_athena_statm()

struct athena_statm read_athena_statm ( )

Definition at line 1 of file read_athena_statm.cxx.

16 {
17  struct athena_statm res = {0, 0};
18 #ifndef __APPLE__
19 
20  const char *filename = "/proc/self/statm";
21  FILE* fd = fopen(filename, "r");
22  if (0==fd) {
23  char errbuf[1024];
24  strerror_r (errno, errbuf, sizeof(errbuf));
25  fprintf(stderr,
26  "read_statm: problem opening file %s:\n%s\n", filename, errbuf);
27  return res;
28  }
29 
30  fscanf(fd, "%80u %80u", &res.vm_pages, &res.rss_pages);
31  fclose(fd);
32 #else
33  int pagesize = getpagesize();
34  struct task_basic_info t_info;
35  mach_msg_type_number_t t_info_count = TASK_BASIC_INFO_COUNT;
36  if (KERN_SUCCESS == task_info(mach_task_self(),
37  TASK_BASIC_INFO, (task_info_t)&t_info, &t_info_count)) {
38  // On the Mac, the virtual and resident sizes are returned in units of bytes
39  // whereas CoreDumpSvc expects them to be returned in units of pages
40  res.vm_pages = t_info.virtual_size/pagesize;
41  res.rss_pages = t_info.resident_size/pagesize;
42  }
43 #endif
44  return res;
45 }
get_generator_info.stderr
stderr
Definition: get_generator_info.py:40
res
std::pair< std::vector< unsigned int >, bool > res
Definition: JetGroupProductTest.cxx:14
ReadFromCoolCompare.fd
fd
Definition: ReadFromCoolCompare.py:196
athena_statm
Definition: read_athena_statm.h:13
CaloCellTimeCorrFiller.filename
filename
Definition: CaloCellTimeCorrFiller.py:24