#include <MonitoredQuantity.h>
Classes | |
struct | Stats |
Public Types | |
enum | DataSetType { FULL = 0, RECENT = 1 } |
Public Member Functions | |
void | addSample (const double &value=1) |
void | addSample (const int &value=1) |
void | addSample (const unsigned int &value=1) |
void | addSample (const long &value=1) |
void | addSample (const unsigned long &value=1) |
void | addSample (const long long &value=1) |
void | addSample (const unsigned long long &value=1) |
void | addSampleIfLarger (const double &value) |
void | calculateStatistics (const utils::TimePoint_t ¤tTime=utils::getCurrentTime()) |
void | disable () |
void | enable () |
utils::Duration_t | ExpectedCalculationInterval () const |
void | getStats (Stats &stats) const |
utils::Duration_t | getTimeWindowForRecentResults () const |
bool | isEnabled () const |
MonitoredQuantity (utils::Duration_t expectedCalculationInterval, utils::Duration_t timeWindowForRecentResults) | |
void | reset () |
void | setNewTimeWindowForRecentResults (const utils::Duration_t &interval) |
Private Member Functions | |
MonitoredQuantity (MonitoredQuantity const &) | |
MonitoredQuantity & | operator= (MonitoredQuantity const &) |
void | resetAccumulators () |
void | resetResults () |
This class keeps track of statistics for a set of sample values and provides timing information on the samples.
Definition at line 29 of file MonitoredQuantity.h.
|
explicit |
Definition at line 13 of file MonitoredQuantity.cc.
|
private |
void stor::MonitoredQuantity::addSample | ( | const double & | value = 1 | ) |
Adds the specified doubled valued sample value to the monitor instance.
Definition at line 23 of file MonitoredQuantity.cc.
References accumulationMutex_, enabled_, stor::utils::getCurrentTime(), lastCalculationTime_, relativeConstraints::value, workingLastSampleValue_, workingSampleCount_, workingValueMax_, workingValueMin_, workingValueSum_, and workingValueSumOfSquares_.
Referenced by stor::ThroughputMonitorCollection::addDiskWriterIdleSample(), stor::ThroughputMonitorCollection::addDiskWriteSample(), stor::DQMTopLevelFolder::addDQMEvent(), stor::FragmentMonitorCollection::addDQMEventFragmentSample(), stor::ThroughputMonitorCollection::addDQMEventProcessorIdleSample(), stor::FragmentMonitorCollection::addEventFragmentSample(), stor::ThroughputMonitorCollection::addFragmentProcessorIdleSample(), stor::FragmentMonitorCollection::addFragmentSample(), stor::ThroughputMonitorCollection::addPoppedDQMEventSample(), stor::ThroughputMonitorCollection::addPoppedEventSample(), stor::ThroughputMonitorCollection::addPoppedFragmentSample(), addSample(), addSampleIfLarger(), stor::StreamsMonitorCollection::StreamRecord::addSizeInBytes(), stor::RunMonitorCollection::addUnwantedEvent(), stor::ThroughputMonitorCollection::calcPoolUsage(), stor::StreamsMonitorCollection::do_calculateStatistics(), stor::FragmentMonitorCollection::do_calculateStatistics(), stor::DQMEventMonitorCollection::do_calculateStatistics(), stor::ThroughputMonitorCollection::do_calculateStatistics(), stor::DQMTopLevelFolder::getRecord(), stor::DQMTopLevelFolder::isReady(), stor::StorageManager::receiveEndOfLumiSectionMessage(), stor::StorageManager::receiveRegistryMessage(), stor::EventDistributor::tagCompleteEventForQueues(), and smproxy::DQMArchiver::writeDQMEventToFile().
void stor::MonitoredQuantity::addSample | ( | const int & | value = 1 | ) |
Adds the specified integer valued sample value to the monitor instance.
Definition at line 44 of file MonitoredQuantity.cc.
References addSample().
void stor::MonitoredQuantity::addSample | ( | const unsigned int & | value = 1 | ) |
Adds the specified unsigned integer valued sample value to the monitor instance.
Definition at line 49 of file MonitoredQuantity.cc.
References addSample().
void stor::MonitoredQuantity::addSample | ( | const long & | value = 1 | ) |
Adds the specified long valued sample value to the monitor instance.
Definition at line 54 of file MonitoredQuantity.cc.
References addSample().
void stor::MonitoredQuantity::addSample | ( | const unsigned long & | value = 1 | ) |
Adds the specified unsigned long valued sample value to the monitor instance.
Definition at line 59 of file MonitoredQuantity.cc.
References addSample().
void stor::MonitoredQuantity::addSample | ( | const long long & | value = 1 | ) |
Adds the specified long long valued sample value to the monitor instance.
Definition at line 64 of file MonitoredQuantity.cc.
References addSample().
void stor::MonitoredQuantity::addSample | ( | const unsigned long long & | value = 1 | ) |
Adds the specified unsigned long long valued sample value to the monitor instance.
Definition at line 69 of file MonitoredQuantity.cc.
References addSample().
void stor::MonitoredQuantity::addSampleIfLarger | ( | const double & | value | ) |
Adds the specified double valued sample value to the monitor instance if it is larger than the previously added value.
Definition at line 74 of file MonitoredQuantity.cc.
References addSample(), and workingLastSampleValue_.
Referenced by stor::EventDistributor::tagCompleteEventForQueues().
void stor::MonitoredQuantity::calculateStatistics | ( | const utils::TimePoint_t & | currentTime = utils::getCurrentTime() | ) |
Forces a calculation of the statistics for the monitored quantity. The frequency of the updates to the statistics is driven by how often this method is called. It is expected that this method will be called once per interval specified by expectedCalculationInterval
Definition at line 80 of file MonitoredQuantity.cc.
References accumulationMutex_, binCount_, binDuration_, binSampleCount_, binSnapshotTime_, binValueMax_, binValueMin_, binValueSum_, binValueSumOfSquares_, stor::utils::durationToSeconds(), enabled_, expectedCalculationInterval_, fullDuration_, fullSampleCount_, fullSampleRate_, fullValueAverage_, fullValueMax_, fullValueMin_, fullValueRate_, fullValueRMS_, fullValueSum_, fullValueSumOfSquares_, lastCalculationTime_, lastLatchedSampleValue_, lastLatchedValueRate_, recentDuration_, recentSampleCount_, recentSampleRate_, recentValueAverage_, recentValueMax_, recentValueMin_, recentValueRate_, recentValueRMS_, recentValueSum_, recentValueSumOfSquares_, resultsMutex_, seconds(), mathSSE::sqrt(), workingBinId_, workingLastSampleValue_, workingSampleCount_, workingValueMax_, workingValueMin_, workingValueSum_, and workingValueSumOfSquares_.
Referenced by stor::ThroughputMonitorCollection::calcPoolUsage(), stor::ConsumerMonitorCollection::do_calculateStatistics(), stor::RunMonitorCollection::do_calculateStatistics(), stor::FragmentMonitorCollection::do_calculateStatistics(), stor::StreamsMonitorCollection::do_calculateStatistics(), smproxy::DataRetrieverMonitorCollection::do_calculateStatistics(), stor::DQMEventMonitorCollection::do_calculateStatistics(), and stor::ThroughputMonitorCollection::do_calculateStatistics().
void stor::MonitoredQuantity::disable | ( | ) |
void stor::MonitoredQuantity::enable | ( | ) |
Enables the monitor (and resets the statistics to provide a fresh start).
Definition at line 285 of file MonitoredQuantity.cc.
References enabled_, and reset().
|
inline |
Definition at line 136 of file MonitoredQuantity.h.
References expectedCalculationInterval_.
void stor::MonitoredQuantity::getStats | ( | Stats & | stats | ) | const |
Write all our collected statistics into the given Stats struct.
Definition at line 343 of file MonitoredQuantity.cc.
References binCount_, binDuration_, binSampleCount_, binSnapshotTime_, binValueSum_, stor::MonitoredQuantity::Stats::enabled, enabled_, stor::MonitoredQuantity::Stats::fullDuration, fullDuration_, stor::MonitoredQuantity::Stats::fullSampleCount, fullSampleCount_, stor::MonitoredQuantity::Stats::fullSampleRate, fullSampleRate_, stor::MonitoredQuantity::Stats::fullValueAverage, fullValueAverage_, stor::MonitoredQuantity::Stats::fullValueMax, fullValueMax_, stor::MonitoredQuantity::Stats::fullValueMin, fullValueMin_, stor::MonitoredQuantity::Stats::fullValueRate, fullValueRate_, stor::MonitoredQuantity::Stats::fullValueRMS, fullValueRMS_, stor::MonitoredQuantity::Stats::fullValueSum, fullValueSum_, stor::MonitoredQuantity::Stats::fullValueSumOfSquares, fullValueSumOfSquares_, lastLatchedSampleValue_, lastLatchedValueRate_, stor::MonitoredQuantity::Stats::lastSampleValue, stor::MonitoredQuantity::Stats::lastValueRate, stor::MonitoredQuantity::Stats::recentBinnedDurations, stor::MonitoredQuantity::Stats::recentBinnedSampleCounts, stor::MonitoredQuantity::Stats::recentBinnedSnapshotTimes, stor::MonitoredQuantity::Stats::recentBinnedValueSums, stor::MonitoredQuantity::Stats::recentDuration, recentDuration_, stor::MonitoredQuantity::Stats::recentSampleCount, recentSampleCount_, stor::MonitoredQuantity::Stats::recentSampleRate, recentSampleRate_, stor::MonitoredQuantity::Stats::recentValueAverage, recentValueAverage_, stor::MonitoredQuantity::Stats::recentValueMax, recentValueMax_, stor::MonitoredQuantity::Stats::recentValueMin, recentValueMin_, stor::MonitoredQuantity::Stats::recentValueRate, recentValueRate_, stor::MonitoredQuantity::Stats::recentValueRMS, recentValueRMS_, stor::MonitoredQuantity::Stats::recentValueSum, recentValueSum_, stor::MonitoredQuantity::Stats::recentValueSumOfSquares, recentValueSumOfSquares_, python.entryComment::results, resultsMutex_, and workingBinId_.
Referenced by stor::SMWebPageHelper::addDOMforResourceUsage(), stor::SMWebPageHelper::addDOMforRunMonitor(), stor::SMWebPageHelper::addDOMforStoredData(), stor::RunMonitorCollection::alarmErrorEvents(), stor::FragmentMonitorCollection::do_calculateStatistics(), stor::StreamsMonitorCollection::do_calculateStatistics(), stor::DQMEventMonitorCollection::do_calculateStatistics(), stor::ThroughputMonitorCollection::do_getStats(), stor::RunMonitorCollection::do_updateInfoSpaceItems(), stor::FragmentMonitorCollection::do_updateInfoSpaceItems(), stor::StreamsMonitorCollection::do_updateInfoSpaceItems(), stor::FragmentMonitorCollection::getStats(), stor::DQMEventMonitorCollection::getStats(), smproxy::DataRetrieverMonitorCollection::getSummaryStats(), stor::ConsumerMonitorCollection::getTotalStats(), stor::SMWebPageHelper::listStreamRecordsStats(), and stor::DiskWriter::writeEndOfRunMarker().
|
inline |
Returns the length of the time window that has been specified for recent results. (This may be different than the actual length of the recent time window which is affected by the interval of calls to the calculateStatistics() method. Use a getDuration(RECENT) call to determine the actual recent time window.)
Definition at line 131 of file MonitoredQuantity.h.
References intervalForRecentStats_.
|
inline |
Tests whether the monitor is currently enabled.
Definition at line 115 of file MonitoredQuantity.h.
References enabled_.
|
private |
void stor::MonitoredQuantity::reset | ( | void | ) |
Resets the monitor (zeroes out all counters and restarts the time interval).
Definition at line 272 of file MonitoredQuantity.cc.
References accumulationMutex_, resetAccumulators(), resetResults(), and resultsMutex_.
Referenced by stor::ConsumerMonitorCollection::do_reset(), stor::RunMonitorCollection::do_reset(), stor::FragmentMonitorCollection::do_reset(), stor::StreamsMonitorCollection::do_reset(), smproxy::DataRetrieverMonitorCollection::do_reset(), stor::DQMEventMonitorCollection::do_reset(), stor::ThroughputMonitorCollection::do_reset(), enable(), and stor::ConsumerMonitorCollection::resetCounters().
|
private |
Definition at line 223 of file MonitoredQuantity.cc.
References lastCalculationTime_, workingLastSampleValue_, workingSampleCount_, workingValueMax_, workingValueMin_, workingValueSum_, and workingValueSumOfSquares_.
Referenced by reset(), and setNewTimeWindowForRecentResults().
|
private |
Definition at line 234 of file MonitoredQuantity.cc.
References binCount_, binDuration_, binSampleCount_, binSnapshotTime_, binValueMax_, binValueMin_, binValueSum_, binValueSumOfSquares_, fullDuration_, fullSampleCount_, fullSampleRate_, fullValueAverage_, fullValueMax_, fullValueMin_, fullValueRate_, fullValueRMS_, fullValueSum_, fullValueSumOfSquares_, lastLatchedSampleValue_, lastLatchedValueRate_, recentDuration_, recentSampleCount_, recentSampleRate_, recentValueAverage_, recentValueMax_, recentValueMin_, recentValueRate_, recentValueRMS_, recentValueSum_, recentValueSumOfSquares_, seconds(), and workingBinId_.
Referenced by reset(), and setNewTimeWindowForRecentResults().
void stor::MonitoredQuantity::setNewTimeWindowForRecentResults | ( | const utils::Duration_t & | interval | ) |
Specifies a new time interval to be used when calculating "recent" statistics.
Definition at line 300 of file MonitoredQuantity.cc.
References accumulationMutex_, binCount_, binDuration_, binSampleCount_, binSnapshotTime_, binValueMax_, binValueMin_, binValueSum_, binValueSumOfSquares_, expectedCalculationInterval_, MergeJob_cfg::interval, intervalForRecentStats_, max(), resetAccumulators(), resetResults(), and resultsMutex_.
|
mutableprivate |
Definition at line 164 of file MonitoredQuantity.h.
Referenced by addSample(), calculateStatistics(), reset(), and setNewTimeWindowForRecentResults().
|
private |
Definition at line 166 of file MonitoredQuantity.h.
Referenced by calculateStatistics(), getStats(), resetResults(), and setNewTimeWindowForRecentResults().
|
private |
Definition at line 173 of file MonitoredQuantity.h.
Referenced by calculateStatistics(), getStats(), resetResults(), and setNewTimeWindowForRecentResults().
|
private |
Definition at line 168 of file MonitoredQuantity.h.
Referenced by calculateStatistics(), getStats(), resetResults(), and setNewTimeWindowForRecentResults().
|
private |
Definition at line 174 of file MonitoredQuantity.h.
Referenced by calculateStatistics(), getStats(), resetResults(), and setNewTimeWindowForRecentResults().
|
private |
Definition at line 172 of file MonitoredQuantity.h.
Referenced by calculateStatistics(), resetResults(), and setNewTimeWindowForRecentResults().
|
private |
Definition at line 171 of file MonitoredQuantity.h.
Referenced by calculateStatistics(), resetResults(), and setNewTimeWindowForRecentResults().
|
private |
Definition at line 169 of file MonitoredQuantity.h.
Referenced by calculateStatistics(), getStats(), resetResults(), and setNewTimeWindowForRecentResults().
|
private |
Definition at line 170 of file MonitoredQuantity.h.
Referenced by calculateStatistics(), resetResults(), and setNewTimeWindowForRecentResults().
|
private |
Definition at line 202 of file MonitoredQuantity.h.
Referenced by addSample(), calculateStatistics(), disable(), enable(), getStats(), and isEnabled().
|
private |
Definition at line 204 of file MonitoredQuantity.h.
Referenced by calculateStatistics(), ExpectedCalculationInterval(), and setNewTimeWindowForRecentResults().
|
private |
Definition at line 185 of file MonitoredQuantity.h.
Referenced by calculateStatistics(), getStats(), and resetResults().
|
private |
Definition at line 176 of file MonitoredQuantity.h.
Referenced by calculateStatistics(), getStats(), and resetResults().
|
private |
Definition at line 177 of file MonitoredQuantity.h.
Referenced by calculateStatistics(), getStats(), and resetResults().
|
private |
Definition at line 180 of file MonitoredQuantity.h.
Referenced by calculateStatistics(), getStats(), and resetResults().
|
private |
Definition at line 183 of file MonitoredQuantity.h.
Referenced by calculateStatistics(), getStats(), and resetResults().
|
private |
Definition at line 182 of file MonitoredQuantity.h.
Referenced by calculateStatistics(), getStats(), and resetResults().
|
private |
Definition at line 184 of file MonitoredQuantity.h.
Referenced by calculateStatistics(), getStats(), and resetResults().
|
private |
Definition at line 181 of file MonitoredQuantity.h.
Referenced by calculateStatistics(), getStats(), and resetResults().
|
private |
Definition at line 178 of file MonitoredQuantity.h.
Referenced by calculateStatistics(), getStats(), and resetResults().
|
private |
Definition at line 179 of file MonitoredQuantity.h.
Referenced by calculateStatistics(), getStats(), and resetResults().
|
private |
Definition at line 203 of file MonitoredQuantity.h.
Referenced by getTimeWindowForRecentResults(), and setNewTimeWindowForRecentResults().
|
private |
Definition at line 156 of file MonitoredQuantity.h.
Referenced by addSample(), calculateStatistics(), and resetAccumulators().
|
private |
Definition at line 197 of file MonitoredQuantity.h.
Referenced by calculateStatistics(), getStats(), and resetResults().
|
private |
Definition at line 198 of file MonitoredQuantity.h.
Referenced by calculateStatistics(), getStats(), and resetResults().
|
private |
Definition at line 196 of file MonitoredQuantity.h.
Referenced by calculateStatistics(), getStats(), and resetResults().
|
private |
Definition at line 187 of file MonitoredQuantity.h.
Referenced by calculateStatistics(), getStats(), and resetResults().
|
private |
Definition at line 188 of file MonitoredQuantity.h.
Referenced by calculateStatistics(), getStats(), and resetResults().
|
private |
Definition at line 191 of file MonitoredQuantity.h.
Referenced by calculateStatistics(), getStats(), and resetResults().
|
private |
Definition at line 194 of file MonitoredQuantity.h.
Referenced by calculateStatistics(), getStats(), and resetResults().
|
private |
Definition at line 193 of file MonitoredQuantity.h.
Referenced by calculateStatistics(), getStats(), and resetResults().
|
private |
Definition at line 195 of file MonitoredQuantity.h.
Referenced by calculateStatistics(), getStats(), and resetResults().
|
private |
Definition at line 192 of file MonitoredQuantity.h.
Referenced by calculateStatistics(), getStats(), and resetResults().
|
private |
Definition at line 189 of file MonitoredQuantity.h.
Referenced by calculateStatistics(), getStats(), and resetResults().
|
private |
Definition at line 190 of file MonitoredQuantity.h.
Referenced by calculateStatistics(), getStats(), and resetResults().
|
mutableprivate |
Definition at line 200 of file MonitoredQuantity.h.
Referenced by calculateStatistics(), getStats(), reset(), and setNewTimeWindowForRecentResults().
|
private |
Definition at line 167 of file MonitoredQuantity.h.
Referenced by calculateStatistics(), getStats(), and resetResults().
|
private |
Definition at line 162 of file MonitoredQuantity.h.
Referenced by addSample(), addSampleIfLarger(), calculateStatistics(), and resetAccumulators().
|
private |
Definition at line 157 of file MonitoredQuantity.h.
Referenced by addSample(), calculateStatistics(), and resetAccumulators().
|
private |
Definition at line 161 of file MonitoredQuantity.h.
Referenced by addSample(), calculateStatistics(), and resetAccumulators().
|
private |
Definition at line 160 of file MonitoredQuantity.h.
Referenced by addSample(), calculateStatistics(), and resetAccumulators().
|
private |
Definition at line 158 of file MonitoredQuantity.h.
Referenced by addSample(), calculateStatistics(), and resetAccumulators().
|
private |
Definition at line 159 of file MonitoredQuantity.h.
Referenced by addSample(), calculateStatistics(), and resetAccumulators().