#include <StatisticsReporter.h>
Singleton to keep track of all monitoring and statistics issues
This class also starts the monitoring workloop to update the statistics for all MonitorCollections.
Definition at line 50 of file StatisticsReporter.h.
typedef std::list<std::string> stor::StatisticsReporter::InfoSpaceItemNames [private] |
Definition at line 157 of file StatisticsReporter.h.
stor::StatisticsReporter::StatisticsReporter | ( | xdaq::Application * | app, |
SharedResourcesPtr | sr | ||
) | [explicit] |
Definition at line 25 of file StatisticsReporter.cc.
References reset().
: app_(app), monitoringSleepSec_(sr->configuration_-> getWorkerThreadParams().monitoringSleepSec_), runMonCollection_(monitoringSleepSec_, sr), fragMonCollection_(monitoringSleepSec_), filesMonCollection_(monitoringSleepSec_*5), streamsMonCollection_(monitoringSleepSec_), dataSenderMonCollection_(monitoringSleepSec_, sr->alarmHandler_), dqmEventMonCollection_(monitoringSleepSec_*5), resourceMonCollection_(monitoringSleepSec_*600, sr->alarmHandler_), stateMachineMonCollection_(monitoringSleepSec_), eventConsumerMonCollection_(monitoringSleepSec_), dqmConsumerMonCollection_(monitoringSleepSec_), throughputMonCollection_(monitoringSleepSec_, sr->configuration_->getWorkerThreadParams().throuphputAveragingCycles_), monitorWL_(0), doMonitoring_(monitoringSleepSec_>boost::posix_time::seconds(0)) { reset(); createMonitoringInfoSpace(); collectInfoSpaceItems(); addRunInfoQuantitiesToApplicationInfoSpace(); }
stor::StatisticsReporter::~StatisticsReporter | ( | ) | [virtual] |
Definition at line 86 of file StatisticsReporter.cc.
References doMonitoring_, and monitorWL_.
{ // Stop the monitoring activity doMonitoring_ = false; // Cancel the workloop (will wait until the action has finished) if ( monitorWL_ && monitorWL_->isActive() ) monitorWL_->cancel(); }
stor::StatisticsReporter::StatisticsReporter | ( | StatisticsReporter const & | ) | [private] |
void stor::StatisticsReporter::actionPerformed | ( | xdata::Event & | ispaceEvent | ) | [virtual] |
Update the variables put into the application info space
Definition at line 336 of file StatisticsReporter.cc.
References closedFiles_, alignCSCRings::e, Exception, filesMonCollection_, infoSpace_, stateMachineMonCollection_, stateName_, storedEvents_, streamsMonCollection_, and stor::MonitorCollection::updateInfoSpaceItems().
{ if (ispaceEvent.type() == "ItemRetrieveEvent") { std::string item = dynamic_cast<xdata::ItemRetrieveEvent&>(ispaceEvent).itemName(); if (item == "closedFiles") { filesMonCollection_.updateInfoSpaceItems(); try { closedFiles_.setValue( *(infoSpace_->find("closedFiles")) ); } catch(xdata::exception::Exception& e) { closedFiles_ = 0; } } else if (item == "storedEvents") { streamsMonCollection_.updateInfoSpaceItems(); try { storedEvents_.setValue( *(infoSpace_->find("storedEvents")) ); } catch(xdata::exception::Exception& e) { storedEvents_ = 0; } } else if (item == "stateName") { stateMachineMonCollection_.updateInfoSpaceItems(); try { stateName_.setValue( *(infoSpace_->find("stateName")) ); } catch(xdata::exception::Exception& e) { stateName_ = "unknown"; } } } }
void stor::StatisticsReporter::addRunInfoQuantitiesToApplicationInfoSpace | ( | ) | [private] |
Definition at line 181 of file StatisticsReporter.cc.
References app_, closedFiles_, stateName_, and storedEvents_.
{ xdata::InfoSpace *infoSpace = app_->getApplicationInfoSpace(); // bind the local xdata variables to the infospace infoSpace->fireItemAvailable("stateName", &stateName_); infoSpace->fireItemAvailable("storedEvents", &storedEvents_); infoSpace->fireItemAvailable("closedFiles", &closedFiles_); // spacial handling for the monitoring values requested by the HLTSFM // we want to assure that the values are current when they are queried infoSpace->addItemRetrieveListener("stateName", this); infoSpace->addItemRetrieveListener("storedEvents", this); infoSpace->addItemRetrieveListener("closedFiles", this); }
void stor::StatisticsReporter::calculateStatistics | ( | ) | [private] |
Definition at line 247 of file StatisticsReporter.cc.
References stor::MonitorCollection::calculateStatistics(), dataSenderMonCollection_, dqmConsumerMonCollection_, dqmEventMonCollection_, eventConsumerMonCollection_, filesMonCollection_, fragMonCollection_, stor::utils::getCurrentTime(), cmsPerfSuiteHarvest::now, resourceMonCollection_, runMonCollection_, stateMachineMonCollection_, streamsMonCollection_, and throughputMonCollection_.
Referenced by monitorAction().
{ const utils::TimePoint_t now = utils::getCurrentTime(); runMonCollection_.calculateStatistics(now); fragMonCollection_.calculateStatistics(now); filesMonCollection_.calculateStatistics(now); streamsMonCollection_.calculateStatistics(now); dataSenderMonCollection_.calculateStatistics(now); dqmEventMonCollection_.calculateStatistics(now); resourceMonCollection_.calculateStatistics(now); stateMachineMonCollection_.calculateStatistics(now); eventConsumerMonCollection_.calculateStatistics(now); dqmConsumerMonCollection_.calculateStatistics(now); throughputMonCollection_.calculateStatistics(now); }
void stor::StatisticsReporter::collectInfoSpaceItems | ( | ) | [private] |
Definition at line 131 of file StatisticsReporter.cc.
References stor::MonitorCollection::appendInfoSpaceItems(), dataSenderMonCollection_, dqmConsumerMonCollection_, dqmEventMonCollection_, eventConsumerMonCollection_, filesMonCollection_, fragMonCollection_, infoSpaceItemNames_, putItemsIntoInfoSpace(), resourceMonCollection_, runMonCollection_, stateMachineMonCollection_, streamsMonCollection_, and throughputMonCollection_.
{ MonitorCollection::InfoSpaceItems infoSpaceItems; infoSpaceItemNames_.clear(); runMonCollection_.appendInfoSpaceItems(infoSpaceItems); fragMonCollection_.appendInfoSpaceItems(infoSpaceItems); filesMonCollection_.appendInfoSpaceItems(infoSpaceItems); streamsMonCollection_.appendInfoSpaceItems(infoSpaceItems); dataSenderMonCollection_.appendInfoSpaceItems(infoSpaceItems); dqmEventMonCollection_.appendInfoSpaceItems(infoSpaceItems); resourceMonCollection_.appendInfoSpaceItems(infoSpaceItems); stateMachineMonCollection_.appendInfoSpaceItems(infoSpaceItems); eventConsumerMonCollection_.appendInfoSpaceItems(infoSpaceItems); dqmConsumerMonCollection_.appendInfoSpaceItems(infoSpaceItems); throughputMonCollection_.appendInfoSpaceItems(infoSpaceItems); putItemsIntoInfoSpace(infoSpaceItems); }
void stor::StatisticsReporter::createMonitoringInfoSpace | ( | ) | [private] |
Definition at line 96 of file StatisticsReporter.cc.
References app_, alignCSCRings::e, Exception, and infoSpace_.
{ // Create an infospace which can be monitored. // The naming follows the old SM scheme. // In future, the instance number should be included. std::ostringstream oss; oss << "urn:xdaq-monitorable-" << app_->getApplicationDescriptor()->getClassName(); std::string errorMsg = "Failed to create monitoring info space " + oss.str(); try { toolbox::net::URN urn = app_->createQualifiedInfoSpace(oss.str()); xdata::getInfoSpaceFactory()->lock(); infoSpace_ = xdata::getInfoSpaceFactory()->get(urn.toString()); xdata::getInfoSpaceFactory()->unlock(); } catch(xdata::exception::Exception &e) { xdata::getInfoSpaceFactory()->unlock(); XCEPT_RETHROW(stor::exception::Infospace, errorMsg, e); } catch (...) { xdata::getInfoSpaceFactory()->unlock(); errorMsg += " : unknown exception"; XCEPT_RAISE(stor::exception::Infospace, errorMsg); } }
DataSenderMonitorCollection& stor::StatisticsReporter::getDataSenderMonitorCollection | ( | ) | [inline] |
Definition at line 93 of file StatisticsReporter.h.
References dataSenderMonCollection_.
{ return dataSenderMonCollection_; }
const DataSenderMonitorCollection& stor::StatisticsReporter::getDataSenderMonitorCollection | ( | ) | const [inline] |
Definition at line 90 of file StatisticsReporter.h.
References dataSenderMonCollection_.
{ return dataSenderMonCollection_; }
const DQMConsumerMonitorCollection& stor::StatisticsReporter::getDQMConsumerMonitorCollection | ( | ) | const [inline] |
Definition at line 125 of file StatisticsReporter.h.
References dqmConsumerMonCollection_.
{ return dqmConsumerMonCollection_; }
DQMConsumerMonitorCollection& stor::StatisticsReporter::getDQMConsumerMonitorCollection | ( | ) | [inline] |
Definition at line 128 of file StatisticsReporter.h.
References dqmConsumerMonCollection_.
{ return dqmConsumerMonCollection_; }
const DQMEventMonitorCollection& stor::StatisticsReporter::getDQMEventMonitorCollection | ( | ) | const [inline] |
Definition at line 97 of file StatisticsReporter.h.
References dqmEventMonCollection_.
{ return dqmEventMonCollection_; }
DQMEventMonitorCollection& stor::StatisticsReporter::getDQMEventMonitorCollection | ( | ) | [inline] |
Definition at line 100 of file StatisticsReporter.h.
References dqmEventMonCollection_.
{ return dqmEventMonCollection_; }
const EventConsumerMonitorCollection& stor::StatisticsReporter::getEventConsumerMonitorCollection | ( | ) | const [inline] |
Definition at line 118 of file StatisticsReporter.h.
References eventConsumerMonCollection_.
{ return eventConsumerMonCollection_; }
EventConsumerMonitorCollection& stor::StatisticsReporter::getEventConsumerMonitorCollection | ( | ) | [inline] |
Definition at line 121 of file StatisticsReporter.h.
References eventConsumerMonCollection_.
{ return eventConsumerMonCollection_; }
const FilesMonitorCollection& stor::StatisticsReporter::getFilesMonitorCollection | ( | ) | const [inline] |
Definition at line 76 of file StatisticsReporter.h.
References filesMonCollection_.
{ return filesMonCollection_; }
FilesMonitorCollection& stor::StatisticsReporter::getFilesMonitorCollection | ( | ) | [inline] |
Definition at line 79 of file StatisticsReporter.h.
References filesMonCollection_.
{ return filesMonCollection_; }
const FragmentMonitorCollection& stor::StatisticsReporter::getFragmentMonitorCollection | ( | ) | const [inline] |
Definition at line 69 of file StatisticsReporter.h.
References fragMonCollection_.
{ return fragMonCollection_; }
FragmentMonitorCollection& stor::StatisticsReporter::getFragmentMonitorCollection | ( | ) | [inline] |
Definition at line 72 of file StatisticsReporter.h.
References fragMonCollection_.
{ return fragMonCollection_; }
const ResourceMonitorCollection& stor::StatisticsReporter::getResourceMonitorCollection | ( | ) | const [inline] |
Definition at line 104 of file StatisticsReporter.h.
References resourceMonCollection_.
{ return resourceMonCollection_; }
ResourceMonitorCollection& stor::StatisticsReporter::getResourceMonitorCollection | ( | ) | [inline] |
Definition at line 107 of file StatisticsReporter.h.
References resourceMonCollection_.
{ return resourceMonCollection_; }
RunMonitorCollection& stor::StatisticsReporter::getRunMonitorCollection | ( | ) | [inline] |
Definition at line 65 of file StatisticsReporter.h.
References runMonCollection_.
{ return runMonCollection_; }
const RunMonitorCollection& stor::StatisticsReporter::getRunMonitorCollection | ( | ) | const [inline] |
Definition at line 62 of file StatisticsReporter.h.
References runMonCollection_.
{ return runMonCollection_; }
StateMachineMonitorCollection& stor::StatisticsReporter::getStateMachineMonitorCollection | ( | ) | [inline] |
Definition at line 114 of file StatisticsReporter.h.
References stateMachineMonCollection_.
{ return stateMachineMonCollection_; }
const StateMachineMonitorCollection& stor::StatisticsReporter::getStateMachineMonitorCollection | ( | ) | const [inline] |
Definition at line 111 of file StatisticsReporter.h.
References stateMachineMonCollection_.
{ return stateMachineMonCollection_; }
StreamsMonitorCollection& stor::StatisticsReporter::getStreamsMonitorCollection | ( | ) | [inline] |
Definition at line 86 of file StatisticsReporter.h.
References streamsMonCollection_.
{ return streamsMonCollection_; }
const StreamsMonitorCollection& stor::StatisticsReporter::getStreamsMonitorCollection | ( | ) | const [inline] |
Definition at line 83 of file StatisticsReporter.h.
References streamsMonCollection_.
{ return streamsMonCollection_; }
ThroughputMonitorCollection& stor::StatisticsReporter::getThroughputMonitorCollection | ( | ) | [inline] |
Definition at line 135 of file StatisticsReporter.h.
References throughputMonCollection_.
{ return throughputMonCollection_; }
const ThroughputMonitorCollection& stor::StatisticsReporter::getThroughputMonitorCollection | ( | ) | const [inline] |
Definition at line 132 of file StatisticsReporter.h.
References throughputMonCollection_.
{ return throughputMonCollection_; }
bool stor::StatisticsReporter::monitorAction | ( | toolbox::task::WorkLoop * | wl | ) | [private] |
Definition at line 198 of file StatisticsReporter.cc.
References app_, calculateStatistics(), doMonitoring_, alignCSCRings::e, exception, Exception, stor::utils::getCurrentTime(), lastMonitorAction_, monitoringSleepSec_, stor::utils::sleepUntil(), and updateInfoSpace().
Referenced by startWorkLoop().
{ utils::sleepUntil(lastMonitorAction_ + monitoringSleepSec_); lastMonitorAction_ = utils::getCurrentTime(); std::string errorMsg = "Failed to update the monitoring information"; try { calculateStatistics(); updateInfoSpace(); } catch(xcept::Exception &e) { LOG4CPLUS_ERROR(app_->getApplicationLogger(), errorMsg << xcept::stdformat_exception_history(e)); XCEPT_DECLARE_NESTED(stor::exception::Monitoring, sentinelException, errorMsg, e); app_->notifyQualified("error", sentinelException); } catch(std::exception &e) { errorMsg += ": "; errorMsg += e.what(); LOG4CPLUS_ERROR(app_->getApplicationLogger(), errorMsg); XCEPT_DECLARE(stor::exception::Monitoring, sentinelException, errorMsg); app_->notifyQualified("error", sentinelException); } catch(...) { errorMsg += ": Unknown exception"; LOG4CPLUS_ERROR(app_->getApplicationLogger(), errorMsg); XCEPT_DECLARE(stor::exception::Monitoring, sentinelException, errorMsg); app_->notifyQualified("error", sentinelException); } return doMonitoring_; }
StatisticsReporter& stor::StatisticsReporter::operator= | ( | StatisticsReporter const & | ) | [private] |
void stor::StatisticsReporter::putItemsIntoInfoSpace | ( | MonitorCollection::InfoSpaceItems & | items | ) | [private] |
Definition at line 152 of file StatisticsReporter.cc.
References alignCSCRings::e, Exception, infoSpace_, and infoSpaceItemNames_.
Referenced by collectInfoSpaceItems().
{ for ( MonitorCollection::InfoSpaceItems::const_iterator it = items.begin(), itEnd = items.end(); it != itEnd; ++it ) { try { // fireItemAvailable locks the infospace internally infoSpace_->fireItemAvailable(it->first, it->second); } catch(xdata::exception::Exception &e) { std::stringstream oss; oss << "Failed to put " << it->first; oss << " into info space " << infoSpace_->name(); XCEPT_RETHROW(stor::exception::Monitoring, oss.str(), e); } // keep a list of info space names for the fireItemGroupChanged infoSpaceItemNames_.push_back(it->first); } }
void stor::StatisticsReporter::reset | ( | void | ) |
Reset all monitored quantities
Definition at line 317 of file StatisticsReporter.cc.
References dataSenderMonCollection_, dqmConsumerMonCollection_, dqmEventMonCollection_, eventConsumerMonCollection_, filesMonCollection_, fragMonCollection_, stor::utils::getCurrentTime(), cmsPerfSuiteHarvest::now, stor::MonitorCollection::reset(), resourceMonCollection_, runMonCollection_, streamsMonCollection_, and throughputMonCollection_.
{ const utils::TimePoint_t now = utils::getCurrentTime(); // do not reset the stateMachineMonCollection, as we want to // keep the state machine history runMonCollection_.reset(now); fragMonCollection_.reset(now); filesMonCollection_.reset(now); streamsMonCollection_.reset(now); dataSenderMonCollection_.reset(now); dqmEventMonCollection_.reset(now); resourceMonCollection_.reset(now); eventConsumerMonCollection_.reset(now); dqmConsumerMonCollection_.reset(now); throughputMonCollection_.reset(now); }
void stor::StatisticsReporter::startWorkLoop | ( | std::string | workloopName | ) |
Create and start the monitoring workloop
Definition at line 54 of file StatisticsReporter.cc.
References app_, doMonitoring_, alignCSCRings::e, Exception, stor::utils::getCurrentTime(), stor::utils::getIdentifier(), lastMonitorAction_, monitorAction(), monitorWL_, and lumiQueryAPI::msg.
{ if ( !doMonitoring_ ) return; try { std::string identifier = utils::getIdentifier(app_->getApplicationDescriptor()); monitorWL_= toolbox::task::getWorkLoopFactory()->getWorkLoop( identifier + workloopName, "waiting"); if ( ! monitorWL_->isActive() ) { toolbox::task::ActionSignature* monitorAction = toolbox::task::bind(this, &StatisticsReporter::monitorAction, identifier + "MonitorAction"); monitorWL_->submit(monitorAction); lastMonitorAction_ = utils::getCurrentTime(); monitorWL_->activate(); } } catch (xcept::Exception& e) { const std::string msg = "Failed to start workloop 'StatisticsReporter' with 'MonitorAction'."; XCEPT_RETHROW(stor::exception::Monitoring, msg, e); } }
void stor::StatisticsReporter::updateInfoSpace | ( | ) | [private] |
Definition at line 265 of file StatisticsReporter.cc.
References dataSenderMonCollection_, dqmConsumerMonCollection_, dqmEventMonCollection_, alignCSCRings::e, eventConsumerMonCollection_, exception, Exception, filesMonCollection_, fragMonCollection_, infoSpace_, infoSpaceItemNames_, resourceMonCollection_, runMonCollection_, stateMachineMonCollection_, streamsMonCollection_, throughputMonCollection_, and stor::MonitorCollection::updateInfoSpaceItems().
Referenced by monitorAction().
{ std::string errorMsg = "Failed to update values of items in info space " + infoSpace_->name(); // Lock the infospace to assure that all items are consistent try { infoSpace_->lock(); runMonCollection_.updateInfoSpaceItems(); fragMonCollection_.updateInfoSpaceItems(); filesMonCollection_.updateInfoSpaceItems(); streamsMonCollection_.updateInfoSpaceItems(); dataSenderMonCollection_.updateInfoSpaceItems(); dqmEventMonCollection_.updateInfoSpaceItems(); resourceMonCollection_.updateInfoSpaceItems(); stateMachineMonCollection_.updateInfoSpaceItems(); eventConsumerMonCollection_.updateInfoSpaceItems(); dqmConsumerMonCollection_.updateInfoSpaceItems(); throughputMonCollection_.updateInfoSpaceItems(); infoSpace_->unlock(); } catch(std::exception &e) { infoSpace_->unlock(); errorMsg += ": "; errorMsg += e.what(); XCEPT_RAISE(stor::exception::Monitoring, errorMsg); } catch (...) { infoSpace_->unlock(); errorMsg += " : unknown exception"; XCEPT_RAISE(stor::exception::Monitoring, errorMsg); } try { // The fireItemGroupChanged locks the infospace infoSpace_->fireItemGroupChanged(infoSpaceItemNames_, this); } catch (xdata::exception::Exception &e) { XCEPT_RETHROW(stor::exception::Monitoring, errorMsg, e); } }
xdaq::Application* stor::StatisticsReporter::app_ [private] |
Definition at line 171 of file StatisticsReporter.h.
Referenced by addRunInfoQuantitiesToApplicationInfoSpace(), createMonitoringInfoSpace(), monitorAction(), and startWorkLoop().
xdata::UnsignedInteger32 stor::StatisticsReporter::closedFiles_ [private] |
Definition at line 199 of file StatisticsReporter.h.
Referenced by actionPerformed(), and addRunInfoQuantitiesToApplicationInfoSpace().
Definition at line 179 of file StatisticsReporter.h.
Referenced by calculateStatistics(), collectInfoSpaceItems(), getDataSenderMonitorCollection(), reset(), and updateInfoSpace().
bool stor::StatisticsReporter::doMonitoring_ [private] |
Definition at line 187 of file StatisticsReporter.h.
Referenced by monitorAction(), startWorkLoop(), and ~StatisticsReporter().
Definition at line 184 of file StatisticsReporter.h.
Referenced by calculateStatistics(), collectInfoSpaceItems(), getDQMConsumerMonitorCollection(), reset(), and updateInfoSpace().
Definition at line 180 of file StatisticsReporter.h.
Referenced by calculateStatistics(), collectInfoSpaceItems(), getDQMEventMonitorCollection(), reset(), and updateInfoSpace().
Definition at line 183 of file StatisticsReporter.h.
Referenced by calculateStatistics(), collectInfoSpaceItems(), getEventConsumerMonitorCollection(), reset(), and updateInfoSpace().
Definition at line 177 of file StatisticsReporter.h.
Referenced by actionPerformed(), calculateStatistics(), collectInfoSpaceItems(), getFilesMonitorCollection(), reset(), and updateInfoSpace().
Definition at line 176 of file StatisticsReporter.h.
Referenced by calculateStatistics(), collectInfoSpaceItems(), getFragmentMonitorCollection(), reset(), and updateInfoSpace().
xdata::InfoSpace* stor::StatisticsReporter::infoSpace_ [private] |
Definition at line 190 of file StatisticsReporter.h.
Referenced by actionPerformed(), createMonitoringInfoSpace(), putItemsIntoInfoSpace(), and updateInfoSpace().
Definition at line 191 of file StatisticsReporter.h.
Referenced by collectInfoSpaceItems(), putItemsIntoInfoSpace(), and updateInfoSpace().
Definition at line 173 of file StatisticsReporter.h.
Referenced by monitorAction(), and startWorkLoop().
Definition at line 172 of file StatisticsReporter.h.
Referenced by monitorAction().
toolbox::task::WorkLoop* stor::StatisticsReporter::monitorWL_ [private] |
Definition at line 186 of file StatisticsReporter.h.
Referenced by startWorkLoop(), and ~StatisticsReporter().
Definition at line 181 of file StatisticsReporter.h.
Referenced by calculateStatistics(), collectInfoSpaceItems(), getResourceMonitorCollection(), reset(), and updateInfoSpace().
Definition at line 175 of file StatisticsReporter.h.
Referenced by calculateStatistics(), collectInfoSpaceItems(), getRunMonitorCollection(), reset(), and updateInfoSpace().
Definition at line 182 of file StatisticsReporter.h.
Referenced by actionPerformed(), calculateStatistics(), collectInfoSpaceItems(), getStateMachineMonitorCollection(), and updateInfoSpace().
xdata::String stor::StatisticsReporter::stateName_ [private] |
Definition at line 197 of file StatisticsReporter.h.
Referenced by actionPerformed(), and addRunInfoQuantitiesToApplicationInfoSpace().
xdata::UnsignedInteger32 stor::StatisticsReporter::storedEvents_ [private] |
Definition at line 198 of file StatisticsReporter.h.
Referenced by actionPerformed(), and addRunInfoQuantitiesToApplicationInfoSpace().
Definition at line 178 of file StatisticsReporter.h.
Referenced by actionPerformed(), calculateStatistics(), collectInfoSpaceItems(), getStreamsMonitorCollection(), reset(), and updateInfoSpace().
Definition at line 185 of file StatisticsReporter.h.
Referenced by calculateStatistics(), collectInfoSpaceItems(), getThroughputMonitorCollection(), reset(), and updateInfoSpace().