CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Types | Private Member Functions | Private Attributes
stor::StatisticsReporter Class Reference

#include <StatisticsReporter.h>

Inheritance diagram for stor::StatisticsReporter:

Public Member Functions

virtual void actionPerformed (xdata::Event &)
 
AlarmHandlerPtr alarmHandler ()
 
const DataSenderMonitorCollectiongetDataSenderMonitorCollection () const
 
DataSenderMonitorCollectiongetDataSenderMonitorCollection ()
 
const
DQMConsumerMonitorCollection
getDQMConsumerMonitorCollection () const
 
DQMConsumerMonitorCollectiongetDQMConsumerMonitorCollection ()
 
const DQMEventMonitorCollectiongetDQMEventMonitorCollection () const
 
DQMEventMonitorCollectiongetDQMEventMonitorCollection ()
 
const
EventConsumerMonitorCollection
getEventConsumerMonitorCollection () const
 
EventConsumerMonitorCollectiongetEventConsumerMonitorCollection ()
 
const FilesMonitorCollectiongetFilesMonitorCollection () const
 
FilesMonitorCollectiongetFilesMonitorCollection ()
 
const FragmentMonitorCollectiongetFragmentMonitorCollection () const
 
FragmentMonitorCollectiongetFragmentMonitorCollection ()
 
const ResourceMonitorCollectiongetResourceMonitorCollection () const
 
ResourceMonitorCollectiongetResourceMonitorCollection ()
 
const RunMonitorCollectiongetRunMonitorCollection () const
 
RunMonitorCollectiongetRunMonitorCollection ()
 
const
StateMachineMonitorCollection
getStateMachineMonitorCollection () const
 
StateMachineMonitorCollectiongetStateMachineMonitorCollection ()
 
const StreamsMonitorCollectiongetStreamsMonitorCollection () const
 
StreamsMonitorCollectiongetStreamsMonitorCollection ()
 
const ThroughputMonitorCollectiongetThroughputMonitorCollection () const
 
ThroughputMonitorCollectiongetThroughputMonitorCollection ()
 
void reset ()
 
void startWorkLoop (std::string workloopName)
 
 StatisticsReporter (xdaq::Application *, SharedResourcesPtr)
 
virtual ~StatisticsReporter ()
 

Private Types

typedef std::list< std::string > InfoSpaceItemNames
 

Private Member Functions

void addRunInfoQuantitiesToApplicationInfoSpace ()
 
void calculateStatistics ()
 
void collectInfoSpaceItems ()
 
void createMonitoringInfoSpace ()
 
bool monitorAction (toolbox::task::WorkLoop *)
 
StatisticsReporteroperator= (StatisticsReporter const &)
 
void putItemsIntoInfoSpace (MonitorCollection::InfoSpaceItems &)
 
 StatisticsReporter (StatisticsReporter const &)
 
void updateInfoSpace ()
 

Private Attributes

AlarmHandlerPtr alarmHandler_
 
xdaq::Application * app_
 
xdata::UnsignedInteger32 closedFiles_
 
DataSenderMonitorCollection dataSenderMonCollection_
 
bool doMonitoring_
 
DQMConsumerMonitorCollection dqmConsumerMonCollection_
 
DQMEventMonitorCollection dqmEventMonCollection_
 
EventConsumerMonitorCollection eventConsumerMonCollection_
 
FilesMonitorCollection filesMonCollection_
 
FragmentMonitorCollection fragMonCollection_
 
xdata::InfoSpace * infoSpace_
 
InfoSpaceItemNames infoSpaceItemNames_
 
utils::TimePoint_t lastMonitorAction_
 
utils::Duration_t monitoringSleepSec_
 
toolbox::task::WorkLoop * monitorWL_
 
ResourceMonitorCollection resourceMonCollection_
 
RunMonitorCollection runMonCollection_
 
SharedResourcesPtr sharedResources_
 
StateMachineMonitorCollection stateMachineMonCollection_
 
xdata::String stateName_
 
xdata::UnsignedInteger32 storedEvents_
 
StreamsMonitorCollection streamsMonCollection_
 
ThroughputMonitorCollection throughputMonCollection_
 

Detailed Description

Singleton to keep track of all monitoring and statistics issues

This class also starts the monitoring workloop to update the statistics for all MonitorCollections.

Author:
mommsen
Revision:
1.13.10.1
Date:
2011/03/07 11:33:04

Definition at line 51 of file StatisticsReporter.h.

Member Typedef Documentation

Definition at line 163 of file StatisticsReporter.h.

Constructor & Destructor Documentation

stor::StatisticsReporter::StatisticsReporter ( xdaq::Application *  app,
SharedResourcesPtr  sr 
)
explicit

Definition at line 26 of file StatisticsReporter.cc.

References reset().

29  :
30  app_(app),
31  alarmHandler_(new AlarmHandler(app)),
32  sharedResources_(sr),
33  monitoringSleepSec_(sr->configuration_->
34  getWorkerThreadParams().monitoringSleepSec_),
46  sr->configuration_->getWorkerThreadParams().throuphputAveragingCycles_),
47  monitorWL_(0),
49  {
50  reset();
54  }
double seconds()
FilesMonitorCollection filesMonCollection_
FragmentMonitorCollection fragMonCollection_
DQMConsumerMonitorCollection dqmConsumerMonCollection_
ResourceMonitorCollection resourceMonCollection_
RunMonitorCollection runMonCollection_
StreamsMonitorCollection streamsMonCollection_
DataSenderMonitorCollection dataSenderMonCollection_
SharedResourcesPtr sharedResources_
toolbox::task::WorkLoop * monitorWL_
DQMEventMonitorCollection dqmEventMonCollection_
EventConsumerMonitorCollection eventConsumerMonCollection_
xdaq::Application * app_
utils::Duration_t monitoringSleepSec_
StateMachineMonitorCollection stateMachineMonCollection_
ThroughputMonitorCollection throughputMonCollection_
stor::StatisticsReporter::~StatisticsReporter ( )
virtual

Definition at line 89 of file StatisticsReporter.cc.

References doMonitoring_, and monitorWL_.

90  {
91  // Stop the monitoring activity
92  doMonitoring_ = false;
93 
94  // Cancel the workloop (will wait until the action has finished)
95  if ( monitorWL_ && monitorWL_->isActive() ) monitorWL_->cancel();
96  }
toolbox::task::WorkLoop * monitorWL_
stor::StatisticsReporter::StatisticsReporter ( StatisticsReporter const &  )
private

Member Function Documentation

void stor::StatisticsReporter::actionPerformed ( xdata::Event &  ispaceEvent)
virtual

Update the variables put into the application info space

Definition at line 345 of file StatisticsReporter.cc.

References closedFiles_, ExpressReco_HICollisions_FallBack::e, edm::hlt::Exception, filesMonCollection_, infoSpace_, stateMachineMonCollection_, stateName_, storedEvents_, streamsMonCollection_, and stor::MonitorCollection::updateInfoSpaceItems().

346  {
347  if (ispaceEvent.type() == "ItemRetrieveEvent")
348  {
349  std::string item =
350  dynamic_cast<xdata::ItemRetrieveEvent&>(ispaceEvent).itemName();
351  if (item == "closedFiles")
352  {
354  try
355  {
356  closedFiles_.setValue( *(infoSpace_->find("closedFiles")) );
357  }
359  {
360  closedFiles_ = 0;
361  }
362  }
363  else if (item == "storedEvents")
364  {
366  try
367  {
368  storedEvents_.setValue( *(infoSpace_->find("storedEvents")) );
369  }
371  {
372  storedEvents_ = 0;
373  }
374  }
375  else if (item == "stateName")
376  {
378  try
379  {
380  stateName_.setValue( *(infoSpace_->find("stateName")) );
381  }
383  {
384  stateName_ = "unknown";
385  }
386  }
387  }
388  }
xdata::UnsignedInteger32 closedFiles_
xdata::InfoSpace * infoSpace_
FilesMonitorCollection filesMonCollection_
xdata::UnsignedInteger32 storedEvents_
StreamsMonitorCollection streamsMonCollection_
StateMachineMonitorCollection stateMachineMonCollection_
void stor::StatisticsReporter::addRunInfoQuantitiesToApplicationInfoSpace ( )
private

Definition at line 184 of file StatisticsReporter.cc.

References app_, closedFiles_, stateName_, and storedEvents_.

185  {
186  xdata::InfoSpace *infoSpace = app_->getApplicationInfoSpace();
187 
188  // bind the local xdata variables to the infospace
189  infoSpace->fireItemAvailable("stateName", &stateName_);
190  infoSpace->fireItemAvailable("storedEvents", &storedEvents_);
191  infoSpace->fireItemAvailable("closedFiles", &closedFiles_);
192 
193  // spacial handling for the monitoring values requested by the HLTSFM
194  // we want to assure that the values are current when they are queried
195  infoSpace->addItemRetrieveListener("stateName", this);
196  infoSpace->addItemRetrieveListener("storedEvents", this);
197  infoSpace->addItemRetrieveListener("closedFiles", this);
198  }
xdata::UnsignedInteger32 closedFiles_
xdata::UnsignedInteger32 storedEvents_
xdaq::Application * app_
AlarmHandlerPtr stor::StatisticsReporter::alarmHandler ( )
inline

Access alarm handler

Definition at line 153 of file StatisticsReporter.h.

References alarmHandler_.

153 { return alarmHandler_; }
void stor::StatisticsReporter::calculateStatistics ( )
private

Definition at line 254 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().

255  {
257 
269  }
TimePoint_t getCurrentTime()
Definition: Utils.h:158
FilesMonitorCollection filesMonCollection_
FragmentMonitorCollection fragMonCollection_
DQMConsumerMonitorCollection dqmConsumerMonCollection_
ResourceMonitorCollection resourceMonCollection_
RunMonitorCollection runMonCollection_
StreamsMonitorCollection streamsMonCollection_
boost::posix_time::ptime TimePoint_t
Definition: Utils.h:35
DataSenderMonitorCollection dataSenderMonCollection_
DQMEventMonitorCollection dqmEventMonCollection_
EventConsumerMonitorCollection eventConsumerMonCollection_
void calculateStatistics(const utils::TimePoint_t &now)
StateMachineMonitorCollection stateMachineMonCollection_
ThroughputMonitorCollection throughputMonCollection_
void stor::StatisticsReporter::collectInfoSpaceItems ( )
private

Definition at line 134 of file StatisticsReporter.cc.

References stor::MonitorCollection::appendInfoSpaceItems(), dataSenderMonCollection_, dqmConsumerMonCollection_, dqmEventMonCollection_, eventConsumerMonCollection_, filesMonCollection_, fragMonCollection_, infoSpaceItemNames_, putItemsIntoInfoSpace(), resourceMonCollection_, runMonCollection_, stateMachineMonCollection_, streamsMonCollection_, and throughputMonCollection_.

135  {
136  MonitorCollection::InfoSpaceItems infoSpaceItems;
137  infoSpaceItemNames_.clear();
138 
139  runMonCollection_.appendInfoSpaceItems(infoSpaceItems);
150 
151  putItemsIntoInfoSpace(infoSpaceItems);
152  }
void putItemsIntoInfoSpace(MonitorCollection::InfoSpaceItems &)
FilesMonitorCollection filesMonCollection_
FragmentMonitorCollection fragMonCollection_
DQMConsumerMonitorCollection dqmConsumerMonCollection_
ResourceMonitorCollection resourceMonCollection_
RunMonitorCollection runMonCollection_
InfoSpaceItemNames infoSpaceItemNames_
StreamsMonitorCollection streamsMonCollection_
void appendInfoSpaceItems(InfoSpaceItems &)
DataSenderMonitorCollection dataSenderMonCollection_
DQMEventMonitorCollection dqmEventMonCollection_
EventConsumerMonitorCollection eventConsumerMonCollection_
std::vector< std::pair< std::string, xdata::Serializable * > > InfoSpaceItems
StateMachineMonitorCollection stateMachineMonCollection_
ThroughputMonitorCollection throughputMonCollection_
void stor::StatisticsReporter::createMonitoringInfoSpace ( )
private

Definition at line 99 of file StatisticsReporter.cc.

References app_, ExpressReco_HICollisions_FallBack::e, edm::hlt::Exception, and infoSpace_.

100  {
101  // Create an infospace which can be monitored.
102  // The naming follows the old SM scheme.
103  // In future, the instance number should be included.
104 
105  std::ostringstream oss;
106  oss << "urn:xdaq-monitorable-" << app_->getApplicationDescriptor()->getClassName();
107 
108  std::string errorMsg =
109  "Failed to create monitoring info space " + oss.str();
110 
111  try
112  {
113  toolbox::net::URN urn = app_->createQualifiedInfoSpace(oss.str());
114  xdata::getInfoSpaceFactory()->lock();
115  infoSpace_ = xdata::getInfoSpaceFactory()->get(urn.toString());
116  xdata::getInfoSpaceFactory()->unlock();
117  }
119  {
120  xdata::getInfoSpaceFactory()->unlock();
121 
122  XCEPT_RETHROW(stor::exception::Infospace, errorMsg, e);
123  }
124  catch (...)
125  {
126  xdata::getInfoSpaceFactory()->unlock();
127 
128  errorMsg += " : unknown exception";
129  XCEPT_RAISE(stor::exception::Infospace, errorMsg);
130  }
131  }
xdata::InfoSpace * infoSpace_
xdaq::Application * app_
const DataSenderMonitorCollection& stor::StatisticsReporter::getDataSenderMonitorCollection ( ) const
inline

Definition at line 91 of file StatisticsReporter.h.

References dataSenderMonCollection_.

92  { return dataSenderMonCollection_; }
DataSenderMonitorCollection dataSenderMonCollection_
DataSenderMonitorCollection& stor::StatisticsReporter::getDataSenderMonitorCollection ( )
inline

Definition at line 94 of file StatisticsReporter.h.

References dataSenderMonCollection_.

95  { return dataSenderMonCollection_; }
DataSenderMonitorCollection dataSenderMonCollection_
const DQMConsumerMonitorCollection& stor::StatisticsReporter::getDQMConsumerMonitorCollection ( ) const
inline

Definition at line 126 of file StatisticsReporter.h.

References dqmConsumerMonCollection_.

127  { return dqmConsumerMonCollection_; }
DQMConsumerMonitorCollection dqmConsumerMonCollection_
DQMConsumerMonitorCollection& stor::StatisticsReporter::getDQMConsumerMonitorCollection ( )
inline

Definition at line 129 of file StatisticsReporter.h.

References dqmConsumerMonCollection_.

130  { return dqmConsumerMonCollection_; }
DQMConsumerMonitorCollection dqmConsumerMonCollection_
const DQMEventMonitorCollection& stor::StatisticsReporter::getDQMEventMonitorCollection ( ) const
inline

Definition at line 98 of file StatisticsReporter.h.

References dqmEventMonCollection_.

99  { return dqmEventMonCollection_; }
DQMEventMonitorCollection dqmEventMonCollection_
DQMEventMonitorCollection& stor::StatisticsReporter::getDQMEventMonitorCollection ( )
inline

Definition at line 101 of file StatisticsReporter.h.

References dqmEventMonCollection_.

102  { return dqmEventMonCollection_; }
DQMEventMonitorCollection dqmEventMonCollection_
const EventConsumerMonitorCollection& stor::StatisticsReporter::getEventConsumerMonitorCollection ( ) const
inline

Definition at line 119 of file StatisticsReporter.h.

References eventConsumerMonCollection_.

120  { return eventConsumerMonCollection_; }
EventConsumerMonitorCollection eventConsumerMonCollection_
EventConsumerMonitorCollection& stor::StatisticsReporter::getEventConsumerMonitorCollection ( )
inline

Definition at line 122 of file StatisticsReporter.h.

References eventConsumerMonCollection_.

123  { return eventConsumerMonCollection_; }
EventConsumerMonitorCollection eventConsumerMonCollection_
const FilesMonitorCollection& stor::StatisticsReporter::getFilesMonitorCollection ( ) const
inline

Definition at line 77 of file StatisticsReporter.h.

References filesMonCollection_.

78  { return filesMonCollection_; }
FilesMonitorCollection filesMonCollection_
FilesMonitorCollection& stor::StatisticsReporter::getFilesMonitorCollection ( )
inline

Definition at line 80 of file StatisticsReporter.h.

References filesMonCollection_.

81  { return filesMonCollection_; }
FilesMonitorCollection filesMonCollection_
const FragmentMonitorCollection& stor::StatisticsReporter::getFragmentMonitorCollection ( ) const
inline

Definition at line 70 of file StatisticsReporter.h.

References fragMonCollection_.

71  { return fragMonCollection_; }
FragmentMonitorCollection fragMonCollection_
FragmentMonitorCollection& stor::StatisticsReporter::getFragmentMonitorCollection ( )
inline

Definition at line 73 of file StatisticsReporter.h.

References fragMonCollection_.

74  { return fragMonCollection_; }
FragmentMonitorCollection fragMonCollection_
const ResourceMonitorCollection& stor::StatisticsReporter::getResourceMonitorCollection ( ) const
inline

Definition at line 105 of file StatisticsReporter.h.

References resourceMonCollection_.

106  { return resourceMonCollection_; }
ResourceMonitorCollection resourceMonCollection_
ResourceMonitorCollection& stor::StatisticsReporter::getResourceMonitorCollection ( )
inline

Definition at line 108 of file StatisticsReporter.h.

References resourceMonCollection_.

109  { return resourceMonCollection_; }
ResourceMonitorCollection resourceMonCollection_
const RunMonitorCollection& stor::StatisticsReporter::getRunMonitorCollection ( ) const
inline

Definition at line 63 of file StatisticsReporter.h.

References runMonCollection_.

64  { return runMonCollection_; }
RunMonitorCollection runMonCollection_
RunMonitorCollection& stor::StatisticsReporter::getRunMonitorCollection ( )
inline

Definition at line 66 of file StatisticsReporter.h.

References runMonCollection_.

67  { return runMonCollection_; }
RunMonitorCollection runMonCollection_
const StateMachineMonitorCollection& stor::StatisticsReporter::getStateMachineMonitorCollection ( ) const
inline

Definition at line 112 of file StatisticsReporter.h.

References stateMachineMonCollection_.

113  { return stateMachineMonCollection_; }
StateMachineMonitorCollection stateMachineMonCollection_
StateMachineMonitorCollection& stor::StatisticsReporter::getStateMachineMonitorCollection ( )
inline

Definition at line 115 of file StatisticsReporter.h.

References stateMachineMonCollection_.

116  { return stateMachineMonCollection_; }
StateMachineMonitorCollection stateMachineMonCollection_
const StreamsMonitorCollection& stor::StatisticsReporter::getStreamsMonitorCollection ( ) const
inline

Definition at line 84 of file StatisticsReporter.h.

References streamsMonCollection_.

85  { return streamsMonCollection_; }
StreamsMonitorCollection streamsMonCollection_
StreamsMonitorCollection& stor::StatisticsReporter::getStreamsMonitorCollection ( )
inline

Definition at line 87 of file StatisticsReporter.h.

References streamsMonCollection_.

88  { return streamsMonCollection_; }
StreamsMonitorCollection streamsMonCollection_
const ThroughputMonitorCollection& stor::StatisticsReporter::getThroughputMonitorCollection ( ) const
inline

Definition at line 133 of file StatisticsReporter.h.

References throughputMonCollection_.

134  { return throughputMonCollection_; }
ThroughputMonitorCollection throughputMonCollection_
ThroughputMonitorCollection& stor::StatisticsReporter::getThroughputMonitorCollection ( )
inline

Definition at line 136 of file StatisticsReporter.h.

References throughputMonCollection_.

137  { return throughputMonCollection_; }
ThroughputMonitorCollection throughputMonCollection_
bool stor::StatisticsReporter::monitorAction ( toolbox::task::WorkLoop *  wl)
private

Definition at line 201 of file StatisticsReporter.cc.

References app_, calculateStatistics(), doMonitoring_, ExpressReco_HICollisions_FallBack::e, cmsCodeRules.cppFunctionSkipper::exception, edm::hlt::Exception, stor::utils::getCurrentTime(), lastMonitorAction_, monitoringSleepSec_, sharedResources_, stor::utils::sleepUntil(), and updateInfoSpace().

Referenced by startWorkLoop().

202  {
205 
206  std::string errorMsg = "Failed to update the monitoring information";
207 
208  try
209  {
211  updateInfoSpace();
212  }
213  catch(exception::DiskSpaceAlarm &e)
214  {
215  sharedResources_->moveToFailedState(e);
216  }
217  catch(xcept::Exception &e)
218  {
219  LOG4CPLUS_ERROR(app_->getApplicationLogger(),
220  errorMsg << xcept::stdformat_exception_history(e));
221 
222  XCEPT_DECLARE_NESTED(stor::exception::Monitoring,
223  sentinelException, errorMsg, e);
224  app_->notifyQualified("error", sentinelException);
225  }
226  catch(std::exception &e)
227  {
228  errorMsg += ": ";
229  errorMsg += e.what();
230 
231  LOG4CPLUS_ERROR(app_->getApplicationLogger(),
232  errorMsg);
233 
234  XCEPT_DECLARE(stor::exception::Monitoring,
235  sentinelException, errorMsg);
236  app_->notifyQualified("error", sentinelException);
237  }
238  catch(...)
239  {
240  errorMsg += ": Unknown exception";
241 
242  LOG4CPLUS_ERROR(app_->getApplicationLogger(),
243  errorMsg);
244 
245  XCEPT_DECLARE(stor::exception::Monitoring,
246  sentinelException, errorMsg);
247  app_->notifyQualified("error", sentinelException);
248  }
249 
250  return doMonitoring_;
251  }
TimePoint_t getCurrentTime()
Definition: Utils.h:158
void sleepUntil(TimePoint_t)
Definition: Utils.h:168
SharedResourcesPtr sharedResources_
utils::TimePoint_t lastMonitorAction_
xdaq::Application * app_
utils::Duration_t monitoringSleepSec_
StatisticsReporter& stor::StatisticsReporter::operator= ( StatisticsReporter const &  )
private
void stor::StatisticsReporter::putItemsIntoInfoSpace ( MonitorCollection::InfoSpaceItems items)
private

Definition at line 155 of file StatisticsReporter.cc.

References ExpressReco_HICollisions_FallBack::e, edm::hlt::Exception, infoSpace_, and infoSpaceItemNames_.

Referenced by collectInfoSpaceItems().

156  {
157 
158  for ( MonitorCollection::InfoSpaceItems::const_iterator it = items.begin(),
159  itEnd = items.end();
160  it != itEnd;
161  ++it )
162  {
163  try
164  {
165  // fireItemAvailable locks the infospace internally
166  infoSpace_->fireItemAvailable(it->first, it->second);
167  }
169  {
170  std::stringstream oss;
171 
172  oss << "Failed to put " << it->first;
173  oss << " into info space " << infoSpace_->name();
174 
175  XCEPT_RETHROW(stor::exception::Monitoring, oss.str(), e);
176  }
177 
178  // keep a list of info space names for the fireItemGroupChanged
179  infoSpaceItemNames_.push_back(it->first);
180  }
181  }
xdata::InfoSpace * infoSpace_
InfoSpaceItemNames infoSpaceItemNames_
void stor::StatisticsReporter::reset ( void  )

Reset all monitored quantities

Definition at line 324 of file StatisticsReporter.cc.

References alarmHandler_, dataSenderMonCollection_, dqmConsumerMonCollection_, dqmEventMonCollection_, eventConsumerMonCollection_, filesMonCollection_, fragMonCollection_, stor::utils::getCurrentTime(), cmsPerfSuiteHarvest::now, stor::MonitorCollection::reset(), resourceMonCollection_, runMonCollection_, streamsMonCollection_, and throughputMonCollection_.

325  {
327 
328  // do not reset the stateMachineMonCollection, as we want to
329  // keep the state machine history
340 
341  alarmHandler_->clearAllAlarms();
342  }
TimePoint_t getCurrentTime()
Definition: Utils.h:158
FilesMonitorCollection filesMonCollection_
FragmentMonitorCollection fragMonCollection_
DQMConsumerMonitorCollection dqmConsumerMonCollection_
ResourceMonitorCollection resourceMonCollection_
RunMonitorCollection runMonCollection_
StreamsMonitorCollection streamsMonCollection_
boost::posix_time::ptime TimePoint_t
Definition: Utils.h:35
DataSenderMonitorCollection dataSenderMonCollection_
DQMEventMonitorCollection dqmEventMonCollection_
void reset(const utils::TimePoint_t &now)
EventConsumerMonitorCollection eventConsumerMonCollection_
ThroughputMonitorCollection throughputMonCollection_
void stor::StatisticsReporter::startWorkLoop ( std::string  workloopName)

Create and start the monitoring workloop

Definition at line 57 of file StatisticsReporter.cc.

References app_, doMonitoring_, ExpressReco_HICollisions_FallBack::e, edm::hlt::Exception, stor::utils::getCurrentTime(), stor::utils::getIdentifier(), lastMonitorAction_, monitorAction(), monitorWL_, and runTheMatrix::msg.

58  {
59  if ( !doMonitoring_ ) return;
60 
61  try
62  {
63  std::string identifier = utils::getIdentifier(app_->getApplicationDescriptor());
64 
65  monitorWL_=
66  toolbox::task::getWorkLoopFactory()->getWorkLoop(
67  identifier + workloopName, "waiting");
68 
69  if ( ! monitorWL_->isActive() )
70  {
71  toolbox::task::ActionSignature* monitorAction =
72  toolbox::task::bind(this, &StatisticsReporter::monitorAction,
73  identifier + "MonitorAction");
74  monitorWL_->submit(monitorAction);
75 
77  monitorWL_->activate();
78  }
79  }
80  catch (xcept::Exception& e)
81  {
82  const std::string msg =
83  "Failed to start workloop 'StatisticsReporter' with 'MonitorAction'.";
84  XCEPT_RETHROW(stor::exception::Monitoring, msg, e);
85  }
86  }
TimePoint_t getCurrentTime()
Definition: Utils.h:158
bool monitorAction(toolbox::task::WorkLoop *)
toolbox::task::WorkLoop * monitorWL_
utils::TimePoint_t lastMonitorAction_
std::string getIdentifier(xdaq::ApplicationDescriptor *)
Definition: Utils.cc:72
xdaq::Application * app_
void stor::StatisticsReporter::updateInfoSpace ( )
private

Definition at line 272 of file StatisticsReporter.cc.

References dataSenderMonCollection_, dqmConsumerMonCollection_, dqmEventMonCollection_, ExpressReco_HICollisions_FallBack::e, eventConsumerMonCollection_, cmsCodeRules.cppFunctionSkipper::exception, edm::hlt::Exception, filesMonCollection_, fragMonCollection_, infoSpace_, infoSpaceItemNames_, resourceMonCollection_, runMonCollection_, stateMachineMonCollection_, streamsMonCollection_, throughputMonCollection_, and stor::MonitorCollection::updateInfoSpaceItems().

Referenced by monitorAction().

273  {
274  std::string errorMsg =
275  "Failed to update values of items in info space " + infoSpace_->name();
276 
277  // Lock the infospace to assure that all items are consistent
278  try
279  {
280  infoSpace_->lock();
281 
293 
294  infoSpace_->unlock();
295  }
296  catch(std::exception &e)
297  {
298  infoSpace_->unlock();
299 
300  errorMsg += ": ";
301  errorMsg += e.what();
302  XCEPT_RAISE(stor::exception::Monitoring, errorMsg);
303  }
304  catch (...)
305  {
306  infoSpace_->unlock();
307 
308  errorMsg += " : unknown exception";
309  XCEPT_RAISE(stor::exception::Monitoring, errorMsg);
310  }
311 
312  try
313  {
314  // The fireItemGroupChanged locks the infospace
315  infoSpace_->fireItemGroupChanged(infoSpaceItemNames_, this);
316  }
317  catch (xdata::exception::Exception &e)
318  {
319  XCEPT_RETHROW(stor::exception::Monitoring, errorMsg, e);
320  }
321  }
xdata::InfoSpace * infoSpace_
FilesMonitorCollection filesMonCollection_
FragmentMonitorCollection fragMonCollection_
DQMConsumerMonitorCollection dqmConsumerMonCollection_
ResourceMonitorCollection resourceMonCollection_
RunMonitorCollection runMonCollection_
InfoSpaceItemNames infoSpaceItemNames_
StreamsMonitorCollection streamsMonCollection_
DataSenderMonitorCollection dataSenderMonCollection_
DQMEventMonitorCollection dqmEventMonCollection_
EventConsumerMonitorCollection eventConsumerMonCollection_
StateMachineMonitorCollection stateMachineMonCollection_
ThroughputMonitorCollection throughputMonCollection_

Member Data Documentation

AlarmHandlerPtr stor::StatisticsReporter::alarmHandler_
private

Definition at line 178 of file StatisticsReporter.h.

Referenced by alarmHandler(), and reset().

xdaq::Application* stor::StatisticsReporter::app_
private
xdata::UnsignedInteger32 stor::StatisticsReporter::closedFiles_
private
DataSenderMonitorCollection stor::StatisticsReporter::dataSenderMonCollection_
private
bool stor::StatisticsReporter::doMonitoring_
private

Definition at line 195 of file StatisticsReporter.h.

Referenced by monitorAction(), startWorkLoop(), and ~StatisticsReporter().

DQMConsumerMonitorCollection stor::StatisticsReporter::dqmConsumerMonCollection_
private
DQMEventMonitorCollection stor::StatisticsReporter::dqmEventMonCollection_
private
EventConsumerMonitorCollection stor::StatisticsReporter::eventConsumerMonCollection_
private
FilesMonitorCollection stor::StatisticsReporter::filesMonCollection_
private
FragmentMonitorCollection stor::StatisticsReporter::fragMonCollection_
private
xdata::InfoSpace* stor::StatisticsReporter::infoSpace_
private
InfoSpaceItemNames stor::StatisticsReporter::infoSpaceItemNames_
private
utils::TimePoint_t stor::StatisticsReporter::lastMonitorAction_
private

Definition at line 181 of file StatisticsReporter.h.

Referenced by monitorAction(), and startWorkLoop().

utils::Duration_t stor::StatisticsReporter::monitoringSleepSec_
private

Definition at line 180 of file StatisticsReporter.h.

Referenced by monitorAction().

toolbox::task::WorkLoop* stor::StatisticsReporter::monitorWL_
private

Definition at line 194 of file StatisticsReporter.h.

Referenced by startWorkLoop(), and ~StatisticsReporter().

ResourceMonitorCollection stor::StatisticsReporter::resourceMonCollection_
private
RunMonitorCollection stor::StatisticsReporter::runMonCollection_
private
SharedResourcesPtr stor::StatisticsReporter::sharedResources_
private

Definition at line 179 of file StatisticsReporter.h.

Referenced by monitorAction().

StateMachineMonitorCollection stor::StatisticsReporter::stateMachineMonCollection_
private
xdata::String stor::StatisticsReporter::stateName_
private
xdata::UnsignedInteger32 stor::StatisticsReporter::storedEvents_
private
StreamsMonitorCollection stor::StatisticsReporter::streamsMonCollection_
private
ThroughputMonitorCollection stor::StatisticsReporter::throughputMonCollection_
private