LTI-Lib latest version v1.9 - last update 10 Apr 2010

lti::processInfo Class Reference

LTI-Lib process info class. More...

#include <ltiProcessInfo.h>

Inheritance diagram for lti::processInfo:
Inheritance graph
[legend]
Collaboration diagram for lti::processInfo:
Collaboration graph
[legend]

List of all members.

Classes

struct  procStatus
 system depended structure More...

Public Member Functions

 processInfo ()
virtual ~processInfo ()
virtual const char * getTypeName () const
int getUsedVirtualMemory ()
int getUsedCoreMemory ()
int getVirtualMemory ()
int getCoreMemory ()
int getFreeCoreMemory ()
int getBuffers ()
int getCachedMemory ()
int getFreeSwapMemory ()
int getFreeVirtualMemory ()
int getNumberOfCPUs ()
int * getProcessorClockRate ()
float getProcessorLoad ()
int getSizeOfK () const
void kEquals1024 ()
void kEquals1000 ()
std::string getHostname () const
std::string getUsername () const
long getPid () const

Detailed Description

LTI-Lib process info class.

An object of this class can be used among other things to get the amount of memory used by the process.

For MS Windows NT you will require the library Pdh.lib/pdh.dll available under: http://support.microsoft.com/default.aspx?scid=kb;en-us;Q284996 or search the Microsoft Knowledge Base for article "Q284996"


Constructor & Destructor Documentation

lti::processInfo::processInfo (  ) 

default constructor

virtual lti::processInfo::~processInfo (  )  [virtual]

destructor.


Member Function Documentation

int lti::processInfo::getBuffers (  ) 

Returns the amount of used buffers in kBytes.

In case of an error and in WinNT the function returns (-1)

int lti::processInfo::getCachedMemory (  ) 

Returns the amount of memory cached in kBytes.

In case of an error and in WinNT the function returns (-1)

int lti::processInfo::getCoreMemory (  ) 

Returns the amount of total available core memory in kBytes.

In case of an error the function returns (-1)

int lti::processInfo::getFreeCoreMemory (  ) 

Returns the amount of free core memory in kBytes.

In case of an error the function returns (-1)

int lti::processInfo::getFreeSwapMemory (  ) 

Returns the amount of free swap memory in kBytes.

In case of WinNT the function returns the free disk space available to the PageFile. In case of an error the function returns (-1)

int lti::processInfo::getFreeVirtualMemory (  ) 

Returns the amount of free virtual system memory in kBytes.

In case of an error the function returns (-1)

std::string lti::processInfo::getHostname (  )  const

Returns the name of the host this process is running on.

int lti::processInfo::getNumberOfCPUs (  ) 

Returns the number of CPUs in the measured system.

Uses the /proc/cpuinfo file in linux systems. In case of an error the function returns (0).

long lti::processInfo::getPid (  )  const

Returns the process ID of the current process/thread.

int* lti::processInfo::getProcessorClockRate (  ) 

Returns an array of the processor clock rates.

Uses the /proc/cpuinfo file in linux systems. In WinNT the function returns clock rate only for systems with one processor

float lti::processInfo::getProcessorLoad (  ) 

Returns the ProcessorLoad of the last minute.

Uses the /proc/loadavg file in linux systems. In case of an error the function returns (-1). In case of WinNT calling Win32 API routine, you may need to specify its library in Project..Settings..Link..Object/Library Modules. here: Pdh.lib and you also need Pdh.dll

int lti::processInfo::getSizeOfK (  )  const [inline]

Return the actual meaning of "k" (1000 or 1024).

virtual const char* lti::processInfo::getTypeName (  )  const [virtual]

returns the name of this type

Reimplemented from lti::object.

int lti::processInfo::getUsedCoreMemory (  ) 

Returns the amount of core memory.

What this means, differs depending on the OS. In Unix, it really is the amount of physical RAM that is occupied by this process. In WinNT, it is the size of the working set, which may be larger than the allocated pagefile segment. It is not quite clear what the term "working set" in windows actually means. One document states that it is the amount of physical RAM the process occupies. Another document states that it is the average amount of memory the process accesses without causing a page fault. So, in WinNT, the result of this function is best interpreted as a guess.

int lti::processInfo::getUsedVirtualMemory (  ) 

Returns the amount of virtual memory used by this process in kBytes.

The actual meaning of this value depends on the operating system: In Unix-like OSs it really means the total amount of virtual memory allocated to this process. In WinNT, it means the size of the page file fragment that has been reserved to the process.

std::string lti::processInfo::getUsername (  )  const

Returns the user ID of the user that has started the process.

int lti::processInfo::getVirtualMemory (  ) 

Returns the amount of total available virtual memory in kBytes.

In case of an error the function returns (-1)

void lti::processInfo::kEquals1000 (  )  [inline]

Set the meaning of "k" as 10^3.

void lti::processInfo::kEquals1024 (  )  [inline]

Set the meaning of "k" as 1024 (2^10).


The documentation for this class was generated from the following file:

Generated on Sat Apr 10 15:28:52 2010 for LTI-Lib by Doxygen 1.6.1