CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_1/src/EventFilter/StorageManager/src/DQMEventMonitorCollection.cc

Go to the documentation of this file.
00001 // $Id: DQMEventMonitorCollection.cc,v 1.13 2011/04/04 12:03:30 mommsen Exp $
00003 
00004 #include <string>
00005 #include <sstream>
00006 #include <iomanip>
00007 
00008 #include "EventFilter/StorageManager/interface/Exception.h"
00009 #include "EventFilter/StorageManager/interface/DQMEventMonitorCollection.h"
00010 
00011 namespace stor
00012 {
00013   
00014   DQMEventMonitorCollection::DQMEventMonitorCollection(const utils::Duration_t& updateInterval) :
00015   MonitorCollection(updateInterval),
00016   droppedDQMEventCounts_(updateInterval, boost::posix_time::seconds(300)),
00017   dqmEventSizes_(updateInterval, boost::posix_time::seconds(300)),
00018   servedDQMEventSizes_(updateInterval, boost::posix_time::seconds(300)),
00019   writtenDQMEventSizes_(updateInterval, boost::posix_time::seconds(300)),
00020   dqmEventBandwidth_(updateInterval, boost::posix_time::seconds(300)),
00021   servedDQMEventBandwidth_(updateInterval, boost::posix_time::seconds(300)),
00022   writtenDQMEventBandwidth_(updateInterval, boost::posix_time::seconds(300)),
00023   numberOfTopLevelFolders_(updateInterval, boost::posix_time::seconds(300)),
00024   numberOfUpdates_(updateInterval, boost::posix_time::seconds(300)),
00025   numberOfWrittenTopLevelFolders_(updateInterval, boost::posix_time::seconds(300)),
00026   numberOfCompleteUpdates_(updateInterval, boost::posix_time::seconds(300))
00027   {}
00028   
00029   
00030   void DQMEventMonitorCollection::getStats(DQMEventStats& stats) const
00031   {
00032     getDroppedDQMEventCountsMQ().getStats(stats.droppedDQMEventCountsStats);
00033     
00034     getDQMEventSizeMQ().getStats(stats.dqmEventSizeStats);
00035     getServedDQMEventSizeMQ().getStats(stats.servedDQMEventSizeStats);
00036     getWrittenDQMEventSizeMQ().getStats(stats.writtenDQMEventSizeStats);
00037     
00038     getDQMEventBandwidthMQ().getStats(stats.dqmEventBandwidthStats);
00039     getServedDQMEventBandwidthMQ().getStats(stats.servedDQMEventBandwidthStats);
00040     getWrittenDQMEventBandwidthMQ().getStats(stats.writtenDQMEventBandwidthStats);
00041     
00042     getNumberOfTopLevelFoldersMQ().getStats(stats.numberOfTopLevelFoldersStats);
00043     getNumberOfUpdatesMQ().getStats(stats.numberOfUpdatesStats);
00044     getNumberOfWrittenTopLevelFoldersMQ().getStats(stats.numberOfWrittenTopLevelFoldersStats);
00045 
00046     getNumberOfCompleteUpdatesMQ().getStats(stats.numberOfCompleteUpdatesStats);
00047   }
00048   
00049   
00050   void DQMEventMonitorCollection::do_calculateStatistics()
00051   {
00052     droppedDQMEventCounts_.calculateStatistics();
00053     
00054     dqmEventSizes_.calculateStatistics();
00055     servedDQMEventSizes_.calculateStatistics();
00056     writtenDQMEventSizes_.calculateStatistics();
00057     
00058     MonitoredQuantity::Stats stats;
00059     dqmEventSizes_.getStats(stats);
00060     if (stats.getSampleCount() > 0) {
00061       dqmEventBandwidth_.addSample(stats.getLastValueRate());
00062     }
00063     dqmEventBandwidth_.calculateStatistics();
00064     
00065     servedDQMEventSizes_.getStats(stats);
00066     if (stats.getSampleCount() > 0) {
00067       servedDQMEventBandwidth_.addSample(stats.getLastValueRate());
00068     }
00069     servedDQMEventBandwidth_.calculateStatistics();
00070     
00071     writtenDQMEventSizes_.getStats(stats);
00072     if (stats.getSampleCount() > 0) {
00073       writtenDQMEventBandwidth_.addSample(stats.getLastValueRate());
00074     }
00075     writtenDQMEventBandwidth_.calculateStatistics();
00076     
00077     numberOfTopLevelFolders_.calculateStatistics();
00078     numberOfUpdates_.calculateStatistics();
00079     numberOfWrittenTopLevelFolders_.calculateStatistics();
00080 
00081     numberOfCompleteUpdates_.calculateStatistics();
00082   }
00083   
00084   
00085   void DQMEventMonitorCollection::do_reset()
00086   {
00087     droppedDQMEventCounts_.reset();
00088     
00089     dqmEventSizes_.reset();
00090     servedDQMEventSizes_.reset();
00091     writtenDQMEventSizes_.reset();
00092     
00093     dqmEventBandwidth_.reset();
00094     servedDQMEventBandwidth_.reset();
00095     writtenDQMEventBandwidth_.reset();
00096     
00097     numberOfTopLevelFolders_.reset();
00098     numberOfUpdates_.reset();
00099     numberOfWrittenTopLevelFolders_.reset();
00100 
00101     numberOfCompleteUpdates_.reset();
00102   }
00103   
00104   
00105   void DQMEventMonitorCollection::do_appendInfoSpaceItems(InfoSpaceItems& infoSpaceItems)
00106   {
00107     infoSpaceItems.push_back(std::make_pair("dqmFoldersPerEP", &dqmFoldersPerEP_));
00108     infoSpaceItems.push_back(std::make_pair("processedDQMEvents", &processedDQMEvents_));
00109     infoSpaceItems.push_back(std::make_pair("droppedDQMEvents", &droppedDQMEvents_));
00110     infoSpaceItems.push_back(std::make_pair("discardedDQMEvents", &droppedDQMEvents_));
00111     infoSpaceItems.push_back(std::make_pair("completeDQMUpdates", &completeDQMUpdates_));
00112   }
00113   
00114   
00115   void DQMEventMonitorCollection::do_updateInfoSpaceItems()
00116   {
00117     DQMEventMonitorCollection::DQMEventStats stats;
00118     getStats(stats);
00119     
00120     dqmFoldersPerEP_ = static_cast<xdata::Double>(
00121       stats.numberOfUpdatesStats.getValueAverage(MonitoredQuantity::RECENT));
00122     
00123     processedDQMEvents_ = static_cast<xdata::UnsignedInteger32>(
00124       static_cast<unsigned int>(stats.dqmEventSizeStats.getSampleCount(MonitoredQuantity::FULL)));
00125     
00126     droppedDQMEvents_ = static_cast<xdata::UnsignedInteger32>(
00127       static_cast<unsigned int>(stats.droppedDQMEventCountsStats.getValueSum(MonitoredQuantity::FULL)));
00128     
00129     completeDQMUpdates_ = static_cast<xdata::Double>(
00130       stats.numberOfCompleteUpdatesStats.getValueAverage(MonitoredQuantity::RECENT));
00131   }
00132   
00133 } // namespace stor
00134