rtop
Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
rtop::ProcInfo Class Reference

interfaces with linux API to read process information and update ProcDb with it More...

#include <proc_info.h>

Public Member Functions

 ProcInfo (int id)
 ProcInfo constructor. Instantiates ProcInfo object with provided unique identifier. More...
 
void kill ()
 
void update (std::vector< std::string > &prop_vec, std::string sort_key)
 invoked by Columns::read. reads process prop values, sorts them and then updates ProcDb More...
 

Private Member Functions

void sort ()
 sorts property value vector corresponding to sortkey, and stores resulting permutation vector in ProcDb::sorted_indices More...
 
void read ()
 reads property values specified in ProcInfo::prop_set for each process and stores result in ProcDb::database More...
 

Private Attributes

int uuid
 
std::string sortkey
 variable to hold property name to be sorted. used by ProcInfo::sort to sort process values corresponding to sortkey More...
 
std::unordered_set< int > pid_set
 hashset for storing processs PIDs More...
 
std::unordered_set< std::string > prop_set
 hashset for storing property names, whose corresponding vectors in ProcDb need to be updated More...
 
ProcDbproc_database
 pointer to access ProcDb data structure More...
 

Friends

class XMLTree
 

Detailed Description

interfaces with linux API to read process information and update ProcDb with it

Definition at line 24 of file proc_info.h.

Constructor & Destructor Documentation

◆ ProcInfo()

rtop::ProcInfo::ProcInfo ( int  id)
inline

ProcInfo constructor. Instantiates ProcInfo object with provided unique identifier.

Definition at line 42 of file proc_info.h.

Member Function Documentation

◆ kill()

void rtop::ProcInfo::kill ( )
inline
Todo:
: not implemented. implement it

Definition at line 44 of file proc_info.h.

◆ read()

void rtop::ProcInfo::read ( )
private

reads property values specified in ProcInfo::prop_set for each process and stores result in ProcDb::database

Todo:
: modify loop to read all properties from /proc/pid/stat file, then compute different property values by combining entries
Bug:
: throwing exception occasionaly. investigate
Todo:
: hardcoded property name for Command. receive this value during initialization

Definition at line 68 of file proc_info.h.

◆ sort()

void rtop::ProcInfo::sort ( )
private

sorts property value vector corresponding to sortkey, and stores resulting permutation vector in ProcDb::sorted_indices

Todo:
: long and int sorting handled separately. investigate and refactor?

Definition at line 229 of file proc_info.h.

◆ update()

void rtop::ProcInfo::update ( std::vector< std::string > &  prop_vec,
std::string  sort_key 
)

invoked by Columns::read. reads process prop values, sorts them and then updates ProcDb

Definition at line 51 of file proc_info.h.

Friends And Related Function Documentation

◆ XMLTree

friend class XMLTree
friend

Definition at line 47 of file proc_info.h.

Member Data Documentation

◆ pid_set

std::unordered_set<int> rtop::ProcInfo::pid_set
private

hashset for storing processs PIDs

Definition at line 31 of file proc_info.h.

◆ proc_database

ProcDb* rtop::ProcInfo::proc_database
private

pointer to access ProcDb data structure

Definition at line 39 of file proc_info.h.

◆ prop_set

std::unordered_set<std::string> rtop::ProcInfo::prop_set
private

hashset for storing property names, whose corresponding vectors in ProcDb need to be updated

Definition at line 33 of file proc_info.h.

◆ sortkey

std::string rtop::ProcInfo::sortkey
private

variable to hold property name to be sorted. used by ProcInfo::sort to sort process values corresponding to sortkey

Definition at line 29 of file proc_info.h.

◆ uuid

int rtop::ProcInfo::uuid
private

Definition at line 27 of file proc_info.h.


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