Skip to content

Commit

Permalink
HPCC-32218 Implement StNumParallelExecute stat for activities
Browse files Browse the repository at this point in the history
  • Loading branch information
shamser committed Jul 17, 2024
1 parent 7bfac14 commit e33ed7e
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions system/jlib/jstatcodes.h
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,7 @@ enum StatisticKind
StNumMatchRightRowsMax,
StNumMatchCandidates,
StNumMatchCandidatesMax,
StNumParallelExecute,
StMax,

//For any quantity there is potentially the following variants.
Expand Down
1 change: 1 addition & 0 deletions system/jlib/jstats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -983,6 +983,7 @@ static const constexpr StatisticMeta statsMetaData[StMax] = {
{ NUMSTAT(MatchRightRowsMax), "The largest number of right rows in a join group" },
{ NUMSTAT(MatchCandidates), "The number of candidate combinations of left and right rows forming join groups" },
{ NUMSTAT(MatchCandidatesMax), "The largest number of candidate combinations of left and right rows in a single group" },
{ NUMSTAT(ParallelExecute), "The number of parallel execution of the activity" },
};

static MapStringTo<StatisticKind, StatisticKind> statisticNameMap(true);
Expand Down
8 changes: 7 additions & 1 deletion thorlcr/graph/thgraphslave.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,7 @@ class graphslave_decl CThorStrandProcessor : public CInterfaceOf<IEngineRowStrea

class graphslave_decl CThorStrandedActivity : public CSlaveActivity
{
typedef CSlaveActivity PARENT;
protected:
CThorStrandOptions strandOptions;
IArrayOf<CThorStrandProcessor> strands;
Expand All @@ -496,7 +497,12 @@ class graphslave_decl CThorStrandedActivity : public CSlaveActivity
virtual CThorStrandProcessor *createStrandSourceProcessor(bool inputOrdered) = 0;

inline unsigned numStrands() const { return strands.ordinality(); }

// CSlaveActivity
virtual void gatherActiveStats(CRuntimeStatisticCollection &activeStats) const override
{
PARENT::gatherActiveStats(activeStats);
activeStats.addStatistic(StNumParallelExecute, numStrands());
}
// IThorDataLink
virtual IStrandJunction *getOutputStreams(CActivityBase &_ctx, unsigned idx, PointerArrayOf<IEngineRowStream> &streams, const CThorStrandOptions * consumerOptions, bool consumerOrdered, IOrderedCallbackCollection * orderedCallbacks) override;
virtual unsigned __int64 queryTotalCycles() const override;
Expand Down
2 changes: 1 addition & 1 deletion thorlcr/thorutil/thormisc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ static Owned<IMPtagAllocator> ClusterMPAllocator;
// stat. mappings shared between master and slave activities
const StatisticsMapping spillStatistics({StTimeSpillElapsed, StTimeSortElapsed, StNumSpills, StSizeSpillFile, StSizePeakTempDisk});
const StatisticsMapping soapcallStatistics({StTimeSoapcall});
const StatisticsMapping basicActivityStatistics({StTimeTotalExecute, StTimeLocalExecute, StTimeBlocked});
const StatisticsMapping basicActivityStatistics({StTimeTotalExecute, StTimeLocalExecute, StTimeBlocked, StNumParallelExecute});
const StatisticsMapping groupActivityStatistics({StNumGroups, StNumGroupMax}, basicActivityStatistics);
const StatisticsMapping hashJoinActivityStatistics({StNumLeftRows, StNumRightRows}, basicActivityStatistics);
const StatisticsMapping indexReadFileStatistics({}, diskReadRemoteStatistics, jhtreeCacheStatistics);
Expand Down

0 comments on commit e33ed7e

Please sign in to comment.