From 1751abfc35f8bf07ff587da6255def62df9d70e7 Mon Sep 17 00:00:00 2001 From: Shamser Ahmed Date: Mon, 4 Nov 2024 12:26:03 +0000 Subject: [PATCH 1/3] 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 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/thorlcr/activities/loop/thloopslave.cpp b/thorlcr/activities/loop/thloopslave.cpp index 722358f0e4d..92ee29d1356 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; @@ -439,6 +438,7 @@ class CLoopSlaveActivity : public CLoopSlaveActivityBase } CATCH_NEXTROW() { + ActivityTimer t(slaveTimerStats, timeActivities); return nextRowFeeder->nextRow(); } virtual void stop() override From 07fe69edfa90c1680115e2c51a60690d6da32e6b Mon Sep 17 00:00:00 2001 From: Shamser Ahmed Date: Tue, 5 Nov 2024 15:27:21 +0000 Subject: [PATCH 2/3] HPCC-32933 Track lookahead time for loop activity Signed-off-by: Shamser Ahmed --- thorlcr/activities/loop/thloopslave.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/thorlcr/activities/loop/thloopslave.cpp b/thorlcr/activities/loop/thloopslave.cpp index 92ee29d1356..fa66f36ef05 100644 --- a/thorlcr/activities/loop/thloopslave.cpp +++ b/thorlcr/activities/loop/thloopslave.cpp @@ -304,12 +304,16 @@ class CLoopSlaveActivity : public CLoopSlaveActivityBase { while (!abortSoon) { - OwnedConstThorRow ret = (void *)curInput->nextRow(); - if (!ret) + OwnedConstThorRow ret; { - ret.setown(curInput->nextRow()); // more cope with groups somehow.... + LookAheadTimer t(slaveTimerStats, timeActivities); + ret.setown(curInput->nextRow()); if (!ret) - break; + { + ret.setown(curInput->nextRow()); // more cope with groups somehow.... + if (!ret) + break; + } } if (finishedLooping || From b687edd95331d7421fa89f4f4ad42f9e0b5faddd Mon Sep 17 00:00:00 2001 From: Shamser Ahmed Date: Wed, 13 Nov 2024 11:43:05 +0000 Subject: [PATCH 3/3] HPCC-32933 Only count the first iteration time input processing for the purposes of lookahead Signed-off-by: Shamser Ahmed --- thorlcr/activities/loop/thloopslave.cpp | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/thorlcr/activities/loop/thloopslave.cpp b/thorlcr/activities/loop/thloopslave.cpp index fa66f36ef05..58b4382a81e 100644 --- a/thorlcr/activities/loop/thloopslave.cpp +++ b/thorlcr/activities/loop/thloopslave.cpp @@ -306,13 +306,27 @@ class CLoopSlaveActivity : public CLoopSlaveActivityBase { OwnedConstThorRow ret; { - LookAheadTimer t(slaveTimerStats, timeActivities); - ret.setown(curInput->nextRow()); - if (!ret) + if (loopCounter==1) { - ret.setown(curInput->nextRow()); // more cope with groups somehow.... + // the time used in first iteration is lookahead time + LookAheadTimer t(slaveTimerStats, timeActivities); + ret.setown(curInput->nextRow()); if (!ret) - break; + { + 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; + } } }