diff options
Diffstat (limited to 'cpp')
-rw-r--r-- | cpp/src/tests/latencytest.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/cpp/src/tests/latencytest.cpp b/cpp/src/tests/latencytest.cpp index 6c3fdd23bd..6f71506d48 100644 --- a/cpp/src/tests/latencytest.cpp +++ b/cpp/src/tests/latencytest.cpp @@ -237,9 +237,9 @@ void Receiver::received(Message& msg) void Stats::update(double latency) { Mutex::ScopedLock l(lock); + if (!count || minLatency > latency) minLatency = latency; + if (!count || maxLatency < latency) maxLatency = latency; count++; - if (minLatency == 0 || minLatency > latency) minLatency = latency; - if (maxLatency == 0 || maxLatency < latency) maxLatency = latency; totalLatency += latency; } @@ -249,13 +249,13 @@ void Stats::print() { static bool already_have_stats = false; uint value; - double aux_avg = (totalLatency / count); if (opts.rate) value = opts.rate; else value = opts.count; Mutex::ScopedLock l(lock); + double aux_avg = (totalLatency / count); if (!opts.cumulative) { if (!opts.csv) { std::cout << "Latency(ms): min=" << minLatency << ", max=" << |