Skip to content

Commit

Permalink
HPCC-32000 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 Jun 26, 2024
1 parent c5c0127 commit 2ca5bed
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 26 deletions.
2 changes: 1 addition & 1 deletion thorlcr/activities/nsplitter/thnsplitterslave.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ class NSplitterSlaveActivity : public CSlaveActivity, implements ISharedSmartBuf
{
PARENT::gatherActiveStats(activeStats);
if (sharedRowStream)
sharedRowStream->mergeStats(activeStats);
::mergeStats(activeStats, sharedRowStream);
}
// ISharedSmartBufferCallback impl.
virtual void paged() { pagedOut = true; }
Expand Down
65 changes: 41 additions & 24 deletions thorlcr/thorutil/thbuf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1175,8 +1175,9 @@ class CSharedWriteAheadBase : public CSimpleInterface, implements ISharedSmartBu
queryCOutput(c).reset();
inMemRows->reset(0);
}
virtual void mergeStats(CRuntimeStatisticCollection & target) const override
virtual unsigned __int64 getStatistic(StatisticKind kind) const override
{
return 0;
}
friend class COutput;
friend class CRowSet;
Expand Down Expand Up @@ -1570,19 +1571,25 @@ class CSharedWriteAheadDisk : public CSharedWriteAheadBase
tempFileIO->setSize(0);
tempFileOwner->noteSize(0);
}
virtual void mergeStats(CRuntimeStatisticCollection & target) const override
virtual unsigned __int64 getStatistic(StatisticKind kind) const override
{
::mergeStats(target, tempFileIO);
unsigned __int64 diskWriteSize = target.queryStatistic(StSizeDiskWrite).getClear();
if (diskWriteSize)
target.setStatistic(StSizeSpillFile, diskWriteSize);
unsigned __int64 ioTime = target.queryStatistic(StCycleDiskWriteIOCycles).getClear();
if (ioTime)
switch (kind)
{
target.queryStatistic(StTimeDiskWriteIO).getClear();
target.setStatistic(StTimeSpillElapsed, ioTime);
case StSizeSpillFile:
return tempFileIO->getStatistic(StSizeDiskWrite);
break;
case StCycleDiskWriteIOCycles:
case StTimeDiskWriteIO:
case StSizeDiskWrite:
return 0;
case StNumSpills:
return 1;
case StTimeSpillElapsed:
return tempFileIO->getStatistic(StCycleDiskWriteIOCycles);
break;
default:
return tempFileIO->getStatistic(kind);
}
target.setStatistic(StNumSpills, 1);
}
};

Expand Down Expand Up @@ -2171,21 +2178,31 @@ class CSharedFullSpillingWriteAhead : public CInterfaceOf<ISharedRowStreamReader
nextInputReadEog = false;
endOfInput = false;
}
virtual void mergeStats(CRuntimeStatisticCollection & target) const override
virtual unsigned __int64 getStatistic(StatisticKind kind) const override
{
if (iFileIO)
::mergeStats(target, iFileIO);
target.merge(inactiveStats);
unsigned __int64 diskWriteSize = target.queryStatistic(StSizeDiskWrite).getClear();
if (diskWriteSize)
target.setStatistic(StSizeSpillFile, diskWriteSize);
unsigned __int64 ioTime = target.queryStatistic(StCycleDiskWriteIOCycles).getClear();
if (ioTime)
StatisticKind useKind;
switch (kind)
{
target.queryStatistic(StTimeDiskWriteIO).getClear();
target.setStatistic(StTimeSpillElapsed, ioTime);
}
target.setStatistic(StNumSpills, 1);
case StSizeSpillFile:
useKind = StSizeDiskWrite;
break;
case StCycleDiskWriteIOCycles:
case StTimeDiskWriteIO:
case StSizeDiskWrite:
return 0;
case StNumSpills:
return 1;
case StTimeSpillElapsed:
useKind = StCycleDiskWriteIOCycles;
break;
default:
useKind = kind;
}
unsigned __int64 v = 0;
if (likely(iFileIO))
v = iFileIO->getStatistic(useKind);
v += inactiveStats.getStatisticValue(useKind);
return v;
}
};

Expand Down
2 changes: 1 addition & 1 deletion thorlcr/thorutil/thbuf.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ interface ISharedRowStreamReader : extends IInterface
virtual IRowStream *queryOutput(unsigned output) = 0;
virtual void cancel()=0;
virtual void reset() = 0;
virtual void mergeStats(CRuntimeStatisticCollection & target) const = 0;
virtual unsigned __int64 getStatistic(StatisticKind kind) const = 0;
};


Expand Down

0 comments on commit 2ca5bed

Please sign in to comment.