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, AlarmHandlerPtr, 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

AlarmHandlerPtr alarmHandler_
 
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.12.6.1
Date:
2011/03/07 11:33:04

Definition at line 28 of file RunMonitorCollection.h.

Member Typedef Documentation

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

Definition at line 119 of file RunMonitorCollection.h.

Constructor & Destructor Documentation

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

Definition at line 20 of file RunMonitorCollection.cc.

24  :
25  MonitorCollection(updateInterval),
29  runNumbersSeen_(updateInterval, boost::posix_time::seconds(1)),
31  eolsSeen_(updateInterval, boost::posix_time::seconds(1)),
32  alarmHandler_(ah),
34  {}
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 102 of file RunMonitorCollection.cc.

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

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

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

Definition at line 138 of file RunMonitorCollection.cc.

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

Referenced by checkForBadEvents().

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

Definition at line 163 of file RunMonitorCollection.cc.

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

Referenced by checkForBadEvents().

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

Definition at line 128 of file RunMonitorCollection.cc.

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

Referenced by do_calculateStatistics().

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

Definition at line 37 of file RunMonitorCollection.cc.

References alarmParams_.

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

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

Reimplemented from stor::MonitorCollection.

Definition at line 69 of file RunMonitorCollection.cc.

References dataEvents_, errorEvents_, runNumber_, and unwantedEvents_.

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

Implements stor::MonitorCollection.

Definition at line 43 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 78 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_.

79  {
80  MonitoredQuantity::Stats runNumberStats;
81  runNumbersSeen_.getStats(runNumberStats);
82  runNumber_ = static_cast<xdata::UnsignedInteger32>(
83  static_cast<unsigned int>(runNumberStats.getLastSampleValue()));
84 
85  MonitoredQuantity::Stats eventIDsReceivedStats;
86  eventIDsReceived_.getStats(eventIDsReceivedStats);
87  dataEvents_ = static_cast<xdata::UnsignedInteger32>(
88  static_cast<unsigned int>(eventIDsReceivedStats.getSampleCount()));
89 
90  MonitoredQuantity::Stats errorEventIDsReceivedStats;
91  errorEventIDsReceived_.getStats(errorEventIDsReceivedStats);
92  errorEvents_ = static_cast<xdata::UnsignedInteger32>(
93  static_cast<unsigned int>(errorEventIDsReceivedStats.getSampleCount()));
94 
95  MonitoredQuantity::Stats unwantedEventStats;
96  unwantedEventIDsReceived_.getStats(unwantedEventStats);
97  unwantedEvents_ = static_cast<xdata::UnsignedInteger32>(
98  static_cast<unsigned int>(unwantedEventStats.getSampleCount()));
99  }
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 79 of file RunMonitorCollection.h.

References eolsSeen_.

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

Definition at line 51 of file RunMonitorCollection.h.

References errorEventIDsReceived_.

51  {
53  }
MonitoredQuantity errorEventIDsReceived_
const MonitoredQuantity& stor::RunMonitorCollection::getEventIDsReceivedMQ ( ) const
inline
MonitoredQuantity& stor::RunMonitorCollection::getEventIDsReceivedMQ ( )
inline

Definition at line 44 of file RunMonitorCollection.h.

References eventIDsReceived_.

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

Definition at line 72 of file RunMonitorCollection.h.

References lumiSectionsSeen_.

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

Definition at line 65 of file RunMonitorCollection.h.

References runNumbersSeen_.

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

Definition at line 55 of file RunMonitorCollection.h.

References unwantedEventIDsReceived_.

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

55  {
57  }
MonitoredQuantity unwantedEventIDsReceived_
MonitoredQuantity& stor::RunMonitorCollection::getUnwantedEventIDsReceivedMQ ( )
inline

Definition at line 58 of file RunMonitorCollection.h.

References unwantedEventIDsReceived_.

58  {
60  }
MonitoredQuantity unwantedEventIDsReceived_
RunMonitorCollection& stor::RunMonitorCollection::operator= ( RunMonitorCollection const &  )
private

Member Data Documentation

AlarmHandlerPtr stor::RunMonitorCollection::alarmHandler_
private

Definition at line 99 of file RunMonitorCollection.h.

Referenced by alarmErrorEvents(), and alarmUnwantedEvents().

AlarmParams stor::RunMonitorCollection::alarmParams_
private

Definition at line 132 of file RunMonitorCollection.h.

Referenced by alarmErrorEvents(), alarmUnwantedEvents(), and configureAlarms().

xdata::UnsignedInteger32 stor::RunMonitorCollection::dataEvents_
private

Definition at line 128 of file RunMonitorCollection.h.

Referenced by do_appendInfoSpaceItems(), and do_updateInfoSpaceItems().

MonitoredQuantity stor::RunMonitorCollection::eolsSeen_
private

Definition at line 97 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 129 of file RunMonitorCollection.h.

Referenced by do_appendInfoSpaceItems(), and do_updateInfoSpaceItems().

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

Definition at line 96 of file RunMonitorCollection.h.

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

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

Definition at line 127 of file RunMonitorCollection.h.

Referenced by do_appendInfoSpaceItems(), and do_updateInfoSpaceItems().

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

Definition at line 100 of file RunMonitorCollection.h.

Referenced by alarmUnwantedEvents().

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

Definition at line 121 of file RunMonitorCollection.h.

Referenced by addUnwantedEvent(), and checkForBadEvents().

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

Definition at line 130 of file RunMonitorCollection.h.

Referenced by do_appendInfoSpaceItems(), and do_updateInfoSpaceItems().

UnwantedEventsMap stor::RunMonitorCollection::unwantedEventsMap_
private

Definition at line 120 of file RunMonitorCollection.h.

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