ALib C++ Library
Library Version: 2312 R0
Documentation generated by doxygen
Public Fields | Public Static Methods | Public Methods | Protected Static Fields | Protected Methods | List of all members
ProcessInfo Class Reference

#include <processinfo.hpp>

Collaboration diagram for ProcessInfo:
[legend]

Class Description


This class represents process information

Definition at line 22 of file processinfo.hpp.

Public Fields

AString CmdLine
 
AString ConsoleTitle
 
AString ExecFileName
 
AString ExecFilePath
 
AString Name
 
uinteger PID
 
uinteger PPID
 
AString Stat
 
AString StatPGRP
 
AString StatState
 

Public Static Methods

static const ALIB_API ProcessInfoCurrent ()
 

Public Methods

 ProcessInfo (uinteger processID)
 
ALIB_API bool Get (uinteger processID)
 

Protected Static Fields

static ALIB_API ProcessInfo current
 

Protected Methods

 ProcessInfo ()
 
ALIB_API bool get (uinteger PID)
 
bool getStatField (int fieldNo, AString &target)
 

Constructor & Destructor Documentation

◆ ProcessInfo() [1/2]

ProcessInfo ( )
inlineprotected

Default constructor to create an empty instance

Definition at line 95 of file processinfo.hpp.

◆ ProcessInfo() [2/2]

ProcessInfo ( uinteger  processID)
inline

Constructor that initializes this instance according to the process information received from the system.

Note
This method is implemented for Unix like OS (incl. Mac OS) only. On Windows OS, only information about the current process can be received using static method Current.
Parameters
processIDThe ID of the process information is requested on. If a nulled string is provided, the current process is addressed.

Definition at line 136 of file processinfo.hpp.

Here is the call graph for this function:

Member Function Documentation

◆ Current()

const ProcessInfo & Current ( )
static

Static method that receives information on the current process.

Returns
A constant reference to a ProcessInfo object representing the current process.

Definition at line 51 of file processinfo.cpp.

Here is the call graph for this function:

◆ get()

bool get ( uinteger  PID)
protected

Internal get() method with different platform implementations.

Parameters
PIDThe ID of the process information is requested on. If a nulled string is provided, the current process is addressed.
Returns
true on success, false otherwise.

Definition at line 207 of file processinfo.cpp.

Here is the call graph for this function:

◆ Get()

ALIB_API bool Get ( uinteger  processID)
inline

Fills the fields of this instance according to the process information received from the system.

Note
This method is implemented for Unix like OS (incl. Mac OS) only. On Windows OS, only information about the current process can be received using static method Current.
Parameters
processIDThe ID of the process information is requested on. If a nulled string is provided, the current process is addressed.
Returns
true on success, false otherwise.

Definition at line 153 of file processinfo.hpp.

Here is the call graph for this function:

◆ getStatField()

bool getStatField ( int  fieldNo,
AString target 
)
protected

Reads a field from the data found in /proc/PID/stat.

Parameters
fieldNoThe field number to read
targetThe variable to store the result in
Returns
true if successful.

Member Data Documentation

◆ CmdLine

AString CmdLine

The command line which invoked this process.

Definition at line 37 of file processinfo.hpp.

◆ ConsoleTitle

AString ConsoleTitle

For console processes, this is the title displayed in the title bar. (Windows OS only.)

Definition at line 84 of file processinfo.hpp.

◆ current

ProcessInfo current
staticprotected

Information on the current process. This is initialized once, with the first invocation of Current.

Definition at line 30 of file processinfo.hpp.

◆ ExecFileName

AString ExecFileName

The file name of the executable (excluding ExecFilePath). Under GNU/Linux, if we have no access to read that value, field ExecFilePath will be empty while this field is filled with Name.

Definition at line 50 of file processinfo.hpp.

◆ ExecFilePath

AString ExecFilePath

The path of the executable (if available to us).

Definition at line 44 of file processinfo.hpp.

◆ Name

AString Name

The name of the process.
Under GNU/Linux this is read from /proc/nnn/stat and may differ from ExecFileName. Under Windows OS, it is he same as field ExecFileName.

Definition at line 41 of file processinfo.hpp.

◆ PID

uinteger PID

The process id as AString.

Definition at line 34 of file processinfo.hpp.

◆ PPID

uinteger PPID

The parent's process id as AString. (Unix like OS / Mac OS only.)

Definition at line 58 of file processinfo.hpp.

◆ Stat

AString Stat

The contents of /proc/PID/stat file. (Unix like OS only.)

Definition at line 61 of file processinfo.hpp.

◆ StatPGRP

AString StatPGRP

The process group field (4) within Stat. (Unix like OS only.)

Definition at line 67 of file processinfo.hpp.

◆ StatState

AString StatState

The state field (2) within Stat. (Unix like OS only.)

Definition at line 64 of file processinfo.hpp.


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