class uvMemInfo

This Class provides process memory information. More...

Definition#include <uvgetprocessinfo.h>
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Methods

Public Members

Protected Methods


Detailed Description

This Class provides process memory information.

The method investigates the /proc/PID/statm file and fills an array with different information. The following paragraph gives an overview over the provided information.


    enum mem_t   { total=0,
                   resident=1,
                   shared=2,
                   code=3,
                   data_stack=4,
                   library=5,
                   dirty=6
                 };

    typedef struct
        {
          long cont[MAXMEM];
        } meminfo;

    typedef struct
        {
          meminfo actual, average, max;
        } memx;

    enum mem_t memtype;
    memx mInfo;


Actual provides the last read entry, while average averages all read values and max calculates the maximum read values.

enum mem_t memtype

memtype

memx mInfo

mInfo

bool  getState ( )

getState

returns, whether the proc file is open (found) or not.

Returns: false, if not open, true otherwise.

bool  fillMemInfo ( )

fillMemInfo

fills the array (actual, average and max). Note : average is not yet supported.

Returns: false, if not successfull, true otherwise.

void  closeProcFiles ( )

closeProcFiles

closes all open proc files.

Returns: false, if not successfull, true otherwise.

bool  diffMemInfo ()

diffMemInfo

checks, wether the last read values has been different. This is used for diff measurement.

Returns: false, if not different, true otherwise.

 uvMemInfo ( int pid, int pagesize )

uvMemInfo

constructor

pid : the pid to investigate. pagesize : the pagesize for memory usage calculation.

 ~uvMemInfo ()

~uvMemInfo

destructor

The destructor closes all open files and free memory allocated.

bool  openProcFiles ( )

openProcFiles

[protected]

opens all open proc files (at the momenmt only /proc/PID/statm).

Returns: false, if not successfull, true otherwise.

void  getLineInfo ( char *line )

getLineInfo

[protected]

parses the procfile line and fills the actual values of the array.

void  getAverageInfo ( int cnt )

getAverageInfo

[protected]

calculates the average values.

void  getMaxInfo ( )

getMaxInfo

[protected]

calculates the maximal values.

void  saveMemInfo ()

saveMemInfo

[protected]

save all values for diffence decision.