diff --git a/thorlcr/activities/nsplitter/thnsplitterslave.cpp b/thorlcr/activities/nsplitter/thnsplitterslave.cpp index de5e5db6c54..af9eb9469fa 100644 --- a/thorlcr/activities/nsplitter/thnsplitterslave.cpp +++ b/thorlcr/activities/nsplitter/thnsplitterslave.cpp @@ -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; } diff --git a/thorlcr/thorutil/thbuf.cpp b/thorlcr/thorutil/thbuf.cpp index 9c0e6dcfa4d..b3e66536a21 100644 --- a/thorlcr/thorutil/thbuf.cpp +++ b/thorlcr/thorutil/thbuf.cpp @@ -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; @@ -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); } }; @@ -2171,21 +2178,31 @@ class CSharedFullSpillingWriteAhead : public CInterfaceOfgetStatistic(useKind); + v += inactiveStats.getStatisticValue(useKind); + return v; } }; diff --git a/thorlcr/thorutil/thbuf.hpp b/thorlcr/thorutil/thbuf.hpp index 58f73784ee6..4bae5294652 100644 --- a/thorlcr/thorutil/thbuf.hpp +++ b/thorlcr/thorutil/thbuf.hpp @@ -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; };