#include <ConsumerMonitorCollection.h>
A collection of MonitoredQuantities to track consumer activity.
Definition at line 28 of file ConsumerMonitorCollection.h.
typedef std::map<QueueID, MonitoredQuantityPtr> stor::ConsumerMonitorCollection::ConsStatMap [private] |
Definition at line 92 of file ConsumerMonitorCollection.h.
stor::ConsumerMonitorCollection::ConsumerMonitorCollection | ( | const utils::Duration_t & | updateInterval, |
const utils::Duration_t & | recentDuration | ||
) | [explicit] |
Definition at line 12 of file ConsumerMonitorCollection.cc.
: MonitorCollection(updateInterval), updateInterval_(updateInterval), recentDuration_(recentDuration), totalQueuedMQ_(updateInterval, recentDuration), totalDroppedMQ_(updateInterval, recentDuration), totalServedMQ_(updateInterval, recentDuration) {}
stor::ConsumerMonitorCollection::ConsumerMonitorCollection | ( | const ConsumerMonitorCollection & | ) | [private] |
void stor::ConsumerMonitorCollection::addDroppedEvents | ( | const QueueID & | qid, |
const size_t & | count | ||
) |
Add number of dropped events
Definition at line 38 of file ConsumerMonitorCollection.cc.
References prof2calltree::l.
{ boost::mutex::scoped_lock l( mutex_ ); addEventSampleToMap(qid, count, dmap_); totalDroppedMQ_.addSample(count); }
void stor::ConsumerMonitorCollection::addEventSampleToMap | ( | const QueueID & | qid, |
const unsigned int & | data_size, | ||
ConsStatMap & | map | ||
) | [private] |
Definition at line 62 of file ConsumerMonitorCollection.cc.
References pos.
{ ConsStatMap::iterator pos = map.lower_bound(qid); // 05-Oct-2009, KAB - added a test of whether qid appears before pos->first // in the map sort order. Since lower_bound can return a non-end iterator // even when qid is not in the map, we need to complete the test of whether // qid is in the map. (Another way to look at this is we need to implement // the full test described in the efficientAddOrUpdates pattern suggested // by Item 24 of 'Effective STL' by Scott Meyers.) if (pos == map.end() || (map.key_comp()(qid, pos->first))) { // The key does not exist in the map, add it to the map // Use pos as a hint to insert, so it can avoid another lookup pos = map.insert(pos, ConsStatMap::value_type(qid, MonitoredQuantityPtr( new MonitoredQuantity(updateInterval_, recentDuration_) ) ) ); } pos->second->addSample( data_size ); }
void stor::ConsumerMonitorCollection::addQueuedEventSample | ( | const QueueID & | qid, |
const unsigned int & | data_size | ||
) |
Add queued sample
Definition at line 26 of file ConsumerMonitorCollection.cc.
References prof2calltree::l.
{ boost::mutex::scoped_lock l( mutex_ ); addEventSampleToMap(qid, data_size, qmap_); totalQueuedMQ_.addSample(data_size); }
void stor::ConsumerMonitorCollection::addServedEventSample | ( | const QueueID & | qid, |
const unsigned int & | data_size | ||
) |
Add served sample
Definition at line 50 of file ConsumerMonitorCollection.cc.
References prof2calltree::l.
{ boost::mutex::scoped_lock l( mutex_ ); addEventSampleToMap(qid, data_size, smap_); totalServedMQ_.addSample(data_size); }
void stor::ConsumerMonitorCollection::do_calculateStatistics | ( | ) | [private, virtual] |
Implements stor::MonitorCollection.
Definition at line 164 of file ConsumerMonitorCollection.cc.
References stor::MonitoredQuantity::calculateStatistics(), dmap_, i, prof2calltree::l, mutex_, qmap_, smap_, totalDroppedMQ_, totalQueuedMQ_, and totalServedMQ_.
{ boost::mutex::scoped_lock l( mutex_ ); for( ConsStatMap::iterator i = qmap_.begin(); i != qmap_.end(); ++i ) i->second->calculateStatistics(); for( ConsStatMap::iterator i = smap_.begin(); i != smap_.end(); ++i ) i->second->calculateStatistics(); for( ConsStatMap::iterator i = dmap_.begin(); i != dmap_.end(); ++i ) i->second->calculateStatistics(); totalQueuedMQ_.calculateStatistics(); totalDroppedMQ_.calculateStatistics(); totalServedMQ_.calculateStatistics(); }
void stor::ConsumerMonitorCollection::do_reset | ( | ) | [private, virtual] |
Implements stor::MonitorCollection.
Definition at line 180 of file ConsumerMonitorCollection.cc.
References dmap_, prof2calltree::l, mutex_, qmap_, stor::MonitoredQuantity::reset(), smap_, totalDroppedMQ_, totalQueuedMQ_, and totalServedMQ_.
{ boost::mutex::scoped_lock l( mutex_ ); qmap_.clear(); smap_.clear(); dmap_.clear(); totalQueuedMQ_.reset(); totalDroppedMQ_.reset(); totalServedMQ_.reset(); }
bool stor::ConsumerMonitorCollection::getDropped | ( | const QueueID & | qid, |
MonitoredQuantity::Stats & | result | ||
) | const |
Get number of dropped events. Return false if consumer ID not found.
Definition at line 116 of file ConsumerMonitorCollection.cc.
References prof2calltree::l.
{ boost::mutex::scoped_lock l( mutex_ ); return getValueFromMap( qid, result, dmap_ ); }
bool stor::ConsumerMonitorCollection::getQueued | ( | const QueueID & | qid, |
MonitoredQuantity::Stats & | result | ||
) | const |
Get queued data size. Return false if consumer ID not found.
Definition at line 94 of file ConsumerMonitorCollection.cc.
References prof2calltree::l.
{ boost::mutex::scoped_lock l( mutex_ ); return getValueFromMap( qid, result, qmap_ ); }
bool stor::ConsumerMonitorCollection::getServed | ( | const QueueID & | qid, |
MonitoredQuantity::Stats & | result | ||
) | const |
Get served data size. Return false if consumer ID not found.
Definition at line 105 of file ConsumerMonitorCollection.cc.
References prof2calltree::l.
Referenced by smproxy::SMPSWebPageHelper::addRowForEventType(), and stor::SMWebPageHelper::getServedConsumerBandwidth().
{ boost::mutex::scoped_lock l( mutex_ ); return getValueFromMap( qid, result, smap_ ); }
void stor::ConsumerMonitorCollection::getTotalStats | ( | TotalStats & | totalStats | ) | const |
Get the summary statistics for all consumers
Definition at line 141 of file ConsumerMonitorCollection.cc.
References stor::ConsumerMonitorCollection::TotalStats::droppedStats, stor::MonitoredQuantity::getStats(), stor::ConsumerMonitorCollection::TotalStats::queuedStats, stor::ConsumerMonitorCollection::TotalStats::servedStats, totalDroppedMQ_, totalQueuedMQ_, and totalServedMQ_.
Referenced by smproxy::SMPSWebPageHelper::addSummaryRowForThroughput().
{ totalQueuedMQ_.getStats(totalStats.queuedStats); totalDroppedMQ_.getStats(totalStats.droppedStats); totalServedMQ_.getStats(totalStats.servedStats); }
bool stor::ConsumerMonitorCollection::getValueFromMap | ( | const QueueID & | qid, |
MonitoredQuantity::Stats & | result, | ||
const ConsStatMap & | map | ||
) | const [private] |
ConsumerMonitorCollection& stor::ConsumerMonitorCollection::operator= | ( | const ConsumerMonitorCollection & | ) | [private] |
void stor::ConsumerMonitorCollection::resetCounters | ( | ) |
Reset sizes to zero leaving consumers in
Definition at line 148 of file ConsumerMonitorCollection.cc.
References dmap_, i, prof2calltree::l, mutex_, qmap_, stor::MonitoredQuantity::reset(), smap_, totalDroppedMQ_, totalQueuedMQ_, and totalServedMQ_.
{ boost::mutex::scoped_lock l( mutex_ ); for( ConsStatMap::iterator i = qmap_.begin(); i != qmap_.end(); ++i ) i->second->reset(); for( ConsStatMap::iterator i = smap_.begin(); i != smap_.end(); ++i ) i->second->reset(); for( ConsStatMap::iterator i = dmap_.begin(); i != dmap_.end(); ++i ) i->second->reset(); totalQueuedMQ_.reset(); totalDroppedMQ_.reset(); totalServedMQ_.reset(); }
ConsStatMap stor::ConsumerMonitorCollection::dmap_ [protected] |
Definition at line 109 of file ConsumerMonitorCollection.h.
Referenced by do_calculateStatistics(), do_reset(), and resetCounters().
boost::mutex stor::ConsumerMonitorCollection::mutex_ [mutable, protected] |
Definition at line 112 of file ConsumerMonitorCollection.h.
Referenced by do_calculateStatistics(), do_reset(), stor::EventConsumerMonitorCollection::do_updateInfoSpaceItems(), stor::DQMConsumerMonitorCollection::do_updateInfoSpaceItems(), and resetCounters().
ConsStatMap stor::ConsumerMonitorCollection::qmap_ [protected] |
Definition at line 108 of file ConsumerMonitorCollection.h.
Referenced by do_calculateStatistics(), do_reset(), and resetCounters().
const utils::Duration_t stor::ConsumerMonitorCollection::recentDuration_ [private] |
Definition at line 101 of file ConsumerMonitorCollection.h.
ConsStatMap stor::ConsumerMonitorCollection::smap_ [protected] |
Definition at line 110 of file ConsumerMonitorCollection.h.
Referenced by do_calculateStatistics(), do_reset(), stor::EventConsumerMonitorCollection::do_updateInfoSpaceItems(), stor::DQMConsumerMonitorCollection::do_updateInfoSpaceItems(), and resetCounters().
Definition at line 103 of file ConsumerMonitorCollection.h.
Referenced by do_calculateStatistics(), do_reset(), getTotalStats(), and resetCounters().
Definition at line 102 of file ConsumerMonitorCollection.h.
Referenced by do_calculateStatistics(), do_reset(), getTotalStats(), and resetCounters().
Definition at line 104 of file ConsumerMonitorCollection.h.
Referenced by do_calculateStatistics(), do_reset(), getTotalStats(), and resetCounters().
const utils::Duration_t stor::ConsumerMonitorCollection::updateInterval_ [private] |
Reimplemented from stor::MonitorCollection.
Definition at line 100 of file ConsumerMonitorCollection.h.