#include <MonitorCollection.h>
Public Types | |
typedef std::vector< std::pair < std::string, xdata::Serializable * > > | InfoSpaceItems |
Public Member Functions | |
void | appendInfoSpaceItems (InfoSpaceItems &) |
void | calculateStatistics (const utils::TimePoint_t &now) |
MonitorCollection (const utils::Duration_t &updateInterval) | |
void | reset (const utils::TimePoint_t &now) |
void | updateInfoSpaceItems () |
virtual | ~MonitorCollection () |
Protected Member Functions | |
virtual void | do_appendInfoSpaceItems (InfoSpaceItems &) |
virtual void | do_calculateStatistics ()=0 |
virtual void | do_reset ()=0 |
virtual void | do_updateInfoSpaceItems () |
Private Member Functions | |
MonitorCollection (MonitorCollection const &) | |
MonitorCollection & | operator= (MonitorCollection const &) |
Private Attributes | |
bool | infoSpaceUpdateNeeded_ |
utils::TimePoint_t | lastCalculateStatistics_ |
const utils::Duration_t | updateInterval_ |
An abstract collection of MonitoredQuantities
Definition at line 25 of file MonitorCollection.h.
typedef std::vector< std::pair<std::string, xdata::Serializable*> > stor::MonitorCollection::InfoSpaceItems |
Definition at line 29 of file MonitorCollection.h.
stor::MonitorCollection::MonitorCollection | ( | const utils::Duration_t & | updateInterval | ) | [explicit] |
Definition at line 10 of file MonitorCollection.cc.
: updateInterval_(updateInterval), lastCalculateStatistics_(boost::posix_time::not_a_date_time), infoSpaceUpdateNeeded_(false) {}
virtual stor::MonitorCollection::~MonitorCollection | ( | ) | [inline, virtual] |
Definition at line 36 of file MonitorCollection.h.
{};
stor::MonitorCollection::MonitorCollection | ( | MonitorCollection const & | ) | [private] |
void stor::MonitorCollection::appendInfoSpaceItems | ( | InfoSpaceItems & | items | ) |
Append the info space items to be published in the monitoring info space to the InfoSpaceItems
Definition at line 17 of file MonitorCollection.cc.
References do_appendInfoSpaceItems().
Referenced by smproxy::StatisticsReporter::collectInfoSpaceItems(), and stor::StatisticsReporter::collectInfoSpaceItems().
{ // do any operations that are common for all child classes do_appendInfoSpaceItems(items); }
void stor::MonitorCollection::calculateStatistics | ( | const utils::TimePoint_t & | now | ) |
Calculates the statistics for all quantities
Definition at line 25 of file MonitorCollection.cc.
References do_calculateStatistics(), infoSpaceUpdateNeeded_, lastCalculateStatistics_, cmsPerfSuiteHarvest::now, and updateInterval_.
Referenced by stor::StatisticsReporter::calculateStatistics(), and smproxy::StatisticsReporter::calculateStatistics().
{ if ( lastCalculateStatistics_.is_not_a_date_time() || lastCalculateStatistics_ + updateInterval_ < now ) { lastCalculateStatistics_ = now; do_calculateStatistics(); infoSpaceUpdateNeeded_ = true; } }
virtual void stor::MonitorCollection::do_appendInfoSpaceItems | ( | InfoSpaceItems & | ) | [inline, protected, virtual] |
Reimplemented in stor::DataSenderMonitorCollection, stor::DQMConsumerMonitorCollection, stor::DQMEventMonitorCollection, stor::EventConsumerMonitorCollection, stor::FilesMonitorCollection, stor::FragmentMonitorCollection, stor::ResourceMonitorCollection, stor::RunMonitorCollection, stor::StateMachineMonitorCollection, stor::StreamsMonitorCollection, and stor::ThroughputMonitorCollection.
Definition at line 67 of file MonitorCollection.h.
Referenced by appendInfoSpaceItems().
{};
virtual void stor::MonitorCollection::do_calculateStatistics | ( | ) | [protected, pure virtual] |
Implemented in smproxy::DataRetrieverMonitorCollection, stor::ConsumerMonitorCollection, stor::DataSenderMonitorCollection, stor::DQMEventMonitorCollection, stor::FilesMonitorCollection, stor::FragmentMonitorCollection, stor::ResourceMonitorCollection, stor::RunMonitorCollection, stor::StateMachineMonitorCollection, stor::StreamsMonitorCollection, and stor::ThroughputMonitorCollection.
Referenced by calculateStatistics().
virtual void stor::MonitorCollection::do_reset | ( | ) | [protected, pure virtual] |
Implemented in smproxy::DataRetrieverMonitorCollection, stor::ConsumerMonitorCollection, stor::DataSenderMonitorCollection, stor::DQMEventMonitorCollection, stor::FilesMonitorCollection, stor::FragmentMonitorCollection, stor::ResourceMonitorCollection, stor::RunMonitorCollection, stor::StateMachineMonitorCollection, stor::StreamsMonitorCollection, and stor::ThroughputMonitorCollection.
Referenced by reset().
virtual void stor::MonitorCollection::do_updateInfoSpaceItems | ( | ) | [inline, protected, virtual] |
Reimplemented in stor::DataSenderMonitorCollection, stor::DQMConsumerMonitorCollection, stor::DQMEventMonitorCollection, stor::EventConsumerMonitorCollection, stor::FilesMonitorCollection, stor::FragmentMonitorCollection, stor::ResourceMonitorCollection, stor::RunMonitorCollection, stor::StateMachineMonitorCollection, stor::StreamsMonitorCollection, and stor::ThroughputMonitorCollection.
Definition at line 68 of file MonitorCollection.h.
Referenced by updateInfoSpaceItems().
{};
MonitorCollection& stor::MonitorCollection::operator= | ( | MonitorCollection const & | ) | [private] |
void stor::MonitorCollection::reset | ( | const utils::TimePoint_t & | now | ) |
Resets the monitored quantities
Definition at line 47 of file MonitorCollection.cc.
References do_reset(), infoSpaceUpdateNeeded_, lastCalculateStatistics_, seconds(), and updateInterval_.
Referenced by stor::StatisticsReporter::reset(), and smproxy::StatisticsReporter::reset().
{ do_reset(); // Assure that the first update happens early. // This is important for long update intervals. lastCalculateStatistics_ = now - updateInterval_ + boost::posix_time::seconds(1); infoSpaceUpdateNeeded_ = true; }
void stor::MonitorCollection::updateInfoSpaceItems | ( | ) |
Update all values of the items put into the monitoring info space. The caller has to make sure that the info space where the items reside is locked and properly unlocked after the call.
Definition at line 37 of file MonitorCollection.cc.
References do_updateInfoSpaceItems(), and infoSpaceUpdateNeeded_.
Referenced by stor::StatisticsReporter::actionPerformed(), smproxy::StatisticsReporter::updateInfoSpace(), and stor::StatisticsReporter::updateInfoSpace().
{ if (infoSpaceUpdateNeeded_) { do_updateInfoSpaceItems(); infoSpaceUpdateNeeded_ = false; } }
bool stor::MonitorCollection::infoSpaceUpdateNeeded_ [private] |
Definition at line 79 of file MonitorCollection.h.
Referenced by calculateStatistics(), reset(), and updateInfoSpaceItems().
Definition at line 78 of file MonitorCollection.h.
Referenced by calculateStatistics(), and reset().
const utils::Duration_t stor::MonitorCollection::updateInterval_ [private] |
Reimplemented in smproxy::DataRetrieverMonitorCollection, stor::ConsumerMonitorCollection, stor::DataSenderMonitorCollection, stor::ResourceMonitorCollection, and stor::StreamsMonitorCollection.
Definition at line 77 of file MonitorCollection.h.
Referenced by calculateStatistics(), and reset().