Skip to content

Commit

Permalink
HPCC-32480 Changes following review
Browse files Browse the repository at this point in the history
Signed-off-by: Shamser Ahmed <[email protected]>
  • Loading branch information
shamser committed Oct 24, 2024
1 parent 60a1f8d commit 41866ee
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 15 deletions.
7 changes: 1 addition & 6 deletions common/thorhelper/thorcommon.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ class SimpleActivityTimer
cycle_t startCycles;
cycle_t &accumulator;
protected:
mutable bool enabled;
const bool enabled;
public:
inline SimpleActivityTimer(cycle_t &_accumulator, const bool _enabled)
: accumulator(_accumulator), enabled(_enabled)
Expand All @@ -327,17 +327,12 @@ class SimpleActivityTimer
}

inline ~SimpleActivityTimer()
{
leave();
}
inline void leave()
{
if (likely(enabled))
{
cycle_t nowCycles = get_cycles_now();
cycle_t elapsedCycles = nowCycles - startCycles;
accumulator += elapsedCycles;
enabled = false;
}
}
};
Expand Down
18 changes: 9 additions & 9 deletions thorlcr/activities/funnel/thfunnelslave.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,15 @@ class CParallelFunnel : implements IRowStream, public CSimpleInterface
while (!stopping)
{
numRows = 0;
for (;numRows < chunkSize; numRows++)
{
LookAheadTimer timer(funnel.activity.getActivityTimerAccumulator(), funnel.activity.queryTimeActivities());
const void * row = inputStream->ungroupedNextRow();
if (!row)
break;
rows[numRows] = row;
for (;numRows < chunkSize; numRows++)
{
const void * row = inputStream->ungroupedNextRow();
if (!row)
break;
rows[numRows] = row;
}
}

if (numRows == 0) break;
Expand Down Expand Up @@ -201,7 +203,6 @@ class CParallelFunnel : implements IRowStream, public CSimpleInterface
if (waitForSpace)
{
CriticalBlock b(writerCrit);
BlockedActivityTimer timer(activity.getActivityTimerAccumulator(), activity.queryTimeActivities());
fullSem.wait(); // block pushers on crit
}
}
Expand Down Expand Up @@ -297,9 +298,7 @@ class CParallelFunnel : implements IRowStream, public CSimpleInterface
{
if (exception)
throw exception.getClear();
BlockedActivityTimer timer(activity.getActivityTimerAccumulator(), activity.queryTimeActivities());
OwnedConstThorRow row = rows.dequeue();
timer.leave();
if (!row) {
rows.stop();
return NULL;
Expand Down Expand Up @@ -384,7 +383,8 @@ class FunnelSlaveActivity : public CSlaveActivity
{
try
{
LookAheadTimer timer(slaveTimerStats, timeActivities);
// n.b. i>0 is started asynchronously, so track look ahead time
LookAheadTimer timer(slaveTimerStats, (i==0) ? false : timeActivities);
startInput(i);
}
catch (CATCHALL)
Expand Down

0 comments on commit 41866ee

Please sign in to comment.