CMS 3D CMS Logo

Classes | Public Types | Public Member Functions | Private Member Functions | Private Attributes

stor::DataSenderMonitorCollection Class Reference

#include <DataSenderMonitorCollection.h>

Inheritance diagram for stor::DataSenderMonitorCollection:
stor::MonitorCollection

List of all members.

Classes

struct  FilterUnitKey
struct  FilterUnitRecord
struct  FilterUnitResult
struct  OutputModuleRecord
struct  OutputModuleResult
struct  ResourceBrokerKey
struct  ResourceBrokerRecord
struct  ResourceBrokerResult

Public Types

typedef std::vector< FUResultPtrFilterUnitResultsList
typedef boost::shared_ptr
< FilterUnitRecord
FURecordPtr
typedef boost::shared_ptr
< FilterUnitResult
FUResultPtr
typedef boost::shared_ptr
< OutputModuleRecord
OutModRecordPtr
typedef uint32_t OutputModuleKey
typedef std::map
< OutputModuleKey,
OutModRecordPtr
OutputModuleRecordMap
typedef std::vector
< boost::shared_ptr
< OutputModuleResult > > 
OutputModuleResultsList
typedef boost::shared_ptr
< ResourceBrokerRecord
RBRecordPtr
typedef boost::shared_ptr
< ResourceBrokerResult
RBResultPtr
typedef std::vector< RBResultPtrResourceBrokerResultsList
typedef long long UniqueResourceBrokerID_t

Public Member Functions

void addDQMEventSample (I2OChain const &)
void addErrorEventSample (I2OChain const &)
void addEventSample (I2OChain const &)
void addFaultyEventSample (I2OChain const &)
void addInitSample (I2OChain const &)
 DataSenderMonitorCollection (const utils::Duration_t &updateInterval, AlarmHandlerPtr)
ResourceBrokerResultsList getAllResourceBrokerResults () const
size_t getConnectedEPs () const
FilterUnitResultsList getFilterUnitResultsForRB (UniqueResourceBrokerID_t uniqueRBID) const
RBResultPtr getOneResourceBrokerResult (UniqueResourceBrokerID_t) const
OutputModuleResultsList getOutputModuleResultsForRB (UniqueResourceBrokerID_t uniqueRBID) const
OutputModuleResultsList getTopLevelOutputModuleResults () const
void incrementDataDiscardCount (I2OChain const &)
void incrementDQMDiscardCount (I2OChain const &)
void incrementSkippedDiscardCount (I2OChain const &)

Private Member Functions

OutputModuleResultsList buildOutputModuleResults (OutputModuleRecordMap const &) const
RBResultPtr buildResourceBrokerResult (RBRecordPtr const &) const
void calcStatsForOutputModules (OutputModuleRecordMap &outputModuleMap)
 DataSenderMonitorCollection (DataSenderMonitorCollection const &)
virtual void do_appendInfoSpaceItems (InfoSpaceItems &)
virtual void do_calculateStatistics ()
virtual void do_reset ()
virtual void do_updateInfoSpaceItems ()
void faultyEventsAlarm (const uint32_t &) const
bool getAllNeededPointers (I2OChain const &i2oChain, RBRecordPtr &rbRecordPtr, FURecordPtr &fuRecordPtr, OutModRecordPtr &topLevelOutModPtr, OutModRecordPtr &rbSpecificOutModPtr, OutModRecordPtr &fuSpecificOutModPtr)
FURecordPtr getFilterUnitRecord (RBRecordPtr &, FilterUnitKey const &)
bool getFURecordPointer (I2OChain const &i2oChain, RBRecordPtr &rbRecordPtr, FURecordPtr &fuRecordPtr)
OutModRecordPtr getOutputModuleRecord (OutputModuleRecordMap &, OutputModuleKey const &)
bool getRBRecordPointer (I2OChain const &i2oChain, RBRecordPtr &rbRecordPtr)
RBRecordPtr getResourceBrokerRecord (ResourceBrokerKey const &)
UniqueResourceBrokerID_t getUniqueResourceBrokerID (ResourceBrokerKey const &)
void ignoredDiscardAlarm (const uint32_t &) const
DataSenderMonitorCollectionoperator= (DataSenderMonitorCollection const &)

Private Attributes

xdata::UnsignedInteger32 activeEPs_
AlarmHandlerPtr alarmHandler_
boost::mutex collectionsMutex_
xdata::UnsignedInteger32 connectedEPs_
xdata::UnsignedInteger32 connectedRBs_
xdata::UnsignedInteger32 faultyEvents_
xdata::UnsignedInteger32 ignoredDiscards_
OutputModuleRecordMap outputModuleMap_
xdata::Integer32 outstandingDataDiscards_
xdata::Integer32 outstandingDQMDiscards_
std::map< ResourceBrokerKey,
UniqueResourceBrokerID_t
resourceBrokerIDs_
std::map
< UniqueResourceBrokerID_t,
RBRecordPtr
resourceBrokerMap_
const utils::Duration_t updateInterval_

Detailed Description

A collection of MonitoredQuantities to track received fragments and events by their source (resource broker, filter unit, etc.)

Author:
mommsen
Revision:
1.20
Date:
2012/04/20 10:48:18

Definition at line 31 of file DataSenderMonitorCollection.h.


Member Typedef Documentation

Definition at line 290 of file DataSenderMonitorCollection.h.

Definition at line 173 of file DataSenderMonitorCollection.h.

Definition at line 289 of file DataSenderMonitorCollection.h.

Definition at line 133 of file DataSenderMonitorCollection.h.

Key that is used to identify output modules.

Definition at line 115 of file DataSenderMonitorCollection.h.

Definition at line 134 of file DataSenderMonitorCollection.h.

Definition at line 226 of file DataSenderMonitorCollection.h.

Definition at line 212 of file DataSenderMonitorCollection.h.

Definition at line 261 of file DataSenderMonitorCollection.h.

Definition at line 262 of file DataSenderMonitorCollection.h.

Results for a given resource broker.

Definition at line 231 of file DataSenderMonitorCollection.h.


Constructor & Destructor Documentation

stor::DataSenderMonitorCollection::DataSenderMonitorCollection ( const utils::Duration_t updateInterval,
AlarmHandlerPtr  ah 
)
stor::DataSenderMonitorCollection::DataSenderMonitorCollection ( DataSenderMonitorCollection const &  ) [private]

Member Function Documentation

void stor::DataSenderMonitorCollection::addDQMEventSample ( I2OChain const &  i2oChain)

Adds the specified (complete) DQMEvent to the monitor collection.

Definition at line 119 of file DataSenderMonitorCollection.cc.

References collectionsMutex_, stor::I2OChain::complete(), Header::DQM_EVENT, getFURecordPointer(), getRBRecordPointer(), stor::I2OChain::messageCode(), and stor::I2OChain::totalDataSize().

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

  {
    // sanity checks
    if (i2oChain.messageCode() != Header::DQM_EVENT) {return;}
    if (! i2oChain.complete()) {return;}
    
    // fetch basic data from the I2OChain
    double eventSize = static_cast<double>(i2oChain.totalDataSize());
    
    // look up the monitoring records that we need
    bool pointersAreValid;
    RBRecordPtr rbRecordPtr;
    FURecordPtr fuRecordPtr;
    {
      boost::mutex::scoped_lock sl(collectionsMutex_);
      pointersAreValid = getRBRecordPointer(i2oChain, rbRecordPtr);
      if (pointersAreValid)
      {
        pointersAreValid = getFURecordPointer(i2oChain, rbRecordPtr, fuRecordPtr);
      }
    }
    
    // accumulate the data of interest
    if (pointersAreValid)
    {
      rbRecordPtr->dqmEventSize.addSample(eventSize);
      fuRecordPtr->dqmEventSize.addSample(eventSize);
    }
  }
void stor::DataSenderMonitorCollection::addErrorEventSample ( I2OChain const &  i2oChain)

Adds the specified (complete) ErrorEvent to the monitor collection.

Definition at line 150 of file DataSenderMonitorCollection.cc.

References collectionsMutex_, stor::I2OChain::complete(), Header::ERROR_EVENT, getFURecordPointer(), getRBRecordPointer(), stor::I2OChain::messageCode(), and stor::I2OChain::totalDataSize().

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

  {
    // sanity checks
    if (i2oChain.messageCode() != Header::ERROR_EVENT) {return;}
    if (! i2oChain.complete()) {return;}
    
    // fetch basic data from the I2OChain
    double eventSize = static_cast<double>(i2oChain.totalDataSize());
    
    // look up the monitoring records that we need
    bool pointersAreValid;
    RBRecordPtr rbRecordPtr;
    FURecordPtr fuRecordPtr;
    {
      boost::mutex::scoped_lock sl(collectionsMutex_);
      pointersAreValid = getRBRecordPointer(i2oChain, rbRecordPtr);
      if (pointersAreValid)
      {
        pointersAreValid = getFURecordPointer(i2oChain, rbRecordPtr, fuRecordPtr);
      }
    }
    
    // accumulate the data of interest
    if (pointersAreValid)
    {
      rbRecordPtr->errorEventSize.addSample(eventSize);
      fuRecordPtr->errorEventSize.addSample(eventSize);
    }
  }
void stor::DataSenderMonitorCollection::addEventSample ( I2OChain const &  i2oChain)

Adds the specified (complete) Event to the monitor collection.

Definition at line 76 of file DataSenderMonitorCollection.cc.

References collectionsMutex_, stor::I2OChain::complete(), Header::EVENT, stor::I2OChain::eventNumber(), getAllNeededPointers(), stor::I2OChain::messageCode(), stor::I2OChain::runNumber(), convertSQLiteXML::runNumber, and stor::I2OChain::totalDataSize().

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

  {
    // sanity checks
    if (i2oChain.messageCode() != Header::EVENT) {return;}
    if (! i2oChain.complete()) {return;}

    // fetch basic data from the I2OChain
    double eventSize = static_cast<double>(i2oChain.totalDataSize());
    uint32_t runNumber = i2oChain.runNumber();
    uint32_t eventNumber = i2oChain.eventNumber();
    
    // look up the monitoring records that we need
    bool pointersAreValid;
    RBRecordPtr rbRecordPtr;
    FURecordPtr fuRecordPtr;
    OutModRecordPtr topLevelOutModPtr, rbSpecificOutModPtr, fuSpecificOutModPtr;
    {
      boost::mutex::scoped_lock sl(collectionsMutex_);
      pointersAreValid = getAllNeededPointers(
        i2oChain, rbRecordPtr, fuRecordPtr,
        topLevelOutModPtr, rbSpecificOutModPtr,
        fuSpecificOutModPtr);
    }
    
    // accumulate the data of interest
    if (pointersAreValid)
    {
      topLevelOutModPtr->eventSize.addSample(eventSize);
      
      rbRecordPtr->lastRunNumber = runNumber;
      rbRecordPtr->lastEventNumber = eventNumber;
      rbRecordPtr->eventSize.addSample(eventSize);
      rbSpecificOutModPtr->eventSize.addSample(eventSize);
      
      fuRecordPtr->lastRunNumber = runNumber;
      fuRecordPtr->lastEventNumber = eventNumber;
      fuRecordPtr->shortIntervalEventSize.addSample(eventSize);
      fuRecordPtr->mediumIntervalEventSize.addSample(eventSize);
      fuSpecificOutModPtr->eventSize.addSample(eventSize);
    }
  }
void stor::DataSenderMonitorCollection::addFaultyEventSample ( I2OChain const &  i2oChain)

Adds the specified faulty chain to the monitor collection.

Definition at line 181 of file DataSenderMonitorCollection.cc.

References collectionsMutex_, Header::DQM_EVENT, getFURecordPointer(), getRBRecordPointer(), stor::I2OChain::messageCode(), and stor::I2OChain::totalDataSize().

Referenced by stor::EventDistributor::addEventToRelevantQueues(), and stor::EventDistributor::tagCompleteEventForQueues().

  {
    // fetch basic data from the I2OChain
    double eventSize = static_cast<double>(i2oChain.totalDataSize());
    
    // look up the monitoring records that we need
    bool pointersAreValid;
    RBRecordPtr rbRecordPtr;
    FURecordPtr fuRecordPtr;
    {
      boost::mutex::scoped_lock sl(collectionsMutex_);
      pointersAreValid = getRBRecordPointer(i2oChain, rbRecordPtr);
      if (pointersAreValid)
      {
        pointersAreValid = getFURecordPointer(i2oChain, rbRecordPtr, fuRecordPtr);
      }
    }
    
    // accumulate the data of interest
    if (pointersAreValid)
    {
      if (i2oChain.messageCode() == Header::DQM_EVENT)
      {
        rbRecordPtr->faultyDQMEventSize.addSample(eventSize);
        fuRecordPtr->faultyDQMEventSize.addSample(eventSize);
      }
      else
      {
        rbRecordPtr->faultyEventSize.addSample(eventSize);
        fuRecordPtr->faultyEventSize.addSample(eventSize);
      }
    }
  }
void stor::DataSenderMonitorCollection::addInitSample ( I2OChain const &  i2oChain)

Adds the specified (complete) INIT message to the monitor collection.

Definition at line 35 of file DataSenderMonitorCollection.cc.

References collectionsMutex_, stor::I2OChain::complete(), getAllNeededPointers(), Header::INIT, stor::I2OChain::messageCode(), stor::I2OChain::nExpectedEPs(), stor::I2OChain::outputModuleLabel(), AlCaHLTBitMon_QueryRunRegistry::string, and stor::I2OChain::totalDataSize().

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

  {
    // sanity checks
    if (i2oChain.messageCode() != Header::INIT) {return;}
    if (! i2oChain.complete()) {return;}
    
    // fetch basic data from the I2OChain
    std::string outModName = i2oChain.outputModuleLabel();
    uint32_t msgSize = i2oChain.totalDataSize();
    
    // look up the monitoring records that we need
    bool pointersAreValid;
    RBRecordPtr rbRecordPtr;
    FURecordPtr fuRecordPtr;
    OutModRecordPtr topLevelOutModPtr, rbSpecificOutModPtr, fuSpecificOutModPtr;
    {
      boost::mutex::scoped_lock sl(collectionsMutex_);
      pointersAreValid = getAllNeededPointers(
        i2oChain, rbRecordPtr, fuRecordPtr,
        topLevelOutModPtr, rbSpecificOutModPtr,
        fuSpecificOutModPtr);
    }
    
    // accumulate the data of interest
    if (pointersAreValid)
    {
      topLevelOutModPtr->name = outModName;
      topLevelOutModPtr->initMsgSize = msgSize;
      
      ++rbRecordPtr->initMsgCount;
      rbRecordPtr->nExpectedEPs += i2oChain.nExpectedEPs();
      rbSpecificOutModPtr->name = outModName;
      rbSpecificOutModPtr->initMsgSize = msgSize;
      
      ++fuRecordPtr->initMsgCount;
      fuSpecificOutModPtr->name = outModName;
      fuSpecificOutModPtr->initMsgSize = msgSize;
    }
  }
DSMC::OutputModuleResultsList stor::DSMC::buildOutputModuleResults ( DSMC::OutputModuleRecordMap const &  outputModuleMap) const [private]

Definition at line 767 of file DataSenderMonitorCollection.cc.

References query::result.

Referenced by getOutputModuleResultsForRB(), and getTopLevelOutputModuleResults().

  {
    OutputModuleResultsList resultsList;
    
    OutputModuleRecordMap::const_iterator omMapIter;
    OutputModuleRecordMap::const_iterator omMapEnd = outputModuleMap.end();
    for (omMapIter = outputModuleMap.begin(); omMapIter != omMapEnd; ++omMapIter)
    {
      OutModRecordPtr outModRecordPtr = omMapIter->second;
      boost::shared_ptr<OutputModuleResult> result(new OutputModuleResult());
      result->name = outModRecordPtr->name;
      result->id = outModRecordPtr->id;
      result->initMsgSize = outModRecordPtr->initMsgSize;
      outModRecordPtr->eventSize.getStats(result->eventStats);
      resultsList.push_back(result);
    }
    
    return resultsList;
  }
DSMC::RBResultPtr stor::DSMC::buildResourceBrokerResult ( DSMC::RBRecordPtr const &  rbRecordPtr) const [private]

Definition at line 789 of file DataSenderMonitorCollection.cc.

References query::result.

Referenced by getAllResourceBrokerResults(), and getOneResourceBrokerResult().

  {
    RBResultPtr result(new ResourceBrokerResult(rbRecordPtr->key));
    
    result->filterUnitCount = rbRecordPtr->initMsgCount>0 ? rbRecordPtr->nExpectedEPs / rbRecordPtr->initMsgCount : 0;
    result->initMsgCount = rbRecordPtr->initMsgCount;
    result->lastRunNumber = rbRecordPtr->lastRunNumber;
    result->lastEventNumber = rbRecordPtr->lastEventNumber;
    rbRecordPtr->eventSize.getStats(result->eventStats);
    rbRecordPtr->dqmEventSize.getStats(result->dqmEventStats);
    rbRecordPtr->errorEventSize.getStats(result->errorEventStats);
    rbRecordPtr->faultyEventSize.getStats(result->faultyEventStats);
    rbRecordPtr->faultyDQMEventSize.getStats(result->faultyDQMEventStats);
    rbRecordPtr->dataDiscardCount.getStats(result->dataDiscardStats);
    rbRecordPtr->dqmDiscardCount.getStats(result->dqmDiscardStats);
    rbRecordPtr->skippedDiscardCount.getStats(result->skippedDiscardStats);
    
    result->outstandingDataDiscardCount =
      result->initMsgCount +
      result->eventStats.getSampleCount() +
      result->errorEventStats.getSampleCount() +
      result->faultyEventStats.getSampleCount() -
      result->dataDiscardStats.getSampleCount();
    result->outstandingDQMDiscardCount =
      result->dqmEventStats.getSampleCount() +
      result->faultyDQMEventStats.getSampleCount() -
      result->dqmDiscardStats.getSampleCount();
    
    return result;
  }
void stor::DSMC::calcStatsForOutputModules ( DSMC::OutputModuleRecordMap outputModuleMap) [private]

Definition at line 821 of file DataSenderMonitorCollection.cc.

Referenced by do_calculateStatistics().

  {
    OutputModuleRecordMap::const_iterator omMapIter;
    OutputModuleRecordMap::const_iterator omMapEnd = outputModuleMap.end();
    for (omMapIter = outputModuleMap.begin(); omMapIter != omMapEnd; ++omMapIter)
    {
      OutModRecordPtr outModRecordPtr = omMapIter->second;
      
      outModRecordPtr->fragmentSize.calculateStatistics();
      outModRecordPtr->eventSize.calculateStatistics();
    }
  }
void stor::DataSenderMonitorCollection::do_appendInfoSpaceItems ( InfoSpaceItems infoSpaceItems) [private, virtual]

Reimplemented from stor::MonitorCollection.

Definition at line 466 of file DataSenderMonitorCollection.cc.

References activeEPs_, connectedEPs_, connectedRBs_, faultyEvents_, ignoredDiscards_, outstandingDataDiscards_, and outstandingDQMDiscards_.

  {
    infoSpaceItems.push_back(std::make_pair("connectedRBs", &connectedRBs_));
    infoSpaceItems.push_back(std::make_pair("connectedEPs", &connectedEPs_));
    infoSpaceItems.push_back(std::make_pair("activeEPs", &activeEPs_));
    infoSpaceItems.push_back(std::make_pair("outstandingDataDiscards", &outstandingDataDiscards_));
    infoSpaceItems.push_back(std::make_pair("outstandingDQMDiscards", &outstandingDQMDiscards_));
    infoSpaceItems.push_back(std::make_pair("faultyEvents", &faultyEvents_));
    infoSpaceItems.push_back(std::make_pair("ignoredDiscards", &ignoredDiscards_));
  }
void stor::DataSenderMonitorCollection::do_calculateStatistics ( ) [private, virtual]

Implements stor::MonitorCollection.

Definition at line 406 of file DataSenderMonitorCollection.cc.

References calcStatsForOutputModules(), collectionsMutex_, outputModuleMap_, and resourceBrokerMap_.

  {
    boost::mutex::scoped_lock sl(collectionsMutex_);
    
    std::map<UniqueResourceBrokerID_t, RBRecordPtr>::const_iterator rbMapIter;
    std::map<UniqueResourceBrokerID_t, RBRecordPtr>::const_iterator rbMapEnd =
      resourceBrokerMap_.end();
    for (rbMapIter=resourceBrokerMap_.begin(); rbMapIter!=rbMapEnd; ++rbMapIter)
    {
      RBRecordPtr rbRecordPtr = rbMapIter->second;
      rbRecordPtr->eventSize.calculateStatistics();
      rbRecordPtr->dqmEventSize.calculateStatistics();
      rbRecordPtr->errorEventSize.calculateStatistics();
      rbRecordPtr->faultyEventSize.calculateStatistics();
      rbRecordPtr->faultyDQMEventSize.calculateStatistics();
      rbRecordPtr->dataDiscardCount.calculateStatistics();
      rbRecordPtr->dqmDiscardCount.calculateStatistics();
      rbRecordPtr->skippedDiscardCount.calculateStatistics();
      calcStatsForOutputModules(rbRecordPtr->outputModuleMap);
      
      std::map<FilterUnitKey, FURecordPtr>::const_iterator fuMapIter;
      std::map<FilterUnitKey, FURecordPtr>::const_iterator fuMapEnd =
        rbRecordPtr->filterUnitMap.end();        
      for (fuMapIter = rbRecordPtr->filterUnitMap.begin();
           fuMapIter != fuMapEnd; ++fuMapIter)
      {
        FURecordPtr fuRecordPtr = fuMapIter->second;
        fuRecordPtr->shortIntervalEventSize.calculateStatistics();
        fuRecordPtr->mediumIntervalEventSize.calculateStatistics();
        fuRecordPtr->dqmEventSize.calculateStatistics();
        fuRecordPtr->errorEventSize.calculateStatistics();
        fuRecordPtr->faultyEventSize.calculateStatistics();
        fuRecordPtr->faultyDQMEventSize.calculateStatistics();
        fuRecordPtr->dataDiscardCount.calculateStatistics();
        fuRecordPtr->dqmDiscardCount.calculateStatistics();
        fuRecordPtr->skippedDiscardCount.calculateStatistics();
        calcStatsForOutputModules(fuRecordPtr->outputModuleMap);
      }
    }
    
    calcStatsForOutputModules(outputModuleMap_);
  }
void stor::DataSenderMonitorCollection::do_reset ( ) [private, virtual]
void stor::DataSenderMonitorCollection::do_updateInfoSpaceItems ( ) [private, virtual]

Reimplemented from stor::MonitorCollection.

Definition at line 478 of file DataSenderMonitorCollection.cc.

References activeEPs_, collectionsMutex_, connectedEPs_, connectedRBs_, faultyEvents_, faultyEventsAlarm(), stor::MonitoredQuantity::Stats::getSampleCount(), ignoredDiscardAlarm(), ignoredDiscards_, outstandingDataDiscards_, outstandingDQMDiscards_, stor::MonitoredQuantity::RECENT, and resourceBrokerMap_.

  {
    boost::mutex::scoped_lock sl(collectionsMutex_);
    
    connectedRBs_ = static_cast<xdata::UnsignedInteger32>(resourceBrokerMap_.size());
    
    uint32_t localEPCount = 0;
    uint32_t localActiveEPCount = 0;
    int localMissingDataDiscardCount = 0;
    int localMissingDQMDiscardCount = 0;
    uint32_t localFaultyEventsCount = 0;
    uint32_t localIgnoredDiscardCount = 0;
    std::map<UniqueResourceBrokerID_t, RBRecordPtr>::const_iterator rbMapIter;
    std::map<UniqueResourceBrokerID_t, RBRecordPtr>::const_iterator rbMapEnd =
      resourceBrokerMap_.end();
    for (rbMapIter = resourceBrokerMap_.begin(); rbMapIter != rbMapEnd; ++rbMapIter)
    {
      RBRecordPtr rbRecordPtr = rbMapIter->second;
      if ( rbRecordPtr->initMsgCount > 0 )
        localEPCount += rbRecordPtr->nExpectedEPs / rbRecordPtr->initMsgCount;
      
      MonitoredQuantity::Stats skippedDiscardStats;
      rbRecordPtr->skippedDiscardCount.getStats(skippedDiscardStats);
      localIgnoredDiscardCount += skippedDiscardStats.getSampleCount();
      
      MonitoredQuantity::Stats eventStats;
      MonitoredQuantity::Stats errorEventStats;
      MonitoredQuantity::Stats dataDiscardStats;
      rbRecordPtr->eventSize.getStats(eventStats);
      rbRecordPtr->errorEventSize.getStats(errorEventStats);
      rbRecordPtr->dataDiscardCount.getStats(dataDiscardStats);
      localMissingDataDiscardCount += rbRecordPtr->initMsgCount + eventStats.getSampleCount() +
        errorEventStats.getSampleCount() - dataDiscardStats.getSampleCount();
      
      MonitoredQuantity::Stats dqmEventStats;
      MonitoredQuantity::Stats dqmDiscardStats;
      rbRecordPtr->dqmEventSize.getStats(dqmEventStats);
      rbRecordPtr->dqmDiscardCount.getStats(dqmDiscardStats);
      localMissingDQMDiscardCount += dqmEventStats.getSampleCount() -
        dqmDiscardStats.getSampleCount();
      
      MonitoredQuantity::Stats faultyEventStats;
      rbRecordPtr->faultyEventSize.getStats(faultyEventStats);
      localFaultyEventsCount += faultyEventStats.getSampleCount();
      MonitoredQuantity::Stats faultyDQMEventStats;
      rbRecordPtr->faultyDQMEventSize.getStats(faultyDQMEventStats);
      localFaultyEventsCount += faultyDQMEventStats.getSampleCount();
      
      std::map<FilterUnitKey, FURecordPtr>::const_iterator fuMapIter;
      std::map<FilterUnitKey, FURecordPtr>::const_iterator fuMapEnd =
        rbRecordPtr->filterUnitMap.end();        
      for (fuMapIter = rbRecordPtr->filterUnitMap.begin(); fuMapIter != fuMapEnd; ++fuMapIter)
      {
        FURecordPtr fuRecordPtr = fuMapIter->second;
        MonitoredQuantity::Stats fuMediumIntervalEventStats;
        fuRecordPtr->mediumIntervalEventSize.getStats(fuMediumIntervalEventStats);
        if (fuMediumIntervalEventStats.getSampleCount(MonitoredQuantity::RECENT) > 0) {
          ++localActiveEPCount;
        }
      }
    }
    connectedEPs_ = static_cast<xdata::UnsignedInteger32>(localEPCount);
    activeEPs_ = static_cast<xdata::UnsignedInteger32>(localActiveEPCount);
    outstandingDataDiscards_ = static_cast<xdata::Integer32>(localMissingDataDiscardCount);
    outstandingDQMDiscards_ = static_cast<xdata::Integer32>(localMissingDQMDiscardCount);
    faultyEvents_ = static_cast<xdata::UnsignedInteger32>(localFaultyEventsCount);
    ignoredDiscards_ = static_cast<xdata::UnsignedInteger32>(localIgnoredDiscardCount);
    
    faultyEventsAlarm(localFaultyEventsCount);
    ignoredDiscardAlarm(localIgnoredDiscardCount);
  }
void stor::DataSenderMonitorCollection::faultyEventsAlarm ( const uint32_t &  faultyEventsCount) const [private]

Definition at line 551 of file DataSenderMonitorCollection.cc.

References alarmHandler_, stor::AlarmHandler::ERROR, lumiQueryAPI::msg, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by do_updateInfoSpaceItems().

  {
    const std::string alarmName = "FaultyEvents";
    
    if (faultyEventsCount > 0)
    {
      std::ostringstream msg;
      msg << "Missing or faulty I2O fragments for " <<
        faultyEventsCount <<
        " events. These events are lost!";
      XCEPT_DECLARE(stor::exception::FaultyEvents, ex, msg.str());
      alarmHandler_->raiseAlarm(alarmName, AlarmHandler::ERROR, ex);
    }
    else
    {
      alarmHandler_->revokeAlarm(alarmName);
    }
  }
bool stor::DSMC::getAllNeededPointers ( I2OChain const &  i2oChain,
DSMC::RBRecordPtr rbRecordPtr,
DSMC::FURecordPtr fuRecordPtr,
DSMC::OutModRecordPtr topLevelOutModPtr,
DSMC::OutModRecordPtr rbSpecificOutModPtr,
DSMC::OutModRecordPtr fuSpecificOutModPtr 
) [private]

Definition at line 608 of file DataSenderMonitorCollection.cc.

References stor::DataSenderMonitorCollection::FilterUnitKey::isValid, stor::DataSenderMonitorCollection::ResourceBrokerKey::isValid, and stor::I2OChain::outputModuleId().

Referenced by addEventSample(), and addInitSample().

  {
    ResourceBrokerKey rbKey(i2oChain);
    if (! rbKey.isValid) {return false;}
    FilterUnitKey fuKey(i2oChain);
    if (! fuKey.isValid) {return false;}
    OutputModuleKey outModKey = i2oChain.outputModuleId();
    
    topLevelOutModPtr = getOutputModuleRecord(outputModuleMap_, outModKey);
    
    rbRecordPtr = getResourceBrokerRecord(rbKey);
    rbSpecificOutModPtr = getOutputModuleRecord(
      rbRecordPtr->outputModuleMap,
      outModKey);
    
    fuRecordPtr = getFilterUnitRecord(rbRecordPtr, fuKey);
    fuSpecificOutModPtr = getOutputModuleRecord(
      fuRecordPtr->outputModuleMap,
      outModKey);
    
    return true;
  }
DataSenderMonitorCollection::ResourceBrokerResultsList stor::DataSenderMonitorCollection::getAllResourceBrokerResults ( ) const

Fetches the resource broker overview statistics.

Definition at line 298 of file DataSenderMonitorCollection.cc.

References buildResourceBrokerResult(), collectionsMutex_, resourceBrokerMap_, and query::result.

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

  {
    boost::mutex::scoped_lock sl(collectionsMutex_);
    ResourceBrokerResultsList resultsList;
    
    std::map<UniqueResourceBrokerID_t, RBRecordPtr>::const_iterator rbMapIter;
    std::map<UniqueResourceBrokerID_t, RBRecordPtr>::const_iterator rbMapEnd =
      resourceBrokerMap_.end();
    for (rbMapIter = resourceBrokerMap_.begin(); rbMapIter != rbMapEnd; ++rbMapIter)
    {
      RBRecordPtr rbRecordPtr = rbMapIter->second;
      RBResultPtr result = buildResourceBrokerResult(rbRecordPtr);
      result->uniqueRBID = rbMapIter->first;
      resultsList.push_back(result);
    }
    
    return resultsList;
  }
size_t stor::DataSenderMonitorCollection::getConnectedEPs ( ) const

Return the number of event processors connected.

Definition at line 590 of file DataSenderMonitorCollection.cc.

References prof2calltree::count, and resourceBrokerMap_.

  {
    size_t count = 0;
    std::map<UniqueResourceBrokerID_t, RBRecordPtr>::const_iterator rbMapIter;
    std::map<UniqueResourceBrokerID_t, RBRecordPtr>::const_iterator rbMapEnd =
      resourceBrokerMap_.end();
    for (rbMapIter = resourceBrokerMap_.begin(); rbMapIter != rbMapEnd; ++rbMapIter)
    {
      if ( rbMapIter->second->initMsgCount > 0 )
        count += rbMapIter->second->nExpectedEPs / rbMapIter->second->initMsgCount;
    }
    return count;
  }
DSMC::FURecordPtr stor::DSMC::getFilterUnitRecord ( DSMC::RBRecordPtr rbRecordPtr,
DSMC::FilterUnitKey const &  fuKey 
) [private]

Definition at line 717 of file DataSenderMonitorCollection.cc.

  {
    FURecordPtr fuRecordPtr;
    std::map<FilterUnitKey, FURecordPtr>::const_iterator fuMapIter;
    fuMapIter = rbRecordPtr->filterUnitMap.find(fuKey);
    if (fuMapIter == rbRecordPtr->filterUnitMap.end())
    {
      fuRecordPtr.reset(new FilterUnitRecord(fuKey,updateInterval_));
      rbRecordPtr->filterUnitMap[fuKey] = fuRecordPtr;
    }
    else
    {
      fuRecordPtr = fuMapIter->second;
    }
    return fuRecordPtr;
  }
DataSenderMonitorCollection::FilterUnitResultsList stor::DataSenderMonitorCollection::getFilterUnitResultsForRB ( UniqueResourceBrokerID_t  uniqueRBID) const

Fetches the filter unit results for a specific resource broker.

Definition at line 356 of file DataSenderMonitorCollection.cc.

References collectionsMutex_, resourceBrokerMap_, and query::result.

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

  {
    boost::mutex::scoped_lock sl(collectionsMutex_);
    FilterUnitResultsList resultsList;
    
    std::map<UniqueResourceBrokerID_t, RBRecordPtr>::const_iterator rbMapIter;
    rbMapIter = resourceBrokerMap_.find(uniqueRBID);
    if (rbMapIter != resourceBrokerMap_.end())
    {
      RBRecordPtr rbRecordPtr = rbMapIter->second;
      std::map<FilterUnitKey, FURecordPtr>::const_iterator fuMapIter;
      std::map<FilterUnitKey, FURecordPtr>::const_iterator fuMapEnd =
        rbRecordPtr->filterUnitMap.end();        
      for (fuMapIter = rbRecordPtr->filterUnitMap.begin();
           fuMapIter != fuMapEnd; ++fuMapIter)
      {
        FURecordPtr fuRecordPtr = fuMapIter->second;
        FUResultPtr result(new FilterUnitResult(fuRecordPtr->key));
        result->initMsgCount = fuRecordPtr->initMsgCount;
        result->lastRunNumber = fuRecordPtr->lastRunNumber;
        result->lastEventNumber = fuRecordPtr->lastEventNumber;
        fuRecordPtr->shortIntervalEventSize.getStats(result->shortIntervalEventStats);
        fuRecordPtr->mediumIntervalEventSize.getStats(result->mediumIntervalEventStats);
        fuRecordPtr->dqmEventSize.getStats(result->dqmEventStats);
        fuRecordPtr->errorEventSize.getStats(result->errorEventStats);
        fuRecordPtr->faultyEventSize.getStats(result->faultyEventStats);
        fuRecordPtr->faultyDQMEventSize.getStats(result->faultyDQMEventStats);
        fuRecordPtr->dataDiscardCount.getStats(result->dataDiscardStats);
        fuRecordPtr->dqmDiscardCount.getStats(result->dqmDiscardStats);
        fuRecordPtr->skippedDiscardCount.getStats(result->skippedDiscardStats);
        
        result->outstandingDataDiscardCount =
          result->initMsgCount +
          result->shortIntervalEventStats.getSampleCount() +
          result->errorEventStats.getSampleCount() +
          result->faultyEventStats.getSampleCount() -
          result->dataDiscardStats.getSampleCount();
        result->outstandingDQMDiscardCount =
          result->dqmEventStats.getSampleCount() +
          result->faultyDQMEventStats.getSampleCount() -
          result->dqmDiscardStats.getSampleCount();
        
        resultsList.push_back(result);
      }
    }
    
    return resultsList;
  }
bool stor::DSMC::getFURecordPointer ( I2OChain const &  i2oChain,
DSMC::RBRecordPtr rbRecordPtr,
DSMC::FURecordPtr fuRecordPtr 
) [private]

Definition at line 654 of file DataSenderMonitorCollection.cc.

References stor::DataSenderMonitorCollection::FilterUnitKey::isValid.

Referenced by addDQMEventSample(), addErrorEventSample(), addFaultyEventSample(), incrementDataDiscardCount(), incrementDQMDiscardCount(), and incrementSkippedDiscardCount().

  {
    FilterUnitKey fuKey(i2oChain);
    if (! fuKey.isValid) {return false;}
    
    fuRecordPtr = getFilterUnitRecord(rbRecordPtr, fuKey);
    return true;
  }
DataSenderMonitorCollection::RBResultPtr stor::DataSenderMonitorCollection::getOneResourceBrokerResult ( UniqueResourceBrokerID_t  uniqueRBID) const

Fetches statistics for a specific resource broker.

Definition at line 319 of file DataSenderMonitorCollection.cc.

References buildResourceBrokerResult(), collectionsMutex_, resourceBrokerMap_, and query::result.

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

  {
    boost::mutex::scoped_lock sl(collectionsMutex_);
    RBResultPtr result;
    
    std::map<UniqueResourceBrokerID_t, RBRecordPtr>::const_iterator rbMapIter;
    rbMapIter = resourceBrokerMap_.find(uniqueRBID);
    if (rbMapIter != resourceBrokerMap_.end())
    {
      RBRecordPtr rbRecordPtr = rbMapIter->second;
      result = buildResourceBrokerResult(rbRecordPtr);
      result->uniqueRBID = rbMapIter->first;
    }
    
    return result;
  }
DSMC::OutModRecordPtr stor::DSMC::getOutputModuleRecord ( OutputModuleRecordMap outModMap,
DSMC::OutputModuleKey const &  outModKey 
) [private]

Definition at line 740 of file DataSenderMonitorCollection.cc.

  {
    OutModRecordPtr outModRecordPtr;
    OutputModuleRecordMap::const_iterator omMapIter;
    omMapIter = outModMap.find(outModKey);
    if (omMapIter == outModMap.end())
    {
      outModRecordPtr.reset(new OutputModuleRecord(updateInterval_));
      
      outModRecordPtr->name = "Unknown";
      outModRecordPtr->id = outModKey;
      outModRecordPtr->initMsgSize = 0;
      
      outModMap[outModKey] = outModRecordPtr;
    }
    else
    {
      outModRecordPtr = omMapIter->second;
    }
    return outModRecordPtr;
  }
DataSenderMonitorCollection::OutputModuleResultsList stor::DataSenderMonitorCollection::getOutputModuleResultsForRB ( UniqueResourceBrokerID_t  uniqueRBID) const

Fetches the output module statistics for a specific resource broker.

Definition at line 338 of file DataSenderMonitorCollection.cc.

References buildOutputModuleResults(), collectionsMutex_, and resourceBrokerMap_.

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

  {
    boost::mutex::scoped_lock sl(collectionsMutex_);
    OutputModuleResultsList resultsList;
    
    std::map<UniqueResourceBrokerID_t, RBRecordPtr>::const_iterator rbMapIter;
    rbMapIter = resourceBrokerMap_.find(uniqueRBID);
    if (rbMapIter != resourceBrokerMap_.end())
    {
      RBRecordPtr rbRecordPtr = rbMapIter->second;
      resultsList = buildOutputModuleResults(rbRecordPtr->outputModuleMap);
    }
    
    return resultsList;
  }
bool stor::DSMC::getRBRecordPointer ( I2OChain const &  i2oChain,
DSMC::RBRecordPtr rbRecordPtr 
) [private]

Definition at line 640 of file DataSenderMonitorCollection.cc.

References stor::DataSenderMonitorCollection::ResourceBrokerKey::isValid.

Referenced by addDQMEventSample(), addErrorEventSample(), addFaultyEventSample(), incrementDataDiscardCount(), incrementDQMDiscardCount(), and incrementSkippedDiscardCount().

  {
    ResourceBrokerKey rbKey(i2oChain);
    if (! rbKey.isValid) {return false;}
    
    rbRecordPtr = getResourceBrokerRecord(rbKey);
    return true;
  }
DSMC::RBRecordPtr stor::DSMC::getResourceBrokerRecord ( DSMC::ResourceBrokerKey const &  rbKey) [private]

Definition at line 669 of file DataSenderMonitorCollection.cc.

References getUniqueResourceBrokerID(), resourceBrokerMap_, and updateInterval_.

  {
    RBRecordPtr rbRecordPtr;
    UniqueResourceBrokerID_t uniqueRBID = getUniqueResourceBrokerID(rbKey);
    std::map<UniqueResourceBrokerID_t, RBRecordPtr>::const_iterator rbMapIter;
    rbMapIter = resourceBrokerMap_.find(uniqueRBID);
    if (rbMapIter == resourceBrokerMap_.end())
    {
      rbRecordPtr.reset(new ResourceBrokerRecord(rbKey,updateInterval_));
      resourceBrokerMap_[uniqueRBID] = rbRecordPtr;
    }
    else
    {
      rbRecordPtr = rbMapIter->second;
    }
    return rbRecordPtr;
  }
DataSenderMonitorCollection::OutputModuleResultsList stor::DataSenderMonitorCollection::getTopLevelOutputModuleResults ( ) const

Fetches the top-level output module statistics.

Definition at line 289 of file DataSenderMonitorCollection.cc.

References buildOutputModuleResults(), collectionsMutex_, and outputModuleMap_.

Referenced by stor::SMWebPageHelper::addDOMforSummaryInformation(), and stor::SMWebPageHelper::addOutputModuleTables().

  {
    boost::mutex::scoped_lock sl(collectionsMutex_);
    
    return buildOutputModuleResults(outputModuleMap_);
  }
DSMC::UniqueResourceBrokerID_t stor::DSMC::getUniqueResourceBrokerID ( DSMC::ResourceBrokerKey const &  rbKey) [private]

Definition at line 689 of file DataSenderMonitorCollection.cc.

References stor::DataSenderMonitorCollection::ResourceBrokerKey::hltClassName, stor::DataSenderMonitorCollection::ResourceBrokerKey::hltInstance, stor::DataSenderMonitorCollection::ResourceBrokerKey::hltLocalId, stor::DataSenderMonitorCollection::ResourceBrokerKey::hltTid, stor::DataSenderMonitorCollection::ResourceBrokerKey::hltURL, dttmaxenums::L, resourceBrokerIDs_, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by getResourceBrokerRecord().

  {
    UniqueResourceBrokerID_t uniqueID;
    std::map<ResourceBrokerKey, UniqueResourceBrokerID_t>::const_iterator rbMapIter;
    rbMapIter = resourceBrokerIDs_.find(rbKey);
    if (rbMapIter == resourceBrokerIDs_.end())
    {
      std::string workString = rbKey.hltURL +
        boost::lexical_cast<std::string>(rbKey.hltTid) +
        boost::lexical_cast<std::string>(rbKey.hltInstance) +
        boost::lexical_cast<std::string>(rbKey.hltLocalId) +
        rbKey.hltClassName;
      uLong crc = crc32(0L, Z_NULL, 0);
      Bytef* crcbuf = (Bytef*) workString.data();
      crc = crc32(crc, crcbuf, workString.length());
      uniqueID = static_cast<UniqueResourceBrokerID_t>(crc);
      resourceBrokerIDs_[rbKey] = uniqueID;
    }
    else
    {
      uniqueID = rbMapIter->second;
    }
    return uniqueID;
  }
void stor::DataSenderMonitorCollection::ignoredDiscardAlarm ( const uint32_t &  ignoredDiscardCount) const [private]

Definition at line 571 of file DataSenderMonitorCollection.cc.

References alarmHandler_, stor::AlarmHandler::ERROR, lumiQueryAPI::msg, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by do_updateInfoSpaceItems().

  {
    const std::string alarmName = "IgnoredDiscard";
    
    if ( ignoredDiscardCount > 0)
    {
      std::ostringstream msg;
      msg << ignoredDiscardCount <<
        " discard messages ignored. These events might be stuck in the resource broker.";
      XCEPT_DECLARE(stor::exception::IgnoredDiscard, ex, msg.str());
      alarmHandler_->raiseAlarm(alarmName, AlarmHandler::ERROR, ex);
    }
    else
    {
      alarmHandler_->revokeAlarm(alarmName);
    }
  }
void stor::DataSenderMonitorCollection::incrementDataDiscardCount ( I2OChain const &  i2oChain)

Increments the number of data discard messages tracked by the monitor collection.

Definition at line 216 of file DataSenderMonitorCollection.cc.

References collectionsMutex_, getFURecordPointer(), and getRBRecordPointer().

Referenced by stor::DiscardManager::sendDiscardMessage().

  {
    // look up the monitoring records that we need
    bool pointersAreValid;
    RBRecordPtr rbRecordPtr;
    FURecordPtr fuRecordPtr;
    {
      boost::mutex::scoped_lock sl(collectionsMutex_);
      pointersAreValid = getRBRecordPointer(i2oChain, rbRecordPtr);
      if (pointersAreValid)
      {
        pointersAreValid = getFURecordPointer(i2oChain, rbRecordPtr, fuRecordPtr);
      }
    }
    
    // accumulate the data of interest
    if (pointersAreValid)
    {
      rbRecordPtr->dataDiscardCount.addSample(1);
      fuRecordPtr->dataDiscardCount.addSample(1);
    }
  }
void stor::DataSenderMonitorCollection::incrementDQMDiscardCount ( I2OChain const &  i2oChain)

Increments the number of DQM discard messages tracked by the monitor collection.

Definition at line 240 of file DataSenderMonitorCollection.cc.

References collectionsMutex_, getFURecordPointer(), and getRBRecordPointer().

Referenced by stor::DiscardManager::sendDiscardMessage().

  {
    // look up the monitoring records that we need
    bool pointersAreValid;
    RBRecordPtr rbRecordPtr;
    FURecordPtr fuRecordPtr;
    {
      boost::mutex::scoped_lock sl(collectionsMutex_);
      pointersAreValid = getRBRecordPointer(i2oChain, rbRecordPtr);
      if (pointersAreValid)
      {
        pointersAreValid = getFURecordPointer(i2oChain, rbRecordPtr, fuRecordPtr);
      }
    }
    
    // accumulate the data of interest
    if (pointersAreValid)
    {
      rbRecordPtr->dqmDiscardCount.addSample(1);
      fuRecordPtr->dqmDiscardCount.addSample(1);
    }
  }
void stor::DataSenderMonitorCollection::incrementSkippedDiscardCount ( I2OChain const &  i2oChain)

Increments the number of skipped discard messages tracked by the monitor collection.

Definition at line 264 of file DataSenderMonitorCollection.cc.

References collectionsMutex_, getFURecordPointer(), and getRBRecordPointer().

Referenced by stor::DiscardManager::sendDiscardMessage().

  {
    // look up the monitoring records that we need
    bool pointersAreValid;
    RBRecordPtr rbRecordPtr;
    FURecordPtr fuRecordPtr;
    {
      boost::mutex::scoped_lock sl(collectionsMutex_);
      pointersAreValid = getRBRecordPointer(i2oChain, rbRecordPtr);
      if (pointersAreValid)
      {
        pointersAreValid = getFURecordPointer(i2oChain, rbRecordPtr, fuRecordPtr);
      }
    }
    
    // accumulate the data of interest
    if (pointersAreValid)
    {
      rbRecordPtr->skippedDiscardCount.addSample(1);
      fuRecordPtr->skippedDiscardCount.addSample(1);
    }
  }
DataSenderMonitorCollection& stor::DataSenderMonitorCollection::operator= ( DataSenderMonitorCollection const &  ) [private]

Member Data Documentation

xdata::UnsignedInteger32 stor::DataSenderMonitorCollection::activeEPs_ [private]

Definition at line 431 of file DataSenderMonitorCollection.h.

Referenced by faultyEventsAlarm(), and ignoredDiscardAlarm().

xdata::UnsignedInteger32 stor::DataSenderMonitorCollection::connectedEPs_ [private]
xdata::UnsignedInteger32 stor::DataSenderMonitorCollection::connectedRBs_ [private]
xdata::UnsignedInteger32 stor::DataSenderMonitorCollection::faultyEvents_ [private]
xdata::UnsignedInteger32 stor::DataSenderMonitorCollection::ignoredDiscards_ [private]

Definition at line 427 of file DataSenderMonitorCollection.h.

Referenced by getUniqueResourceBrokerID().

Reimplemented from stor::MonitorCollection.

Definition at line 430 of file DataSenderMonitorCollection.h.

Referenced by getResourceBrokerRecord().