#include <errno.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include "CxxUtils/read_athena_statm.h"
Go to the source code of this file.
◆ read_athena_statm()
Definition at line 1 of file read_athena_statm.cxx.
   20     const char *
filename = 
"/proc/self/statm";
 
   24       strerror_r (errno, errbuf, 
sizeof(errbuf));
 
   26           "read_statm: problem opening file %s:\n%s\n", 
filename, errbuf);
 
   30     if (fscanf(
fd, 
"%80u %80u", &
res.vm_pages, &
res.rss_pages) < 2) {
 
   32           "read_statm: problem reading file %s:\n", 
filename);
 
   36     int pagesize = getpagesize();
 
   37     struct task_basic_info t_info;
 
   38     mach_msg_type_number_t t_info_count = TASK_BASIC_INFO_COUNT;
 
   39     if (KERN_SUCCESS == task_info(mach_task_self(),
 
   40       TASK_BASIC_INFO, (task_info_t)&t_info, &t_info_count)) {
 
   43       res.vm_pages  = t_info.virtual_size/pagesize;
 
   44       res.rss_pages = t_info.resident_size/pagesize;