#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 fscanf(
fd,
"%80u %80u", &
res.vm_pages, &
res.rss_pages);
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)) {
40 res.vm_pages = t_info.virtual_size/pagesize;
41 res.rss_pages = t_info.resident_size/pagesize;