# HG changeset patch # User Sebastien Jodogne # Date 1776174184 -7200 # Node ID d7c34b3f0b510275b35c2a1da2175e310cf6f26b # Parent e4ef25e1fcbae3e500ac9215e991144403ecc448# Parent 3e7a9e980269b43bf13a2a4f8401061f4b83c82b merge diff -r e4ef25e1fcba -r d7c34b3f0b51 Plugin/WeightedAverageMetrics.h --- a/Plugin/WeightedAverageMetrics.h Tue Apr 14 15:42:56 2026 +0200 +++ b/Plugin/WeightedAverageMetrics.h Tue Apr 14 15:43:04 2026 +0200 @@ -29,6 +29,10 @@ #include +// This class is used to compute e.g: the average throughput +// of all WADO-RS retrievals over a period of time. For each call, we +// give a value (in this case: the throughput) and a weight (a large request +// has more weight than a small request). template class WeightedAverageMetrics : public boost::noncopyable { @@ -60,7 +64,7 @@ if (values_.size() > 0) { - Value& oldest = values_.front(); + Value oldest = values_.front(); while ((now - oldest.time_).total_seconds() > duration_) { totalWeightedValue_ -= oldest.value_ * oldest.weight_; @@ -70,6 +74,10 @@ { oldest = values_.front(); } + else + { + return; + } } } }