CMS 3D CMS Logo

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

#include <RunMonitorCollection.h>

Inheritance diagram for stor::RunMonitorCollection:
stor::MonitorCollection

Classes

struct  UnwantedEvent
 

Public Member Functions

void addUnwantedEvent (const I2OChain &)
 
void configureAlarms (AlarmParams const &)
 
const MonitoredQuantitygetEoLSSeenMQ () const
 
MonitoredQuantitygetEoLSSeenMQ ()
 
const MonitoredQuantitygetErrorEventIDsReceivedMQ () const
 
MonitoredQuantitygetErrorEventIDsReceivedMQ ()
 
const MonitoredQuantitygetEventIDsReceivedMQ () const
 
MonitoredQuantitygetEventIDsReceivedMQ ()
 
const MonitoredQuantitygetLumiSectionsSeenMQ () const
 
MonitoredQuantitygetLumiSectionsSeenMQ ()
 
const MonitoredQuantitygetRunNumbersSeenMQ () const
 
MonitoredQuantitygetRunNumbersSeenMQ ()
 
const MonitoredQuantitygetUnwantedEventIDsReceivedMQ () const
 
MonitoredQuantitygetUnwantedEventIDsReceivedMQ ()
 
 RunMonitorCollection (const utils::Duration_t &updateInterval, SharedResourcesPtr)
 
- Public Member Functions inherited from stor::MonitorCollection
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 ()
 

Private Types

typedef std::map< uint32_t,
UnwantedEvent
UnwantedEventsMap
 

Private Member Functions

void alarmErrorEvents ()
 
void alarmUnwantedEvents (UnwantedEventsMap::value_type &)
 
void checkForBadEvents ()
 
virtual void do_appendInfoSpaceItems (InfoSpaceItems &)
 
virtual void do_calculateStatistics ()
 
virtual void do_reset ()
 
virtual void do_updateInfoSpaceItems ()
 
RunMonitorCollectionoperator= (RunMonitorCollection const &)
 
 RunMonitorCollection (RunMonitorCollection const &)
 

Private Attributes

AlarmParams alarmParams_
 
xdata::UnsignedInteger32 dataEvents_
 
MonitoredQuantity eolsSeen_
 
MonitoredQuantity errorEventIDsReceived_
 
xdata::UnsignedInteger32 errorEvents_
 
MonitoredQuantity eventIDsReceived_
 
MonitoredQuantity lumiSectionsSeen_
 
xdata::UnsignedInteger32 runNumber_
 
MonitoredQuantity runNumbersSeen_
 
SharedResourcesPtr sharedResources_
 
MonitoredQuantity unwantedEventIDsReceived_
 
boost::mutex unwantedEventMapLock_
 
xdata::UnsignedInteger32 unwantedEvents_
 
UnwantedEventsMap unwantedEventsMap_
 

Additional Inherited Members

- Public Types inherited from stor::MonitorCollection
typedef std::vector< std::pair
< std::string,
xdata::Serializable * > > 
InfoSpaceItems
 

Detailed Description

A collection of MonitoredQuantities related to events received in the current run

Author:
mommsen
Revision:
1.14
Date:
2011/11/08 10:48:40

Definition at line 28 of file RunMonitorCollection.h.

Member Typedef Documentation

typedef std::map<uint32_t, UnwantedEvent> stor::RunMonitorCollection::UnwantedEventsMap
private

Definition at line 117 of file RunMonitorCollection.h.

Constructor & Destructor Documentation

stor::RunMonitorCollection::RunMonitorCollection ( const utils::Duration_t updateInterval,
SharedResourcesPtr  sr 
)

Definition at line 20 of file RunMonitorCollection.cc.

23  :
24  MonitorCollection(updateInterval),
28  runNumbersSeen_(updateInterval, boost::posix_time::seconds(1)),
30  eolsSeen_(updateInterval, boost::posix_time::seconds(1)),
32  {}
double seconds()
MonitoredQuantity errorEventIDsReceived_
MonitoredQuantity lumiSectionsSeen_
SharedResourcesPtr sharedResources_
MonitoredQuantity unwantedEventIDsReceived_
MonitorCollection(const utils::Duration_t &updateInterval)
MonitoredQuantity eventIDsReceived_
stor::RunMonitorCollection::RunMonitorCollection ( RunMonitorCollection const &  )
private

Member Function Documentation

void stor::RunMonitorCollection::addUnwantedEvent ( const I2OChain ioc)

Definition at line 100 of file RunMonitorCollection.cc.

References stor::MonitoredQuantity::addSample(), alarmParams_, stor::AlarmParams::careAboutUnwantedEvents_, stor::I2OChain::complete(), stor::I2OChain::eventNumber(), stor::I2OChain::faulty(), stor::I2OChain::outputModuleId(), pos, unwantedEventIDsReceived_, unwantedEventMapLock_, and unwantedEventsMap_.

Referenced by stor::EventDistributor::addEventToRelevantQueues().

101  {
102  if ( ! alarmParams_.careAboutUnwantedEvents_ ) return;
103  if ( ioc.faulty() || !ioc.complete() ) return;
104 
105  unwantedEventIDsReceived_.addSample(ioc.eventNumber());
106 
107  uint32_t outputModuleId = ioc.outputModuleId();
108 
109  boost::mutex::scoped_lock sl(unwantedEventMapLock_);
110 
111  UnwantedEventsMap::iterator pos = unwantedEventsMap_.lower_bound(outputModuleId);
112 
113  if(pos != unwantedEventsMap_.end() &&
114  !(unwantedEventsMap_.key_comp()(outputModuleId, pos->first)))
115  {
116  // key already exists
117  ++(pos->second.count);
118  }
119  else
120  {
121  UnwantedEvent newEvent(ioc);
122  unwantedEventsMap_.insert(pos, UnwantedEventsMap::value_type(outputModuleId, newEvent));
123  }
124  }
void addSample(const double &value=1)
UnwantedEventsMap unwantedEventsMap_
Container::value_type value_type
MonitoredQuantity unwantedEventIDsReceived_
void stor::RunMonitorCollection::alarmErrorEvents ( )
private

Definition at line 137 of file RunMonitorCollection.cc.

References alarmParams_, prof2calltree::count, stor::AlarmHandler::ERROR, errorEventIDsReceived_, stor::AlarmParams::errorEvents_, stor::MonitoredQuantity::Stats::getDuration(), stor::MonitoredQuantity::Stats::getSampleCount(), stor::MonitoredQuantity::getStats(), stor::AlarmParams::isProductionSystem_, lumiQueryAPI::msg, stor::MonitoredQuantity::RECENT, sharedResources_, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by checkForBadEvents().

138  {
139  if ( ! alarmParams_.isProductionSystem_ ) return;
140 
141  const std::string alarmName("ErrorEvents");
142 
143  MonitoredQuantity::Stats stats;
145  long long count = stats.getSampleCount(MonitoredQuantity::RECENT);
146 
147  if ( count >= alarmParams_.errorEvents_ )
148  {
149  std::ostringstream msg;
150  msg << "Received " << count << " error events in the last "
151  << stats.getDuration(MonitoredQuantity::RECENT).total_seconds() << "s.";
152  XCEPT_DECLARE( stor::exception::ErrorEvents, xcept, msg.str() );
153  sharedResources_->alarmHandler_->raiseAlarm( alarmName, AlarmHandler::ERROR, xcept );
154  }
155  else
156  {
157  sharedResources_->alarmHandler_->revokeAlarm( alarmName );
158  }
159  }
MonitoredQuantity errorEventIDsReceived_
void getStats(Stats &stats) const
SharedResourcesPtr sharedResources_
unsigned int errorEvents_
void stor::RunMonitorCollection::alarmUnwantedEvents ( UnwantedEventsMap::value_type &  val)
private

Definition at line 162 of file RunMonitorCollection.cc.

References alarmParams_, stor::AlarmHandler::ERROR, stor::AlarmParams::isProductionSystem_, lumiQueryAPI::msg, sharedResources_, evf::utils::state, and stor::AlarmParams::unwantedEvents_.

Referenced by checkForBadEvents().

163  {
164  if ( ! alarmParams_.isProductionSystem_ ) return;
165 
166  if ( (val.second.count - val.second.previousCount) > alarmParams_.unwantedEvents_ )
167  {
168  std::ostringstream msg;
169  msg << "Received " << val.second.count << " events"
170  << " not tagged for any stream or consumer."
171  << " Output module " <<
172  sharedResources_->initMsgCollection_->getOutputModuleName(val.first)
173  << " (id " << val.first << ")"
174  << " HLT trigger bits: ";
175 
176  // This code snipped taken from evm:EventSelector::acceptEvent
177  int byteIndex = 0;
178  int subIndex = 0;
179  for (unsigned int pathIndex = 0;
180  pathIndex < val.second.hltTriggerCount;
181  ++pathIndex)
182  {
183  int state = val.second.bitList[byteIndex] >> (subIndex * 2);
184  state &= 0x3;
185  msg << state << " ";
186  ++subIndex;
187  if (subIndex == 4)
188  { ++byteIndex;
189  subIndex = 0;
190  }
191  }
192 
193  XCEPT_DECLARE( stor::exception::UnwantedEvents, xcept, msg.str() );
194  sharedResources_->alarmHandler_->raiseAlarm( val.second.alarmName, AlarmHandler::ERROR, xcept );
195 
196  val.second.previousCount = val.second.count;
197  }
198  else if (val.second.count == val.second.previousCount)
199  // no more unwanted events arrived
200  {
201  sharedResources_->alarmHandler_->revokeAlarm( val.second.alarmName );
202  }
203  }
unsigned int unwantedEvents_
SharedResourcesPtr sharedResources_
char state
Definition: procUtils.cc:75
void stor::RunMonitorCollection::checkForBadEvents ( )
private

Definition at line 127 of file RunMonitorCollection.cc.

References alarmErrorEvents(), alarmUnwantedEvents(), unwantedEventMapLock_, and unwantedEventsMap_.

Referenced by do_calculateStatistics().

128  {
130 
131  boost::mutex::scoped_lock sl(unwantedEventMapLock_);
132  std::for_each(unwantedEventsMap_.begin(), unwantedEventsMap_.end(),
133  boost::bind(&RunMonitorCollection::alarmUnwantedEvents, this, _1));
134  }
UnwantedEventsMap unwantedEventsMap_
void alarmUnwantedEvents(UnwantedEventsMap::value_type &)
void stor::RunMonitorCollection::configureAlarms ( AlarmParams const &  alarmParams)

Definition at line 35 of file RunMonitorCollection.cc.

References alarmParams_.

Referenced by stor::Ready::do_entryActionWork().

36  {
37  alarmParams_ = alarmParams;
38  }
void stor::RunMonitorCollection::do_appendInfoSpaceItems ( InfoSpaceItems infoSpaceItems)
privatevirtual

Reimplemented from stor::MonitorCollection.

Definition at line 67 of file RunMonitorCollection.cc.

References dataEvents_, errorEvents_, runNumber_, and unwantedEvents_.

68  {
69  infoSpaceItems.push_back(std::make_pair("runNumber", &runNumber_));
70  infoSpaceItems.push_back(std::make_pair("dataEvents", &dataEvents_));
71  infoSpaceItems.push_back(std::make_pair("errorEvents", &errorEvents_));
72  infoSpaceItems.push_back(std::make_pair("unwantedEvents", &unwantedEvents_));
73  }
xdata::UnsignedInteger32 dataEvents_
xdata::UnsignedInteger32 runNumber_
xdata::UnsignedInteger32 unwantedEvents_
xdata::UnsignedInteger32 errorEvents_
void stor::RunMonitorCollection::do_calculateStatistics ( )
privatevirtual

Implements stor::MonitorCollection.

Definition at line 41 of file RunMonitorCollection.cc.

References stor::MonitoredQuantity::calculateStatistics(), checkForBadEvents(), eolsSeen_, errorEventIDsReceived_, eventIDsReceived_, lumiSectionsSeen_, runNumbersSeen_, and unwantedEventIDsReceived_.

void stor::RunMonitorCollection::do_reset ( )
privatevirtual
void stor::RunMonitorCollection::do_updateInfoSpaceItems ( )
privatevirtual

Reimplemented from stor::MonitorCollection.

Definition at line 76 of file RunMonitorCollection.cc.

References dataEvents_, errorEventIDsReceived_, errorEvents_, eventIDsReceived_, stor::MonitoredQuantity::Stats::getLastSampleValue(), stor::MonitoredQuantity::Stats::getSampleCount(), stor::MonitoredQuantity::getStats(), runNumber_, runNumbersSeen_, unwantedEventIDsReceived_, and unwantedEvents_.

77  {
78  MonitoredQuantity::Stats runNumberStats;
79  runNumbersSeen_.getStats(runNumberStats);
80  runNumber_ = static_cast<xdata::UnsignedInteger32>(
81  static_cast<unsigned int>(runNumberStats.getLastSampleValue()));
82 
83  MonitoredQuantity::Stats eventIDsReceivedStats;
84  eventIDsReceived_.getStats(eventIDsReceivedStats);
85  dataEvents_ = static_cast<xdata::UnsignedInteger32>(
86  static_cast<unsigned int>(eventIDsReceivedStats.getSampleCount()));
87 
88  MonitoredQuantity::Stats errorEventIDsReceivedStats;
89  errorEventIDsReceived_.getStats(errorEventIDsReceivedStats);
90  errorEvents_ = static_cast<xdata::UnsignedInteger32>(
91  static_cast<unsigned int>(errorEventIDsReceivedStats.getSampleCount()));
92 
93  MonitoredQuantity::Stats unwantedEventStats;
94  unwantedEventIDsReceived_.getStats(unwantedEventStats);
95  unwantedEvents_ = static_cast<xdata::UnsignedInteger32>(
96  static_cast<unsigned int>(unwantedEventStats.getSampleCount()));
97  }
xdata::UnsignedInteger32 dataEvents_
xdata::UnsignedInteger32 runNumber_
MonitoredQuantity errorEventIDsReceived_
void getStats(Stats &stats) const
xdata::UnsignedInteger32 unwantedEvents_
MonitoredQuantity unwantedEventIDsReceived_
MonitoredQuantity eventIDsReceived_
xdata::UnsignedInteger32 errorEvents_
const MonitoredQuantity& stor::RunMonitorCollection::getEoLSSeenMQ ( ) const
inline
MonitoredQuantity& stor::RunMonitorCollection::getEoLSSeenMQ ( )
inline

Definition at line 78 of file RunMonitorCollection.h.

References eolsSeen_.

78  {
79  return eolsSeen_;
80  }
const MonitoredQuantity& stor::RunMonitorCollection::getErrorEventIDsReceivedMQ ( ) const
inline
MonitoredQuantity& stor::RunMonitorCollection::getErrorEventIDsReceivedMQ ( )
inline

Definition at line 50 of file RunMonitorCollection.h.

References errorEventIDsReceived_.

50  {
52  }
MonitoredQuantity errorEventIDsReceived_
const MonitoredQuantity& stor::RunMonitorCollection::getEventIDsReceivedMQ ( ) const
inline
MonitoredQuantity& stor::RunMonitorCollection::getEventIDsReceivedMQ ( )
inline

Definition at line 43 of file RunMonitorCollection.h.

References eventIDsReceived_.

43  {
44  return eventIDsReceived_;
45  }
MonitoredQuantity eventIDsReceived_
const MonitoredQuantity& stor::RunMonitorCollection::getLumiSectionsSeenMQ ( ) const
inline
MonitoredQuantity& stor::RunMonitorCollection::getLumiSectionsSeenMQ ( )
inline

Definition at line 71 of file RunMonitorCollection.h.

References lumiSectionsSeen_.

71  {
72  return lumiSectionsSeen_;
73  }
MonitoredQuantity lumiSectionsSeen_
const MonitoredQuantity& stor::RunMonitorCollection::getRunNumbersSeenMQ ( ) const
inline
MonitoredQuantity& stor::RunMonitorCollection::getRunNumbersSeenMQ ( )
inline

Definition at line 64 of file RunMonitorCollection.h.

References runNumbersSeen_.

64  {
65  return runNumbersSeen_;
66  }
const MonitoredQuantity& stor::RunMonitorCollection::getUnwantedEventIDsReceivedMQ ( ) const
inline

Definition at line 54 of file RunMonitorCollection.h.

References unwantedEventIDsReceived_.

Referenced by stor::SMWebPageHelper::addDOMforRunMonitor().

54  {
56  }
MonitoredQuantity unwantedEventIDsReceived_
MonitoredQuantity& stor::RunMonitorCollection::getUnwantedEventIDsReceivedMQ ( )
inline

Definition at line 57 of file RunMonitorCollection.h.

References unwantedEventIDsReceived_.

57  {
59  }
MonitoredQuantity unwantedEventIDsReceived_
RunMonitorCollection& stor::RunMonitorCollection::operator= ( RunMonitorCollection const &  )
private

Member Data Documentation

AlarmParams stor::RunMonitorCollection::alarmParams_
private
xdata::UnsignedInteger32 stor::RunMonitorCollection::dataEvents_
private

Definition at line 126 of file RunMonitorCollection.h.

Referenced by do_appendInfoSpaceItems(), and do_updateInfoSpaceItems().

MonitoredQuantity stor::RunMonitorCollection::eolsSeen_
private

Definition at line 96 of file RunMonitorCollection.h.

Referenced by do_calculateStatistics(), do_reset(), and getEoLSSeenMQ().

MonitoredQuantity stor::RunMonitorCollection::errorEventIDsReceived_
private
xdata::UnsignedInteger32 stor::RunMonitorCollection::errorEvents_
private

Definition at line 127 of file RunMonitorCollection.h.

Referenced by do_appendInfoSpaceItems(), and do_updateInfoSpaceItems().

MonitoredQuantity stor::RunMonitorCollection::eventIDsReceived_
private
MonitoredQuantity stor::RunMonitorCollection::lumiSectionsSeen_
private

Definition at line 95 of file RunMonitorCollection.h.

Referenced by do_calculateStatistics(), do_reset(), and getLumiSectionsSeenMQ().

xdata::UnsignedInteger32 stor::RunMonitorCollection::runNumber_
private

Definition at line 125 of file RunMonitorCollection.h.

Referenced by do_appendInfoSpaceItems(), and do_updateInfoSpaceItems().

MonitoredQuantity stor::RunMonitorCollection::runNumbersSeen_
private
SharedResourcesPtr stor::RunMonitorCollection::sharedResources_
private

Definition at line 98 of file RunMonitorCollection.h.

Referenced by alarmErrorEvents(), and alarmUnwantedEvents().

MonitoredQuantity stor::RunMonitorCollection::unwantedEventIDsReceived_
private
boost::mutex stor::RunMonitorCollection::unwantedEventMapLock_
mutableprivate

Definition at line 119 of file RunMonitorCollection.h.

Referenced by addUnwantedEvent(), and checkForBadEvents().

xdata::UnsignedInteger32 stor::RunMonitorCollection::unwantedEvents_
private

Definition at line 128 of file RunMonitorCollection.h.

Referenced by do_appendInfoSpaceItems(), and do_updateInfoSpaceItems().

UnwantedEventsMap stor::RunMonitorCollection::unwantedEventsMap_
private

Definition at line 118 of file RunMonitorCollection.h.

Referenced by addUnwantedEvent(), checkForBadEvents(), and do_reset().