From 69069f8b24732ad326f7aa9550584e46c38af0b8 Mon Sep 17 00:00:00 2001 From: Shamser Ahmed Date: Mon, 4 Nov 2024 12:26:03 +0000 Subject: [PATCH] HPCC-32933 Fix execute timings for loop activity Track execute timings are incurred by CATCH_NEXTROW. And remove execute timings in getNextRow as it is executed by the CNextRowLoader thread. Signed-off-by: Shamser Ahmed --- thorlcr/activities/loop/thloopslave.cpp | 32 ++++++++++++++++++++----- 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/thorlcr/activities/loop/thloopslave.cpp b/thorlcr/activities/loop/thloopslave.cpp index 722358f0e4d..34e9242235d 100644 --- a/thorlcr/activities/loop/thloopslave.cpp +++ b/thorlcr/activities/loop/thloopslave.cpp @@ -297,7 +297,6 @@ class CLoopSlaveActivity : public CLoopSlaveActivityBase } const void *getNextRow(bool stopping) { - ActivityTimer t(slaveTimerStats, timeActivities); if (!abortSoon && !eof) { unsigned emptyIterations = 0; @@ -305,12 +304,32 @@ class CLoopSlaveActivity : public CLoopSlaveActivityBase { while (!abortSoon) { - OwnedConstThorRow ret = (void *)curInput->nextRow(); - if (!ret) + OwnedConstThorRow ret; { - ret.setown(curInput->nextRow()); // more cope with groups somehow.... - if (!ret) - break; + if (loopCounter==1) + { + // The disk reads occur in the first iteration only so track lookahead time + // in the first iteration only. In subsequent iterations, it is reading the + // output from previous iterations. + LookAheadTimer t(slaveTimerStats, timeActivities); + ret.setown(curInput->nextRow()); + if (!ret) + { + ret.setown(curInput->nextRow()); // more cope with groups somehow.... + if (!ret) + break; + } + } + else + { + ret.setown(curInput->nextRow()); + if (!ret) + { + ret.setown(curInput->nextRow()); // more cope with groups somehow.... + if (!ret) + break; + } + } } if (finishedLooping || @@ -439,6 +458,7 @@ class CLoopSlaveActivity : public CLoopSlaveActivityBase } CATCH_NEXTROW() { + ActivityTimer t(slaveTimerStats, timeActivities); return nextRowFeeder->nextRow(); } virtual void stop() override