BDE 4.39.x Production Release
Loading...
Searching...
No Matches
balb::PerformanceMonitor Class Reference

#include <balb_performancemonitor.h>

Detailed Description

Provides a mechanism to collect performance statistics for an arbitrary number of processes running on the local machine.

See balb_performancemonitor

Classes

class  ConstIterator
 
class  Statistics
 

Public Types

enum  Measure {
  e_CPU_TIME , e_CPU_TIME_USER , e_CPU_TIME_SYSTEM , e_CPU_UTIL ,
  e_CPU_UTIL_USER , e_CPU_UTIL_SYSTEM , e_RESIDENT_SIZE , e_NUM_THREADS ,
  e_NUM_PAGEFAULTS , e_VIRTUAL_SIZE , e_NUM_MEASURES , BSLA_DEPRECATED = e_CPU_TIME ,
  BSLA_DEPRECATED = e_CPU_TIME , BSLA_DEPRECATED = e_CPU_TIME , BSLA_DEPRECATED = e_CPU_TIME , BSLA_DEPRECATED = e_CPU_TIME ,
  BSLA_DEPRECATED = e_CPU_TIME , BSLA_DEPRECATED = e_CPU_TIME , BSLA_DEPRECATED = e_CPU_TIME , BSLA_DEPRECATED = e_CPU_TIME ,
  BSLA_DEPRECATED = e_CPU_TIME , BSLA_DEPRECATED = e_CPU_TIME , BSLA_DEPRECATED = e_CPU_TIME , BSLA_DEPRECATED = e_CPU_TIME ,
  BSLA_DEPRECATED = e_CPU_TIME , BSLA_DEPRECATED = e_CPU_TIME , BSLA_DEPRECATED = e_CPU_TIME , BSLA_DEPRECATED = e_CPU_TIME ,
  BSLA_DEPRECATED = e_CPU_TIME , BSLA_DEPRECATED = e_CPU_TIME , BSLA_DEPRECATED = e_CPU_TIME , BSLA_DEPRECATED = e_CPU_TIME ,
  BSLA_DEPRECATED = e_CPU_TIME
}
 

Public Member Functions

 BSLMF_NESTED_TRAIT_DECLARATION (PerformanceMonitor, bslma::UsesBslmaAllocator)
 
 PerformanceMonitor (bslma::Allocator *basicAllocator=0)
 
 PerformanceMonitor (bdlmt::TimerEventScheduler *scheduler, double interval, bslma::Allocator *basicAllocator=0)
 
 ~PerformanceMonitor ()
 
int registerPid (int pid, const bsl::string &description)
 
int unregisterPid (int pid)
 
void setCollectionInterval (double interval)
 
void collect ()
 
void resetStatistics ()
 
ConstIterator begin () const
 
ConstIterator end () const
 
ConstIterator find (int pid) const
 
int numRegisteredPids () const
 

Friends

class Statistics
 
class ConstIterator
 

Member Enumeration Documentation

◆ Measure

Enumerator
e_CPU_TIME 
e_CPU_TIME_USER 
e_CPU_TIME_SYSTEM 
e_CPU_UTIL 
e_CPU_UTIL_USER 
e_CPU_UTIL_SYSTEM 
e_RESIDENT_SIZE 
e_NUM_THREADS 
e_NUM_PAGEFAULTS 
e_VIRTUAL_SIZE 
e_NUM_MEASURES 
BSLA_DEPRECATED 
BSLA_DEPRECATED 
BSLA_DEPRECATED 
BSLA_DEPRECATED 
BSLA_DEPRECATED 
BSLA_DEPRECATED 
BSLA_DEPRECATED 
BSLA_DEPRECATED 
BSLA_DEPRECATED 
BSLA_DEPRECATED 
BSLA_DEPRECATED 
BSLA_DEPRECATED 
BSLA_DEPRECATED 
BSLA_DEPRECATED 
BSLA_DEPRECATED 
BSLA_DEPRECATED 
BSLA_DEPRECATED 
BSLA_DEPRECATED 
BSLA_DEPRECATED 
BSLA_DEPRECATED 
BSLA_DEPRECATED 
BSLA_DEPRECATED 

Constructor & Destructor Documentation

◆ PerformanceMonitor() [1/2]

balb::PerformanceMonitor::PerformanceMonitor ( bslma::Allocator basicAllocator = 0)
explicit

Create an instance of this class to collect performance statistics on demand (via the collect method). Optionally specify a basicAllocator used to supply memory. If basicAllocator is 0, the currently installed default allocator is used.

◆ PerformanceMonitor() [2/2]

balb::PerformanceMonitor::PerformanceMonitor ( bdlmt::TimerEventScheduler scheduler,
double  interval,
bslma::Allocator basicAllocator = 0 
)

Create an instance of this class that uses the specified scheduler to automatically collect performance statistics every specified interval (specified in seconds). Optionally specify a basicAllocator used to supply memory. If basicAllocator is 0, the currently installed default allocator is used. A non-positive interval value indicates that performance statistics should not be automatically collected–in this case the user is responsible for manually calling the collect function.

◆ ~PerformanceMonitor()

balb::PerformanceMonitor::~PerformanceMonitor ( )

Destroy this object.

Member Function Documentation

◆ begin()

PerformanceMonitor::ConstIterator balb::PerformanceMonitor::begin ( ) const
inline

Return an iterator positioned at the first set of collected performance statistics.

◆ BSLMF_NESTED_TRAIT_DECLARATION()

balb::PerformanceMonitor::BSLMF_NESTED_TRAIT_DECLARATION ( PerformanceMonitor  ,
bslma::UsesBslmaAllocator   
)

◆ collect()

void balb::PerformanceMonitor::collect ( )

Collect performance statistics for each registered pid.

◆ end()

PerformanceMonitor::ConstIterator balb::PerformanceMonitor::end ( ) const
inline

Return an iterator that represents the end of the sequence of sets of collected performance statistics.

◆ find()

PerformanceMonitor::ConstIterator balb::PerformanceMonitor::find ( int  pid) const
inline

Return the iterator pointing to the set of collected performance statistics for the specified pid if pid has been registered with this performance monitor through the registerPid function, otherwise return end(). A pid value of zero is translated to the current process id.

◆ numRegisteredPids()

int balb::PerformanceMonitor::numRegisteredPids ( ) const
inline

Return the number of processes registered for statistics collection.

◆ registerPid()

int balb::PerformanceMonitor::registerPid ( int  pid,
const bsl::string description 
)

Register the specified process pid having the specified user-defined description with this performance monitor. After registration, performance statistics will be collected for the pid upon invocation of the collect function. A pid value of zero is translated to the current process id. Return 0 on success or a non-zero value otherwise.

◆ resetStatistics()

void balb::PerformanceMonitor::resetStatistics ( )

Reset the collected min, max, and average values collected for each measure for each monitored process.

Note
Note that this method will call collect once for each monitored process, so the statistics after this method returns will be based on the values collected thereby.

◆ setCollectionInterval()

void balb::PerformanceMonitor::setCollectionInterval ( double  interval)

Set the specified time interval, in seconds, after which statistics for each registered pid are automatically collected.

Precondition
The behavior is undefined unless a scheduler was supplied at the construction of this performance monitor. A non-positive interval value indicates that performance statistics should not be automatically collected–in this case the user is responsible for manually calling the collect function.

◆ unregisterPid()

int balb::PerformanceMonitor::unregisterPid ( int  pid)

Unregister the specified process pid from the performance monitor. After unregistration, to statistics for the pid will be no longer be available unless the pid is re-registered with the performance monitor through calling registerPid. A pid value of zero is translated to the current process id. Return 0 on success or a non-zero value otherwise.

Friends And Related Symbol Documentation

◆ ConstIterator

friend class ConstIterator
friend

◆ Statistics

friend class Statistics
friend

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