Skip to content

Commit

Permalink
HPCC-32946 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 Dec 9, 2024
1 parent 683cc20 commit 9d2aff6
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 21 deletions.
12 changes: 0 additions & 12 deletions common/thorhelper/thorcommon.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -351,14 +351,6 @@ class LookAheadTimer : public SimpleActivityTimer
: SimpleActivityTimer(_accumulator.lookAheadCycles, _enabled) { }
};

#define MEASURE_CYCLES_ATOMIC(atomicvar, enabled, code_block) \
{ \
auto start = (enabled) ? get_cycles_now() : 0; \
code_block; \
if (enabled) \
atomicvar.add(get_cycles_now()-start); \
}

#else
class ActivityTimer
{
Expand All @@ -379,10 +371,6 @@ struct LookAheadTimer
inline LookAheadTimer(ActivityTimeAccumulator &_accumulator, const bool _enabled){ }
};

#define MEASURE_CYCLES_ATOMIC(atomicvar, enabled, code_block) \
{\
code_block; \
}
#endif

class THORHELPER_API IndirectCodeContextEx : public IndirectCodeContext
Expand Down
2 changes: 1 addition & 1 deletion thorlcr/activities/diskread/thdiskreadslave.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1083,7 +1083,7 @@ class CDiskGroupAggregateSlave
// CSlaveActivity overloaded methods
virtual unsigned __int64 queryLookAheadCycles() const override
{
cycle_t lookAheadCycles = slaveTimerStats.lookAheadCycles;
cycle_t lookAheadCycles = PARENT::queryLookAheadCycles();
if (distributor)
lookAheadCycles += distributor->queryLookAheadCycles();
return lookAheadCycles;
Expand Down
2 changes: 1 addition & 1 deletion thorlcr/activities/fetch/thfetchslave.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ class CFetchSlaveBase : public CSlaveActivity, implements IFetchHandler
virtual unsigned __int64 queryLookAheadCycles() const override
{
CriticalBlock b(fetchStreamCS);
cycle_t lookAheadCycles = slaveTimerStats.lookAheadCycles;
cycle_t lookAheadCycles = PARENT::queryLookAheadCycles();
if (fetchStream)
lookAheadCycles += fetchStream->queryLookAheadCycles();
return lookAheadCycles;
Expand Down
15 changes: 10 additions & 5 deletions thorlcr/activities/hashdistrib/thhashdistribslave.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -861,11 +861,16 @@ class CDistributorBase : implements IHashDistributor, implements IExceptionHandl
if (aborted)
break;
const void *row;
MEASURE_CYCLES_ATOMIC(lookAheadCycles, owner.activity->queryTimeActivities(),
{
row = input->ungroupedNextRow();
}
);
if (owner.activity->queryTimeActivities())
{
CCycleTimer rowTimer;
row = input->ungroupedNextRow();
lookAheadCycles.fastAdd(rowTimer.elapsedCycles());
}
else
{
row = input->ungroupedNextRow();
}
if (!row)
break;
CTarget *target = nullptr;
Expand Down
2 changes: 1 addition & 1 deletion thorlcr/activities/indexread/thindexreadslave.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1161,7 +1161,7 @@ class CIndexGroupAggregateSlaveActivity : public CIndexReadSlaveBase, implements
}
virtual unsigned __int64 queryLookAheadCycles() const
{
cycle_t lookAheadCycles = slaveTimerStats.lookAheadCycles;
cycle_t lookAheadCycles = PARENT::queryLookAheadCycles();
if (distributor)
lookAheadCycles += distributor->queryLookAheadCycles();
return lookAheadCycles;
Expand Down
2 changes: 1 addition & 1 deletion thorlcr/activities/lookupjoin/thlookupjoinslave.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2839,7 +2839,7 @@ class CLookupJoinActivityBase : public CInMemJoinBase<HTHELPER, IHThorHashJoinAr
}
virtual unsigned __int64 queryLookAheadCycles() const
{
cycle_t lookAheadCycles = slaveTimerStats.lookAheadCycles;
cycle_t lookAheadCycles = PARENT::queryLookAheadCycles();
if (rhsDistributor)
lookAheadCycles += rhsDistributor->queryLookAheadCycles();
if (lhsDistributor)
Expand Down

0 comments on commit 9d2aff6

Please sign in to comment.