SoDaRadio-5.0.3-master:8901fb5
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
kb1vc::ProcInfo Class Reference

A simple base class to provide debug messaging from any derived class. More...

#include <ProcInfo.hxx>

Public Member Functions

 ProcInfo (const std::string &outfile, const std::string &_unit_name=std::string("UNKNOWN"))
 
 ProcInfo (const std::string &outfile, unsigned int pid, const std::string &_unit_name=std::string("UNKNOWN"))
 
bool getInfo ()
 retrieve current memory usage info from statm More...
 
void reportInfo (bool only_if_changed=false)
 
void printInfo (std::ostream &out)
 
void printInfo ()
 

Protected Member Functions

void init (const std::string &outfile)
 
void openFiles (const std::string &of_name)
 
void clearStats ()
 
std::string curDateTime ()
 
unsigned long getElapsedTime ()
 

Protected Attributes

unsigned long vm_size
 
unsigned long resident_pages
 
unsigned long shared_pages
 
unsigned long text_pages
 
unsigned long lib_pages
 
unsigned long data_stack_pages
 
unsigned long dirty_pages
 
bool stats_changed
 
bool report_file_ok
 
bool stat_file_ok
 
std::string unit_name
 the name of the unit reporting status More...
 
std::string statm_file_name
 
std::ifstream f_statm
 
std::ofstream f_report
 
boost::posix_time::ptime start_seconds
 
unsigned long last_elapsed
 

Detailed Description

A simple base class to provide debug messaging from any derived class.

Definition at line 41 of file ProcInfo.hxx.

Constructor & Destructor Documentation

◆ ProcInfo() [1/2]

kb1vc::ProcInfo::ProcInfo ( const std::string &  outfile,
const std::string &  _unit_name = std::string("UNKNOWN") 
)
inline

Definition at line 43 of file ProcInfo.hxx.

References init(), statm_file_name, and unit_name.

◆ ProcInfo() [2/2]

kb1vc::ProcInfo::ProcInfo ( const std::string &  outfile,
unsigned int  pid,
const std::string &  _unit_name = std::string("UNKNOWN") 
)
inline

Definition at line 50 of file ProcInfo.hxx.

References getInfo(), init(), statm_file_name, and unit_name.

Member Function Documentation

◆ clearStats()

void kb1vc::ProcInfo::clearStats ( )
inlineprotected

Definition at line 89 of file ProcInfo.hxx.

References curDateTime().

Referenced by init().

◆ curDateTime()

std::string kb1vc::ProcInfo::curDateTime ( )
protected

Definition at line 122 of file ProcInfo.cxx.

Referenced by clearStats(), and printInfo().

◆ getElapsedTime()

unsigned long kb1vc::ProcInfo::getElapsedTime ( )
inlineprotected

Definition at line 101 of file ProcInfo.hxx.

References start_seconds.

Referenced by getInfo().

◆ getInfo()

bool kb1vc::ProcInfo::getInfo ( )

retrieve current memory usage info from statm

Returns
true if any of the mem stats changed.

Definition at line 59 of file ProcInfo.cxx.

References data_stack_pages, dirty_pages, f_statm, getElapsedTime(), last_elapsed, lib_pages, resident_pages, shared_pages, stat_file_ok, stats_changed, text_pages, and vm_size.

Referenced by init(), ProcInfo(), and reportInfo().

◆ init()

void kb1vc::ProcInfo::init ( const std::string &  outfile)
inlineprotected

Definition at line 80 of file ProcInfo.hxx.

References clearStats(), getInfo(), openFiles(), and start_seconds.

Referenced by ProcInfo().

◆ openFiles()

void kb1vc::ProcInfo::openFiles ( const std::string &  of_name)
protected

Definition at line 31 of file ProcInfo.cxx.

References f_report, f_statm, report_file_ok, stat_file_ok, statm_file_name, and unit_name.

Referenced by init().

◆ printInfo() [1/2]

void kb1vc::ProcInfo::printInfo ( std::ostream &  out)

◆ printInfo() [2/2]

void kb1vc::ProcInfo::printInfo ( )
inline

Definition at line 69 of file ProcInfo.hxx.

References f_report, printInfo(), and report_file_ok.

Referenced by printInfo(), and reportInfo().

◆ reportInfo()

void kb1vc::ProcInfo::reportInfo ( bool  only_if_changed = false)
inline

Definition at line 60 of file ProcInfo.hxx.

References getInfo(), printInfo(), and stats_changed.

Referenced by doWork(), and main().

Member Data Documentation

◆ data_stack_pages

unsigned long kb1vc::ProcInfo::data_stack_pages
protected

Definition at line 74 of file ProcInfo.hxx.

Referenced by getInfo(), and printInfo().

◆ dirty_pages

unsigned long kb1vc::ProcInfo::dirty_pages
protected

Definition at line 74 of file ProcInfo.hxx.

Referenced by getInfo(), and printInfo().

◆ f_report

std::ofstream kb1vc::ProcInfo::f_report
protected

Definition at line 114 of file ProcInfo.hxx.

Referenced by openFiles(), and printInfo().

◆ f_statm

std::ifstream kb1vc::ProcInfo::f_statm
protected

Definition at line 113 of file ProcInfo.hxx.

Referenced by getInfo(), and openFiles().

◆ last_elapsed

unsigned long kb1vc::ProcInfo::last_elapsed
protected

Definition at line 117 of file ProcInfo.hxx.

Referenced by getInfo(), and printInfo().

◆ lib_pages

unsigned long kb1vc::ProcInfo::lib_pages
protected

Definition at line 74 of file ProcInfo.hxx.

Referenced by getInfo(), and printInfo().

◆ report_file_ok

bool kb1vc::ProcInfo::report_file_ok
protected

Definition at line 108 of file ProcInfo.hxx.

Referenced by openFiles(), and printInfo().

◆ resident_pages

unsigned long kb1vc::ProcInfo::resident_pages
protected

Definition at line 74 of file ProcInfo.hxx.

Referenced by getInfo(), and printInfo().

◆ shared_pages

unsigned long kb1vc::ProcInfo::shared_pages
protected

Definition at line 74 of file ProcInfo.hxx.

Referenced by getInfo(), and printInfo().

◆ start_seconds

boost::posix_time::ptime kb1vc::ProcInfo::start_seconds
protected

Definition at line 116 of file ProcInfo.hxx.

Referenced by getElapsedTime(), and init().

◆ stat_file_ok

bool kb1vc::ProcInfo::stat_file_ok
protected

Definition at line 109 of file ProcInfo.hxx.

Referenced by getInfo(), and openFiles().

◆ statm_file_name

std::string kb1vc::ProcInfo::statm_file_name
protected

Definition at line 112 of file ProcInfo.hxx.

Referenced by openFiles(), and ProcInfo().

◆ stats_changed

bool kb1vc::ProcInfo::stats_changed
protected

Definition at line 78 of file ProcInfo.hxx.

Referenced by getInfo(), and reportInfo().

◆ text_pages

unsigned long kb1vc::ProcInfo::text_pages
protected

Definition at line 74 of file ProcInfo.hxx.

Referenced by getInfo(), and printInfo().

◆ unit_name

std::string kb1vc::ProcInfo::unit_name
protected

the name of the unit reporting status

Definition at line 111 of file ProcInfo.hxx.

Referenced by openFiles(), printInfo(), and ProcInfo().

◆ vm_size

unsigned long kb1vc::ProcInfo::vm_size
protected

Definition at line 74 of file ProcInfo.hxx.

Referenced by getInfo(), and printInfo().


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