Functions
MemUsage.cxx File Reference
#include "WireCellUtil/MemUsage.h"
#include <unistd.h>
#include <sstream>

Go to the source code of this file.

Functions

static double memusage_linux_resident ()
 
static double memusage_linux_shared ()
 
static double memusage_linux_size ()
 

Function Documentation

static double memusage_linux_resident ( )
static

Definition at line 9 of file MemUsage.cxx.

9  {
10  int tSize = 0, resident = 0, share = 0;
11  ifstream buffer("/proc/self/statm");
12  buffer >> tSize >> resident >> share;
13  buffer.close();
14 
15  long page_size_kb = sysconf(_SC_PAGE_SIZE) / 1024; // in case x86-64 is configured to use 2MB pages
16  double rss = resident * page_size_kb;
17  return rss;
18 }
internal::basic_buffer< FMT_CHAR(S)> buffer
Definition: printf.h:757
static double memusage_linux_shared ( )
static

Definition at line 20 of file MemUsage.cxx.

20  {
21  int tSize = 0, resident = 0, share = 0;
22  ifstream buffer("/proc/self/statm");
23  buffer >> tSize >> resident >> share;
24  buffer.close();
25 
26  long page_size_kb = sysconf(_SC_PAGE_SIZE) / 1024; // in case x86-64 is configured to use 2MB pages
27  double shm = share * page_size_kb;
28  return shm;
29 }
internal::basic_buffer< FMT_CHAR(S)> buffer
Definition: printf.h:757
static double memusage_linux_size ( )
static

Definition at line 31 of file MemUsage.cxx.

31  {
32  int tSize = 0, resident = 0, share = 0;
33  ifstream buffer("/proc/self/statm");
34  buffer >> tSize >> resident >> share;
35  buffer.close();
36 
37  long page_size_kb = sysconf(_SC_PAGE_SIZE) / 1024; // in case x86-64 is configured to use 2MB pages
38  double siz = tSize * page_size_kb;
39  return siz;
40 }
internal::basic_buffer< FMT_CHAR(S)> buffer
Definition: printf.h:757