From a7fd5dd0a7451dbb4dfe4758d97e5d22da9d7fad Mon Sep 17 00:00:00 2001 From: Richard Chapman Date: Wed, 24 Jul 2024 10:05:31 +0100 Subject: [PATCH] Changes following review Signed-off-by: Richard Chapman --- roxie/udplib/udptrr.cpp | 12 ++++-------- system/jlib/jmisc.hpp | 10 +++++++--- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/roxie/udplib/udptrr.cpp b/roxie/udplib/udptrr.cpp index 32cc7468a75..984b5a164cc 100644 --- a/roxie/udplib/udptrr.cpp +++ b/roxie/udplib/udptrr.cpp @@ -1424,14 +1424,10 @@ class CReceiveManager : implements IReceiveManager, public CInterface DBGLOG("UdpReceiver: %u bytes received packet %" SEQF "u %x from %s", res, hdr.sendSeq, hdr.pktSeq, hdr.node.getTraceText(s).str()); } } - { - UdpRdTracker::TimeDivision d(timeTracker, UdpRdTracker::pushing); - parent.input_queue->pushOwn(b); - } - { - UdpRdTracker::TimeDivision d(timeTracker, UdpRdTracker::allocating); - b = udpBufferManager->allocate(); - } + d.switchState(UdpRdTracker::pushing); + parent.input_queue->pushOwn(b); + d.switchState(UdpRdTracker::allocating); + b = udpBufferManager->allocate(); } if (udpStatsReportInterval) { diff --git a/system/jlib/jmisc.hpp b/system/jlib/jmisc.hpp index edfbf1a39c0..6e6fe9acafe 100644 --- a/system/jlib/jmisc.hpp +++ b/system/jlib/jmisc.hpp @@ -354,8 +354,11 @@ template class TimeDivisionTracker unsigned prevState = currentState; unsigned __int64 now = get_cycles_now(); if (reportIntervalCycles && now - lastReport >= reportIntervalCycles) + { report(true); - if (newState != currentState) + now = get_cycles_now(); + } + if (newState != prevState) { totals[currentState] += now - lastTick; currentState = newState; @@ -404,12 +407,13 @@ template class TimeDivisionTracker doneOne = true; } if (reset) + { totals[i] = 0; + counts[i] = 0; + } } if (doneOne) DBGLOG("%s", str.str()); - if (reset) - lastTick = now; } class TimeDivision