CMS 3D CMS Logo

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

List of all members.

Classes

struct  UnwantedEvent

Public Member Functions

void addUnwantedEvent (const I2OChain &)
void configureAlarms (AlarmParams const &)
MonitoredQuantitygetEoLSSeenMQ ()
const MonitoredQuantitygetEoLSSeenMQ () const
const MonitoredQuantitygetErrorEventIDsReceivedMQ () const
MonitoredQuantitygetErrorEventIDsReceivedMQ ()
MonitoredQuantitygetEventIDsReceivedMQ ()
const MonitoredQuantitygetEventIDsReceivedMQ () const
MonitoredQuantitygetLumiSectionsSeenMQ ()
const MonitoredQuantitygetLumiSectionsSeenMQ () const
const MonitoredQuantitygetRunNumbersSeenMQ () const
MonitoredQuantitygetRunNumbersSeenMQ ()
MonitoredQuantitygetUnwantedEventIDsReceivedMQ ()
const MonitoredQuantitygetUnwantedEventIDsReceivedMQ () const
 RunMonitorCollection (const utils::Duration_t &updateInterval, AlarmHandlerPtr, SharedResourcesPtr)

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_

Detailed Description

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

Author:
mommsen
Revision:
1.13
Date:
2011/03/07 15:31:32

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 
)
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().

  {
    if ( ioc.faulty() || !ioc.complete() ) return;
    
    unwantedEventIDsReceived_.addSample(ioc.eventNumber());
    
    uint32_t outputModuleId = ioc.outputModuleId();
    
    boost::mutex::scoped_lock sl(unwantedEventMapLock_);
    
    UnwantedEventsMap::iterator pos = unwantedEventsMap_.lower_bound(outputModuleId);
    
    if(pos != unwantedEventsMap_.end() &&
      !(unwantedEventsMap_.key_comp()(outputModuleId, pos->first)))
    {
      // key already exists
      ++(pos->second.count);
    }
    else
    {
      UnwantedEvent newEvent(ioc);
      unwantedEventsMap_.insert(pos, UnwantedEventsMap::value_type(outputModuleId, newEvent));
    }
  }
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().

  {
    if ( ! alarmParams_.isProductionSystem_ ) return;
    
    const std::string alarmName("ErrorEvents");
    
    MonitoredQuantity::Stats stats;
    errorEventIDsReceived_.getStats(stats);
    long long count = stats.getSampleCount(MonitoredQuantity::RECENT);
    
    if ( count >= alarmParams_.errorEvents_ )
    {
      std::ostringstream msg;
      msg << "Received " << count << " error events in the last "
        << stats.getDuration(MonitoredQuantity::RECENT).total_seconds() << "s.";
      XCEPT_DECLARE( stor::exception::ErrorEvents, xcept, msg.str() );
      alarmHandler_->raiseAlarm( alarmName, AlarmHandler::ERROR, xcept );
    }
    else
    {
      alarmHandler_->revokeAlarm( alarmName );
    }
  }
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_, and stor::AlarmParams::unwantedEvents_.

Referenced by checkForBadEvents().

  {
    if ( ! alarmParams_.isProductionSystem_ ) return;
    
    if ( (val.second.count - val.second.previousCount) > alarmParams_.unwantedEvents_ )
    {
      std::ostringstream msg;
      msg << "Received " << val.second.count << " events"
        << " not tagged for any stream or consumer."
        << " Output module " << 
        sharedResources_->initMsgCollection_->getOutputModuleName(val.first)
        << " (id " << val.first << ")"
        << " HLT trigger bits: ";
      
      // This code snipped taken from evm:EventSelector::acceptEvent
      int byteIndex = 0;
      int subIndex  = 0;
      for (unsigned int pathIndex = 0;
           pathIndex < val.second.hltTriggerCount;
           ++pathIndex)
      {
        int state = val.second.bitList[byteIndex] >> (subIndex * 2);
        state &= 0x3;
        msg << state << " ";
        ++subIndex;
        if (subIndex == 4)
        { ++byteIndex;
          subIndex = 0;
        }
      }
      
      XCEPT_DECLARE( stor::exception::UnwantedEvents, xcept, msg.str() );
      alarmHandler_->raiseAlarm( val.second.alarmName, AlarmHandler::ERROR, xcept );
      
      val.second.previousCount = val.second.count;
    }
    else if (val.second.count == val.second.previousCount)
      // no more unwanted events arrived
    {
      alarmHandler_->revokeAlarm( val.second.alarmName );
    }
  }
void stor::RunMonitorCollection::checkForBadEvents ( ) [private]

Definition at line 128 of file RunMonitorCollection.cc.

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

Referenced by do_calculateStatistics().

  {
    alarmErrorEvents();
    
    boost::mutex::scoped_lock sl(unwantedEventMapLock_);
    std::for_each(unwantedEventsMap_.begin(), unwantedEventsMap_.end(),
      boost::bind(&RunMonitorCollection::alarmUnwantedEvents, this, _1));
  }
void stor::RunMonitorCollection::configureAlarms ( AlarmParams const &  alarmParams)

Definition at line 37 of file RunMonitorCollection.cc.

References alarmParams_.

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

  {
    alarmParams_ = alarmParams;
  }
void stor::RunMonitorCollection::do_appendInfoSpaceItems ( InfoSpaceItems infoSpaceItems) [private, virtual]

Reimplemented from stor::MonitorCollection.

Definition at line 69 of file RunMonitorCollection.cc.

References dataEvents_, errorEvents_, runNumber_, and unwantedEvents_.

  {
    infoSpaceItems.push_back(std::make_pair("runNumber", &runNumber_));
    infoSpaceItems.push_back(std::make_pair("dataEvents", &dataEvents_));
    infoSpaceItems.push_back(std::make_pair("errorEvents", &errorEvents_));
    infoSpaceItems.push_back(std::make_pair("unwantedEvents", &unwantedEvents_));
  }
void stor::RunMonitorCollection::do_calculateStatistics ( ) [private, virtual]

Implements stor::MonitorCollection.

Definition at line 43 of file RunMonitorCollection.cc.

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

  {
    eventIDsReceived_.calculateStatistics();
    errorEventIDsReceived_.calculateStatistics();
    unwantedEventIDsReceived_.calculateStatistics();
    runNumbersSeen_.calculateStatistics();
    lumiSectionsSeen_.calculateStatistics();
    eolsSeen_.calculateStatistics();
    
    checkForBadEvents();
  }
void stor::RunMonitorCollection::do_reset ( ) [private, virtual]
void stor::RunMonitorCollection::do_updateInfoSpaceItems ( ) [private, virtual]

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_.

  {
    MonitoredQuantity::Stats runNumberStats;
    runNumbersSeen_.getStats(runNumberStats);
    runNumber_ = static_cast<xdata::UnsignedInteger32>(
      static_cast<unsigned int>(runNumberStats.getLastSampleValue()));
    
    MonitoredQuantity::Stats eventIDsReceivedStats;
    eventIDsReceived_.getStats(eventIDsReceivedStats);
    dataEvents_ = static_cast<xdata::UnsignedInteger32>(
      static_cast<unsigned int>(eventIDsReceivedStats.getSampleCount()));
    
    MonitoredQuantity::Stats errorEventIDsReceivedStats;
    errorEventIDsReceived_.getStats(errorEventIDsReceivedStats);
    errorEvents_ = static_cast<xdata::UnsignedInteger32>(
      static_cast<unsigned int>(errorEventIDsReceivedStats.getSampleCount()));
    
    MonitoredQuantity::Stats unwantedEventStats;
    unwantedEventIDsReceived_.getStats(unwantedEventStats);
    unwantedEvents_ = static_cast<xdata::UnsignedInteger32>(
      static_cast<unsigned int>(unwantedEventStats.getSampleCount()));
  }
MonitoredQuantity& stor::RunMonitorCollection::getEoLSSeenMQ ( ) [inline]

Definition at line 79 of file RunMonitorCollection.h.

References eolsSeen_.

                                       {
      return eolsSeen_;
    }
const MonitoredQuantity& stor::RunMonitorCollection::getEoLSSeenMQ ( ) const [inline]
const MonitoredQuantity& stor::RunMonitorCollection::getErrorEventIDsReceivedMQ ( ) const [inline]
MonitoredQuantity& stor::RunMonitorCollection::getErrorEventIDsReceivedMQ ( ) [inline]

Definition at line 51 of file RunMonitorCollection.h.

References errorEventIDsReceived_.

const MonitoredQuantity& stor::RunMonitorCollection::getEventIDsReceivedMQ ( ) const [inline]
MonitoredQuantity& stor::RunMonitorCollection::getEventIDsReceivedMQ ( ) [inline]

Definition at line 44 of file RunMonitorCollection.h.

References eventIDsReceived_.

                                               {
      return eventIDsReceived_;
    }
MonitoredQuantity& stor::RunMonitorCollection::getLumiSectionsSeenMQ ( ) [inline]

Definition at line 72 of file RunMonitorCollection.h.

References lumiSectionsSeen_.

                                               {
      return lumiSectionsSeen_;
    }
const MonitoredQuantity& stor::RunMonitorCollection::getLumiSectionsSeenMQ ( ) const [inline]
const MonitoredQuantity& stor::RunMonitorCollection::getRunNumbersSeenMQ ( ) const [inline]
MonitoredQuantity& stor::RunMonitorCollection::getRunNumbersSeenMQ ( ) [inline]

Definition at line 65 of file RunMonitorCollection.h.

References runNumbersSeen_.

                                             {
      return runNumbersSeen_;
    }
MonitoredQuantity& stor::RunMonitorCollection::getUnwantedEventIDsReceivedMQ ( ) [inline]

Definition at line 58 of file RunMonitorCollection.h.

References unwantedEventIDsReceived_.

const MonitoredQuantity& stor::RunMonitorCollection::getUnwantedEventIDsReceivedMQ ( ) const [inline]
RunMonitorCollection& stor::RunMonitorCollection::operator= ( RunMonitorCollection const &  ) [private]

Member Data Documentation

Definition at line 99 of file RunMonitorCollection.h.

Referenced by alarmErrorEvents(), and alarmUnwantedEvents().

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().

Definition at line 97 of file RunMonitorCollection.h.

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

xdata::UnsignedInteger32 stor::RunMonitorCollection::errorEvents_ [private]

Definition at line 129 of file RunMonitorCollection.h.

Referenced by do_appendInfoSpaceItems(), and do_updateInfoSpaceItems().

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().

Definition at line 100 of file RunMonitorCollection.h.

Referenced by alarmUnwantedEvents().

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().

Definition at line 120 of file RunMonitorCollection.h.

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