CARMA C++
VmSize.h
Go to the documentation of this file.
1 #ifndef CARMA_UTIL_VMSIZE_H
2 #define CARMA_UTIL_VMSIZE_H
3 
14 #include <fstream>
15 #include <sstream>
16 
17 #include <unistd.h>
18 
19 
20 namespace carma {
21  namespace util {
22 
23 
31 class VmSize {
32 public:
38  VmSize();
45  VmSize(pid_t pid);
49  void refresh();
53  int getSizeKB();
58  double getSizeHuman();
64  std::string getUnitsHuman();
72  std::string getStringHuman(int precision = 2);
73 private:
74  pid_t pid_;
75  int vmsize_; //KB
76 };
77 
78 } } // End namespace carma::util
79 
80 
81 #endif // CARMA_UTIL_VMSIZE_H
std::string getUnitsHuman()
Returns the human readable units for last measured size.
int getSizeKB()
Returns the last measured size, in KB.
std::string getStringHuman(int precision=2)
Returns a string with size and units in human readable units for last measured vm size...
VmSize()
Default constructor; vmsize for current process.
void refresh()
Get the current VM size for the process specified in the constructor.
double getSizeHuman()
Returns last measured size, in human readable units.
Class to get virtual memory size of a process.
Definition: VmSize.h:31