Skip to content

Commit

Permalink
HPCC-32941 Log warning if input time is more than total time
Browse files Browse the repository at this point in the history
* Track when timers active on ActivityAccumulators
* Report when timers inactive and input time is more than total time
This ensures that the false reports are suppressed (input time may be
more than total time if the upstream activity is busy processing).

Signed-off-by: Shamser Ahmed <[email protected]>
  • Loading branch information
shamser committed Nov 5, 2024
1 parent 0e602df commit 9118981
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
5 changes: 4 additions & 1 deletion common/thorhelper/thorcommon.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -246,12 +246,13 @@ class THORHELPER_API ActivityTimeAccumulator
cycle_t firstExitCycles; // Wall clock time of first exit from this activity
cycle_t blockedCycles; // Time spent blocked
cycle_t lookAheadCycles; // Time spent by lookahead thread

unsigned activeActivityTimers = 0; // Number of active activity timers
// Return the total amount of time (in nanoseconds) spent in this activity (first entry to last exit)
inline unsigned __int64 elapsed() const { return cycle_to_nanosec(endCycles-startCycles); }
// Return the total amount of time (in nanoseconds) spent in the first call of this activity (first entry to first exit)
inline unsigned __int64 latency() const { return cycle_to_nanosec(latencyCycles()); }
inline cycle_t latencyCycles() const { return firstExitCycles-startCycles; }
inline unsigned queryNumActiveTimers() const { return activeActivityTimers; }

void addStatistics(IStatisticGatherer & builder) const;
void addStatistics(CRuntimeStatisticCollection & merged) const;
Expand Down Expand Up @@ -291,6 +292,7 @@ class ActivityTimer
accumulator.startCycles = startCycles;
accumulator.firstRow = getTimeStampNowValue();
}
++accumulator.activeActivityTimers;
}
else
startCycles = 0;
Expand All @@ -306,6 +308,7 @@ class ActivityTimer
accumulator.totalCycles += elapsedCycles;
if (unlikely(isFirstRow))
accumulator.firstExitCycles = nowCycles;
--accumulator.activeActivityTimers;
}
}
};
Expand Down
7 changes: 5 additions & 2 deletions thorlcr/graph/thgraphslave.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -588,11 +588,14 @@ unsigned __int64 CSlaveActivity::queryLocalCycles() const
}
}
unsigned __int64 processCycles = queryTotalCycles() + queryLookAheadCycles();
if (processCycles < inputCycles) // not sure how/if possible, but guard against
if (processCycles < inputCycles && slaveTimerStats.queryNumActiveTimers()==0) // not sure how/if possible, but guard against
{
ActPrintLog("CSlaveActivity::queryLocalCycles - process %" I64F "uns < inputCycles %" I64F "uns", cycle_to_nanosec(processCycles), cycle_to_nanosec(inputCycles));
return 0;
}
processCycles -= inputCycles;
const unsigned __int64 blockedCycles = queryBlockedCycles();
if (processCycles < blockedCycles)
if (processCycles < blockedCycles && slaveTimerStats.queryNumActiveTimers()==0)
{
ActPrintLog("CSlaveActivity::queryLocalCycles - process %" I64F "uns < blocked %" I64F "uns", cycle_to_nanosec(processCycles), cycle_to_nanosec(blockedCycles));
return 0;
Expand Down

0 comments on commit 9118981

Please sign in to comment.