diff options
Diffstat (limited to 'cpp/src')
-rw-r--r-- | cpp/src/IceStorm/InstrumentationI.cpp | 93 |
1 files changed, 55 insertions, 38 deletions
diff --git a/cpp/src/IceStorm/InstrumentationI.cpp b/cpp/src/IceStorm/InstrumentationI.cpp index a7ad8ef1ae7..4eb719ce6f1 100644 --- a/cpp/src/IceStorm/InstrumentationI.cpp +++ b/cpp/src/IceStorm/InstrumentationI.cpp @@ -217,63 +217,80 @@ TopicObserverI::forwarded() forEach(inc(&TopicMetrics::forwarded)); } +namespace +{ + +struct QueuedUpdate +{ + QueuedUpdate(int count) : count(count) + { + } + + void operator()(const SubscriberMetricsPtr& v) + { + v->queued += count; + } + + int count; +}; + +} void SubscriberObserverI::queued(int count) { - struct Update + forEach(QueuedUpdate(count)); +} + +namespace +{ + +struct OutstandingUpdate +{ + OutstandingUpdate(int count) : count(count) { - Update(int count) : count(count) - { - } + } - void operator()(const SubscriberMetricsPtr& v) - { - v->queued += count; - } + void operator()(const SubscriberMetricsPtr& v) + { + v->queued -= count; + v->outstanding += count; + } + + int count; +}; - int count; - }; - forEach(Update(count)); } void SubscriberObserverI::outstanding(int count) { - struct Update + forEach(OutstandingUpdate(count)); +} + +namespace +{ + +struct DeliveredUpdate +{ + DeliveredUpdate(int count) : count(count) { - Update(int count) : count(count) - { - } + } - void operator()(const SubscriberMetricsPtr& v) - { - v->queued -= count; - v->outstanding += count; - } + void operator()(const SubscriberMetricsPtr& v) + { + v->outstanding -= count; + v->delivered += count; + } + + int count; +}; - int count; - }; - forEach(Update(count)); } void SubscriberObserverI::delivered(int count) { - struct Update - { - Update(int count) : count(count) - { - } - - void operator()(const SubscriberMetricsPtr& v) - { - v->outstanding -= count; - v->delivered += count; - } - - int count; - }; - forEach(Update(count)); + forEach(DeliveredUpdate(count)); } TopicManagerObserverI::TopicManagerObserverI(const MetricsAdminIPtr& metrics) : |