17 updateInterval_(updateInterval),
18 recentDuration_(recentDuration),
19 totalQueuedMQ_(updateInterval, recentDuration),
20 totalDroppedMQ_(updateInterval, recentDuration),
21 totalServedMQ_(updateInterval, recentDuration)
28 const unsigned int& data_size
31 boost::mutex::scoped_lock
l( mutex_ );
32 addEventSampleToMap(qid, data_size, qmap_);
33 totalQueuedMQ_.addSample(data_size);
43 boost::mutex::scoped_lock
l( mutex_ );
44 addEventSampleToMap(qid, count, dmap_);
45 totalDroppedMQ_.addSample(count);
52 const unsigned int& data_size
55 boost::mutex::scoped_lock
l( mutex_ );
56 addEventSampleToMap(qid, data_size, smap_);
57 totalServedMQ_.addSample(data_size);
64 const unsigned int& data_size,
68 ConsStatMap::iterator
pos = map.lower_bound(qid);
76 if (pos == map.end() || (map.key_comp()(qid, pos->first)))
89 pos->second->addSample( data_size );
99 boost::mutex::scoped_lock
l( mutex_ );
100 return getValueFromMap( qid, result, qmap_ );
110 boost::mutex::scoped_lock
l( mutex_ );
111 return getValueFromMap( qid, result, smap_ );
121 boost::mutex::scoped_lock
l( mutex_ );
122 return getValueFromMap( qid, result, dmap_ );
132 ConsStatMap::const_iterator
pos = map.find(qid);
134 if (pos == map.end())
return false;
136 pos->second->getStats( result );
150 boost::mutex::scoped_lock
l(
mutex_ );
151 for( ConsStatMap::iterator
i =
qmap_.begin();
i !=
qmap_.end(); ++
i )
153 for( ConsStatMap::iterator
i =
smap_.begin();
i !=
smap_.end(); ++
i )
155 for( ConsStatMap::iterator
i =
dmap_.begin();
i !=
dmap_.end(); ++
i )
166 boost::mutex::scoped_lock
l(
mutex_ );
167 for( ConsStatMap::iterator
i =
qmap_.begin();
i !=
qmap_.end(); ++
i )
168 i->second->calculateStatistics();
169 for( ConsStatMap::iterator
i =
smap_.begin();
i !=
smap_.end(); ++
i )
170 i->second->calculateStatistics();
171 for( ConsStatMap::iterator
i =
dmap_.begin();
i !=
dmap_.end(); ++
i )
172 i->second->calculateStatistics();
182 boost::mutex::scoped_lock
l(
mutex_ );
void addQueuedEventSample(const QueueID &, const unsigned int &data_size)
bool getServed(const QueueID &qid, MonitoredQuantity::Stats &result) const
MonitoredQuantity::Stats queuedStats
boost::shared_ptr< MonitoredQuantity > MonitoredQuantityPtr
bool getDropped(const QueueID &qid, MonitoredQuantity::Stats &result) const
MonitoredQuantity::Stats servedStats
MonitoredQuantity totalServedMQ_
MonitoredQuantity::Stats droppedStats
virtual void do_calculateStatistics()
void getStats(Stats &stats) const
void addEventSampleToMap(const QueueID &, const unsigned int &data_size, ConsStatMap &)
MonitoredQuantity totalDroppedMQ_
void calculateStatistics(const utils::TimePoint_t ¤tTime=utils::getCurrentTime())
boost::posix_time::time_duration Duration_t
void addDroppedEvents(const QueueID &, const size_t &count)
std::map< QueueID, MonitoredQuantityPtr > ConsStatMap
void getTotalStats(TotalStats &) const
ConsumerMonitorCollection(const utils::Duration_t &updateInterval, const utils::Duration_t &recentDuration)
Container::value_type value_type
bool getQueued(const QueueID &qid, MonitoredQuantity::Stats &result) const
void addServedEventSample(const QueueID &, const unsigned int &data_size)
MonitoredQuantity totalQueuedMQ_
bool getValueFromMap(const QueueID &, MonitoredQuantity::Stats &, const ConsStatMap &) const