diff --git a/thorlcr/activities/loop/thloopslave.cpp b/thorlcr/activities/loop/thloopslave.cpp index 92ee29d1356..34e9242235d 100644 --- a/thorlcr/activities/loop/thloopslave.cpp +++ b/thorlcr/activities/loop/thloopslave.cpp @@ -304,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 ||