From 9d2aff6bc9e7163e2c1c8c90365e7a7db3108501 Mon Sep 17 00:00:00 2001 From: Shamser Ahmed Date: Mon, 9 Dec 2024 15:01:34 +0000 Subject: [PATCH] HPCC-32946 Changes following review Signed-off-by: Shamser Ahmed --- common/thorhelper/thorcommon.hpp | 12 ------------ thorlcr/activities/diskread/thdiskreadslave.cpp | 2 +- thorlcr/activities/fetch/thfetchslave.cpp | 2 +- .../activities/hashdistrib/thhashdistribslave.cpp | 15 ++++++++++----- thorlcr/activities/indexread/thindexreadslave.cpp | 2 +- .../activities/lookupjoin/thlookupjoinslave.cpp | 2 +- 6 files changed, 14 insertions(+), 21 deletions(-) diff --git a/common/thorhelper/thorcommon.hpp b/common/thorhelper/thorcommon.hpp index 4a3cf8f63c0..2393b041301 100644 --- a/common/thorhelper/thorcommon.hpp +++ b/common/thorhelper/thorcommon.hpp @@ -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 { @@ -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 diff --git a/thorlcr/activities/diskread/thdiskreadslave.cpp b/thorlcr/activities/diskread/thdiskreadslave.cpp index ee0973fbd66..1268ccfb0bd 100644 --- a/thorlcr/activities/diskread/thdiskreadslave.cpp +++ b/thorlcr/activities/diskread/thdiskreadslave.cpp @@ -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; diff --git a/thorlcr/activities/fetch/thfetchslave.cpp b/thorlcr/activities/fetch/thfetchslave.cpp index 24bb0da9635..487ed89619e 100644 --- a/thorlcr/activities/fetch/thfetchslave.cpp +++ b/thorlcr/activities/fetch/thfetchslave.cpp @@ -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; diff --git a/thorlcr/activities/hashdistrib/thhashdistribslave.cpp b/thorlcr/activities/hashdistrib/thhashdistribslave.cpp index 84fbde96284..4c70a98d837 100644 --- a/thorlcr/activities/hashdistrib/thhashdistribslave.cpp +++ b/thorlcr/activities/hashdistrib/thhashdistribslave.cpp @@ -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; diff --git a/thorlcr/activities/indexread/thindexreadslave.cpp b/thorlcr/activities/indexread/thindexreadslave.cpp index b92b71b4e29..e24cb47d302 100644 --- a/thorlcr/activities/indexread/thindexreadslave.cpp +++ b/thorlcr/activities/indexread/thindexreadslave.cpp @@ -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; diff --git a/thorlcr/activities/lookupjoin/thlookupjoinslave.cpp b/thorlcr/activities/lookupjoin/thlookupjoinslave.cpp index 589bfd6d6a7..febde309d58 100644 --- a/thorlcr/activities/lookupjoin/thlookupjoinslave.cpp +++ b/thorlcr/activities/lookupjoin/thlookupjoinslave.cpp @@ -2839,7 +2839,7 @@ class CLookupJoinActivityBase : public CInMemJoinBasequeryLookAheadCycles(); if (lhsDistributor)