From b5419944aaa1c0140972dc6bc12a1e6c113e1314 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Fri, 25 Oct 2019 21:28:55 +0200 Subject: [PATCH] Only write to memory if value has changed. --- server/TracyWorker.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/server/TracyWorker.cpp b/server/TracyWorker.cpp index 5cb944ad..b7fa0b39 100644 --- a/server/TracyWorker.cpp +++ b/server/TracyWorker.cpp @@ -4851,8 +4851,8 @@ void Worker::ReadTimelineUpdateStatistics( ZoneEvent* zone, uint16_t thread ) auto timeSpan = zone->End() - zone->Start(); if( timeSpan > 0 ) { - slz.min = std::min( slz.min, timeSpan ); - slz.max = std::max( slz.max, timeSpan ); + if( slz.min > timeSpan ) slz.min = timeSpan; + if( slz.max < timeSpan ) slz.max = timeSpan; slz.total += timeSpan; slz.sumSq += double( timeSpan ) * timeSpan; if( zone->Child() >= 0 ) @@ -4863,8 +4863,8 @@ void Worker::ReadTimelineUpdateStatistics( ZoneEvent* zone, uint16_t thread ) timeSpan -= childSpan; } } - slz.selfMin = std::min( slz.selfMin, timeSpan ); - slz.selfMax = std::max( slz.selfMax, timeSpan ); + if( slz.selfMin > timeSpan ) slz.selfMin = timeSpan; + if( slz.selfMax < timeSpan ) slz.selfMax = timeSpan; slz.selfTotal += timeSpan; } }