From 481267dca8665a3a2d082d95f69702c1f827b293 Mon Sep 17 00:00:00 2001 From: drrtuy Date: Mon, 17 Mar 2025 13:55:12 +0000 Subject: [PATCH] chore(): reduced error-prone boilerplate for STS functionality --- dbcon/joblist/crossenginestep.cpp | 11 ++----- dbcon/joblist/pdictionaryscan.cpp | 22 ++++--------- dbcon/joblist/subquerystep.cpp | 10 ++---- dbcon/joblist/tuple-bps.cpp | 24 +++++---------- dbcon/joblist/tupleaggregatestep.cpp | 33 +++----------------- dbcon/joblist/tupleannexstep.cpp | 46 +++++----------------------- dbcon/joblist/tupleconstantstep.cpp | 11 ++----- dbcon/joblist/tuplehashjoin.cpp | 12 ++------ dbcon/joblist/tuplehavingstep.cpp | 11 ++----- dbcon/joblist/tupleunion.cpp | 11 ++----- dbcon/joblist/windowfunctionstep.cpp | 20 +++++------- utils/querytele/telestats.h | 46 ++++++++++++++++++++++++++++ 12 files changed, 90 insertions(+), 167 deletions(-) diff --git a/dbcon/joblist/crossenginestep.cpp b/dbcon/joblist/crossenginestep.cpp index db9ccb828..9f63e012e 100644 --- a/dbcon/joblist/crossenginestep.cpp +++ b/dbcon/joblist/crossenginestep.cpp @@ -379,14 +379,9 @@ void CrossEngineStep::join() void CrossEngineStep::execute() { int ret = 0; - StepTeleStats sts; - sts.query_uuid = fQueryUuid; - sts.step_uuid = fStepUuid; - try { - sts.msg_type = StepTeleStats::ST_START; - sts.total_units_of_work = 1; + StepTeleStats sts(fQueryUuid, fStepUuid, StepTeleStats::ST_START, 1); postStepStartTele(sts); ret = mysql->init(fHost.c_str(), fPort, fUser.c_str(), fPasswd.c_str(), fSchema.c_str()); @@ -577,9 +572,7 @@ void CrossEngineStep::execute() "CrossEngineStep::execute()"); } - sts.msg_type = StepTeleStats::ST_SUMMARY; - sts.total_units_of_work = sts.units_of_work_completed = 1; - sts.rows = fRowsReturned; + StepTeleStats sts(fQueryUuid, fStepUuid, StepTeleStats::ST_SUMMARY, 1, 1, fRowsReturned); postStepSummaryTele(sts); fEndOfResult = true; diff --git a/dbcon/joblist/pdictionaryscan.cpp b/dbcon/joblist/pdictionaryscan.cpp index dc3c1cf1f..c710466cf 100644 --- a/dbcon/joblist/pdictionaryscan.cpp +++ b/dbcon/joblist/pdictionaryscan.cpp @@ -544,14 +544,9 @@ void pDictionaryScan::receivePrimitiveMessages() fOutputRowGroup.setData(&rgData); fOutputRowGroup.resetRowGroup(0); - StepTeleStats sts; - sts.query_uuid = fQueryUuid; - sts.step_uuid = fStepUuid; - if (fOid >= 3000) { - sts.msg_type = StepTeleStats::ST_START; - sts.total_units_of_work = fMsgsExpect; + StepTeleStats sts(fQueryUuid, fStepUuid, StepTeleStats::ST_START, fMsgsExpect); postStepStartTele(sts); } @@ -660,9 +655,7 @@ void pDictionaryScan::receivePrimitiveMessages() if (progress > fProgress) { fProgress = progress; - sts.msg_type = StepTeleStats::ST_PROGRESS; - sts.total_units_of_work = fMsgsExpect; - sts.units_of_work_completed = msgsRecvd; + StepTeleStats sts(fQueryUuid, fStepUuid, StepTeleStats::ST_PROGRESS, fMsgsExpect, msgsRecvd); postStepProgressTele(sts); } } @@ -790,13 +783,10 @@ void pDictionaryScan::receivePrimitiveMessages() formatMiniStats(); } - sts.msg_type = StepTeleStats::ST_SUMMARY; - sts.phy_io = fPhysicalIO; - sts.cache_io = fCacheIO; - sts.msg_rcv_cnt = sts.total_units_of_work = sts.units_of_work_completed = msgsRecvd; - sts.msg_bytes_in = fMsgBytesIn; - sts.msg_bytes_out = fMsgBytesOut; - sts.rows = fRidResults; + StepTeleStats sts(fQueryUuid, fStepUuid, StepTeleStats::ST_SUMMARY, + msgsRecvd, msgsRecvd, fRidResults, + fPhysicalIO, fCacheIO, msgsRecvd, + fMsgBytesIn, fMsgBytesOut); postStepSummaryTele(sts); } diff --git a/dbcon/joblist/subquerystep.cpp b/dbcon/joblist/subquerystep.cpp index 4b8214c8c..79bd8e372 100644 --- a/dbcon/joblist/subquerystep.cpp +++ b/dbcon/joblist/subquerystep.cpp @@ -337,9 +337,6 @@ void SubAdapterStep::execute() fRowGroupOut.initRow(&rowOut); RGData rowFeData; - StepTeleStats sts; - sts.query_uuid = fQueryUuid; - sts.step_uuid = fStepUuid; bool usesFE = false; if (fRowGroupFe.getColumnCount() > 0) @@ -355,8 +352,7 @@ void SubAdapterStep::execute() try { - sts.msg_type = StepTeleStats::ST_START; - sts.total_units_of_work = 1; + StepTeleStats sts(fQueryUuid, fStepUuid, StepTeleStats::ST_START, 1); postStepStartTele(sts); fSubStep->run(); @@ -431,9 +427,7 @@ void SubAdapterStep::execute() printCalTrace(); } - sts.msg_type = StepTeleStats::ST_SUMMARY; - sts.total_units_of_work = sts.units_of_work_completed = 1; - sts.rows = fRowsReturned; + StepTeleStats sts(fQueryUuid, fStepUuid, StepTeleStats::ST_SUMMARY, 1, 1, fRowsReturned); postStepSummaryTele(sts); // Bug 3136, let mini stats to be formatted if traceOn. diff --git a/dbcon/joblist/tuple-bps.cpp b/dbcon/joblist/tuple-bps.cpp index e12f250d3..5f57e0ac0 100644 --- a/dbcon/joblist/tuple-bps.cpp +++ b/dbcon/joblist/tuple-bps.cpp @@ -2392,10 +2392,7 @@ void TupleBPS::receiveMultiPrimitiveMessages() AnyDataListSPtr dl = fOutputJobStepAssociation.outAt(0); RowGroupDL* dlp = (fDelivery ? deliveryDL.get() : dl->rowGroupDL()); - StepTeleStats sts; - sts.query_uuid = fQueryUuid; - sts.step_uuid = fStepUuid; - + bool sentStartMsg = false; uint32_t size = 0; // Based on the type of `tupleBPS` operation - initialize the `JoinLocalDataPool`. @@ -2436,11 +2433,11 @@ void TupleBPS::receiveMultiPrimitiveMessages() if (traceOn() && fOid >= 3000 && dlTimes.FirstReadTime().tv_sec == 0) dlTimes.setFirstReadTime(); - if (fOid >= 3000 && sts.msg_type == StepTeleStats::ST_INVALID && size > 0) + if (fOid >= 3000 && !sentStartMsg && size > 0) { - sts.msg_type = StepTeleStats::ST_START; - sts.total_units_of_work = totalMsgs; + StepTeleStats sts(fQueryUuid, fStepUuid, StepTeleStats::ST_START, totalMsgs); postStepStartTele(sts); + sentStartMsg = true; } for (uint32_t z = 0; z < size; z++) @@ -2572,9 +2569,7 @@ void TupleBPS::receiveMultiPrimitiveMessages() { fProgress = progress; - sts.msg_type = StepTeleStats::ST_PROGRESS; - sts.total_units_of_work = totalMsgs; - sts.units_of_work_completed = msgsRecvd; + StepTeleStats sts(fQueryUuid, fStepUuid, StepTeleStats::ST_PROGRESS, totalMsgs, msgsRecvd); postStepProgressTele(sts); } } @@ -2804,14 +2799,9 @@ void TupleBPS::receiveMultiPrimitiveMessages() } { - sts.msg_type = StepTeleStats::ST_SUMMARY; - sts.phy_io = fPhysicalIO; - sts.cache_io = fCacheIO; - sts.msg_rcv_cnt = sts.total_units_of_work = sts.units_of_work_completed = msgsRecvd; + StepTeleStats sts(fQueryUuid, fStepUuid, StepTeleStats::ST_SUMMARY, msgsRecvd, msgsRecvd, ridsReturned, + fPhysicalIO, fCacheIO, msgsRecvd, fMsgBytesIn, fMsgBytesOut); sts.cp_blocks_skipped = fNumBlksSkipped; - sts.msg_bytes_in = fMsgBytesIn; - sts.msg_bytes_out = fMsgBytesOut; - sts.rows = ridsReturned; postStepSummaryTele(sts); } diff --git a/dbcon/joblist/tupleaggregatestep.cpp b/dbcon/joblist/tupleaggregatestep.cpp index ab3025351..595ce634b 100644 --- a/dbcon/joblist/tupleaggregatestep.cpp +++ b/dbcon/joblist/tupleaggregatestep.cpp @@ -580,12 +580,7 @@ uint32_t TupleAggregateStep::nextBand_singleThread(messageqcpp::ByteStream& bs) if (fEndOfResult) { - StepTeleStats sts; - sts.query_uuid = fQueryUuid; - sts.step_uuid = fStepUuid; - sts.msg_type = StepTeleStats::ST_SUMMARY; - sts.total_units_of_work = sts.units_of_work_completed = 1; - sts.rows = fRowsReturned; + StepTeleStats sts(fQueryUuid, fStepUuid, StepTeleStats::ST_SUMMARY, 1, 1, fRowsReturned); postStepSummaryTele(sts); // send an empty / error band @@ -5299,11 +5294,7 @@ void TupleAggregateStep::aggregateRowGroups() if (traceOn()) dlTimes.setFirstReadTime(); - StepTeleStats sts; - sts.query_uuid = fQueryUuid; - sts.step_uuid = fStepUuid; - sts.msg_type = StepTeleStats::ST_START; - sts.total_units_of_work = 1; + StepTeleStats sts(fQueryUuid, fStepUuid, StepTeleStats::ST_START, 1); postStepStartTele(sts); try @@ -5427,11 +5418,7 @@ void TupleAggregateStep::threadedAggregateRowGroups(uint32_t threadID) if (traceOn()) dlTimes.setFirstReadTime(); - StepTeleStats sts; - sts.query_uuid = fQueryUuid; - sts.step_uuid = fStepUuid; - sts.msg_type = StepTeleStats::ST_START; - sts.total_units_of_work = 1; + StepTeleStats sts(fQueryUuid, fStepUuid, StepTeleStats::ST_START, 1); postStepStartTele(sts); } @@ -5710,12 +5697,7 @@ void TupleAggregateStep::doAggregate_singleThread() if (traceOn()) printCalTrace(); - StepTeleStats sts; - sts.query_uuid = fQueryUuid; - sts.step_uuid = fStepUuid; - sts.msg_type = StepTeleStats::ST_SUMMARY; - sts.total_units_of_work = sts.units_of_work_completed = 1; - sts.rows = fRowsReturned; + StepTeleStats sts(fQueryUuid, fStepUuid, StepTeleStats::ST_SUMMARY, 1, 1, fRowsReturned); postStepSummaryTele(sts); // Bug 3136, let mini stats to be formatted if traceOn. @@ -5957,12 +5939,7 @@ uint64_t TupleAggregateStep::doThreadedAggregate(ByteStream& bs, RowGroupDL* dlp if (fEndOfResult) { - StepTeleStats sts; - sts.query_uuid = fQueryUuid; - sts.step_uuid = fStepUuid; - sts.msg_type = StepTeleStats::ST_SUMMARY; - sts.total_units_of_work = sts.units_of_work_completed = 1; - sts.rows = fRowsReturned; + StepTeleStats sts(fQueryUuid, fStepUuid, StepTeleStats::ST_SUMMARY, 1, 1, fRowsReturned); postStepSummaryTele(sts); if (dlp) diff --git a/dbcon/joblist/tupleannexstep.cpp b/dbcon/joblist/tupleannexstep.cpp index a942d0f17..2a72c0e3e 100644 --- a/dbcon/joblist/tupleannexstep.cpp +++ b/dbcon/joblist/tupleannexstep.cpp @@ -252,12 +252,7 @@ void TupleAnnexStep::run() fRunnersList.resize(fMaxThreads); fInputIteratorsList.resize(fMaxThreads + 1); - // *DRRTUY Make this block conditional - StepTeleStats sts; - sts.query_uuid = fQueryUuid; - sts.step_uuid = fStepUuid; - sts.msg_type = StepTeleStats::ST_START; - sts.total_units_of_work = 1; + StepTeleStats sts(fQueryUuid, fStepUuid, StepTeleStats::ST_START, 1); postStepStartTele(sts); for (uint32_t id = 1; id <= fMaxThreads; id++) @@ -350,12 +345,7 @@ void TupleAnnexStep::execute() else executeNoOrderBy(); - StepTeleStats sts; - sts.query_uuid = fQueryUuid; - sts.step_uuid = fStepUuid; - sts.msg_type = StepTeleStats::ST_SUMMARY; - sts.total_units_of_work = sts.units_of_work_completed = 1; - sts.rows = fRowsReturned; + StepTeleStats sts(fQueryUuid, fStepUuid, StepTeleStats::ST_SUMMARY, 1, 1, fRowsReturned); postStepSummaryTele(sts); if (traceOn()) @@ -389,11 +379,7 @@ void TupleAnnexStep::executeNoOrderBy() if (traceOn()) dlTimes.setFirstReadTime(); - StepTeleStats sts; - sts.query_uuid = fQueryUuid; - sts.step_uuid = fStepUuid; - sts.msg_type = StepTeleStats::ST_START; - sts.total_units_of_work = 1; + StepTeleStats sts(fQueryUuid, fStepUuid, StepTeleStats::ST_START, 1); postStepStartTele(sts); while (more && !cancelled() && !fLimitHit) @@ -495,11 +481,7 @@ void TupleAnnexStep::executeNoOrderByWithDistinct() if (traceOn()) dlTimes.setFirstReadTime(); - StepTeleStats sts; - sts.query_uuid = fQueryUuid; - sts.step_uuid = fStepUuid; - sts.msg_type = StepTeleStats::ST_START; - sts.total_units_of_work = 1; + StepTeleStats sts(fQueryUuid, fStepUuid, StepTeleStats::ST_START, 1); postStepStartTele(sts); while (more && !cancelled() && !fLimitHit) @@ -628,11 +610,7 @@ void TupleAnnexStep::executeWithOrderBy() if (traceOn()) dlTimes.setFirstReadTime(); - StepTeleStats sts; - sts.query_uuid = fQueryUuid; - sts.step_uuid = fStepUuid; - sts.msg_type = StepTeleStats::ST_START; - sts.total_units_of_work = 1; + StepTeleStats sts(fQueryUuid, fStepUuid, StepTeleStats::ST_START, 1); postStepStartTele(sts); while (more && !cancelled()) @@ -908,12 +886,7 @@ void TupleAnnexStep::finalizeParallelOrderByDistinct() fOrderByList[id]->returnAllRGDataMemory2RM(); } - StepTeleStats sts; - sts.query_uuid = fQueryUuid; - sts.step_uuid = fStepUuid; - sts.msg_type = StepTeleStats::ST_SUMMARY; - sts.total_units_of_work = sts.units_of_work_completed = 1; - sts.rows = fRowsReturned; + StepTeleStats sts(fQueryUuid, fStepUuid, StepTeleStats::ST_SUMMARY, 1, 1, fRowsReturned); postStepSummaryTele(sts); } @@ -1099,12 +1072,7 @@ void TupleAnnexStep::finalizeParallelOrderBy() fOrderByList[id]->returnAllRGDataMemory2RM(); } - StepTeleStats sts; - sts.query_uuid = fQueryUuid; - sts.step_uuid = fStepUuid; - sts.msg_type = StepTeleStats::ST_SUMMARY; - sts.total_units_of_work = sts.units_of_work_completed = 1; - sts.rows = fRowsReturned; + StepTeleStats sts(fQueryUuid, fStepUuid, StepTeleStats::ST_SUMMARY, 1, 1, fRowsReturned); postStepSummaryTele(sts); } diff --git a/dbcon/joblist/tupleconstantstep.cpp b/dbcon/joblist/tupleconstantstep.cpp index 516f794d3..3c0cbda62 100644 --- a/dbcon/joblist/tupleconstantstep.cpp +++ b/dbcon/joblist/tupleconstantstep.cpp @@ -386,10 +386,6 @@ void TupleConstantStep::execute() RGData rgDataIn; RGData rgDataOut; bool more = false; - StepTeleStats sts; - sts.query_uuid = fQueryUuid; - sts.step_uuid = fStepUuid; - try { more = fInputDL->next(fInputIterator, &rgDataIn); @@ -397,8 +393,7 @@ void TupleConstantStep::execute() if (traceOn()) dlTimes.setFirstReadTime(); - sts.msg_type = StepTeleStats::ST_START; - sts.total_units_of_work = 1; + StepTeleStats sts(fQueryUuid, fStepUuid, StepTeleStats::ST_START, 1); postStepStartTele(sts); if (!more && cancelled()) @@ -435,9 +430,7 @@ void TupleConstantStep::execute() while (more) more = fInputDL->next(fInputIterator, &rgDataIn); - sts.msg_type = StepTeleStats::ST_SUMMARY; - sts.total_units_of_work = sts.units_of_work_completed = 1; - sts.rows = fRowsReturned; + StepTeleStats sts(fQueryUuid, fStepUuid, StepTeleStats::ST_SUMMARY, 1, 1, fRowsReturned); postStepSummaryTele(sts); // Bug 3136, let mini stats to be formatted if traceOn. diff --git a/dbcon/joblist/tuplehashjoin.cpp b/dbcon/joblist/tuplehashjoin.cpp index 9e7b11a30..cb0781bef 100644 --- a/dbcon/joblist/tuplehashjoin.cpp +++ b/dbcon/joblist/tuplehashjoin.cpp @@ -613,15 +613,9 @@ void TupleHashJoinStep::hjRunner() return; } - StepTeleStats sts; - if (fTableOID1 >= 3000) { - sts.query_uuid = fQueryUuid; - sts.step_uuid = fStepUuid; - sts.msg_type = StepTeleStats::ST_START; - sts.start_time = QueryTeleClient::timeNowms(); - sts.total_units_of_work = 1; + StepTeleStats sts(fQueryUuid, fStepUuid, StepTeleStats::ST_START, 1, QueryTeleClient::timeNowms()); postStepStartTele(sts); } @@ -958,9 +952,7 @@ void TupleHashJoinStep::hjRunner() if (fTableOID1 >= 3000) { - sts.msg_type = StepTeleStats::ST_SUMMARY; - sts.end_time = QueryTeleClient::timeNowms(); - sts.total_units_of_work = sts.units_of_work_completed = 1; + StepTeleStats sts(fQueryUuid, fStepUuid, StepTeleStats::ST_SUMMARY, 1, QueryTeleClient::timeNowms(), 1); postStepSummaryTele(sts); } } diff --git a/dbcon/joblist/tuplehavingstep.cpp b/dbcon/joblist/tuplehavingstep.cpp index e1089b3ab..7281988c6 100644 --- a/dbcon/joblist/tuplehavingstep.cpp +++ b/dbcon/joblist/tuplehavingstep.cpp @@ -256,17 +256,12 @@ void TupleHavingStep::execute() RGData rgDataIn; RGData rgDataOut; bool more = false; - StepTeleStats sts; - sts.query_uuid = fQueryUuid; - sts.step_uuid = fStepUuid; - try { more = fInputDL->next(fInputIterator, &rgDataIn); dlTimes.setFirstReadTime(); - sts.msg_type = StepTeleStats::ST_START; - sts.total_units_of_work = 1; + StepTeleStats sts(fQueryUuid, fStepUuid, StepTeleStats::ST_START, 1); postStepStartTele(sts); if (!more && cancelled()) @@ -306,9 +301,7 @@ void TupleHavingStep::execute() fEndOfResult = true; fOutputDL->endOfInput(); - sts.msg_type = StepTeleStats::ST_SUMMARY; - sts.total_units_of_work = sts.units_of_work_completed = 1; - sts.rows = fRowsReturned; + StepTeleStats sts(fQueryUuid, fStepUuid, StepTeleStats::ST_SUMMARY, 1, 1, fRowsReturned); postStepSummaryTele(sts); dlTimes.setLastReadTime(); diff --git a/dbcon/joblist/tupleunion.cpp b/dbcon/joblist/tupleunion.cpp index 5bb06c88f..cde15c308 100644 --- a/dbcon/joblist/tupleunion.cpp +++ b/dbcon/joblist/tupleunion.cpp @@ -1393,10 +1393,6 @@ void TupleUnion::readInput(uint32_t which) Row inRow, outRow, tmpRow; bool distinct; uint64_t memUsageBefore, memUsageAfter, memDiff; - StepTeleStats sts; - sts.query_uuid = fQueryUuid; - sts.step_uuid = fStepUuid; - l_outputRG = outputRG; dl = inputs[which]; l_inputRG = inputRGs[which]; @@ -1431,8 +1427,7 @@ void TupleUnion::readInput(uint32_t which) if (fStartTime == -1) { - sts.msg_type = StepTeleStats::ST_START; - sts.total_units_of_work = 1; + StepTeleStats sts(fQueryUuid, fStepUuid, StepTeleStats::ST_START, 1); postStepStartTele(sts); } @@ -1559,9 +1554,7 @@ void TupleUnion::readInput(uint32_t which) { output->endOfInput(); - sts.msg_type = StepTeleStats::ST_SUMMARY; - sts.total_units_of_work = sts.units_of_work_completed = 1; - sts.rows = fRowsReturned; + StepTeleStats sts(fQueryUuid, fStepUuid, StepTeleStats::ST_SUMMARY, 1, 1, fRowsReturned); postStepSummaryTele(sts); if (traceOn()) diff --git a/dbcon/joblist/windowfunctionstep.cpp b/dbcon/joblist/windowfunctionstep.cpp index 7ca5da85d..da0410a2c 100644 --- a/dbcon/joblist/windowfunctionstep.cpp +++ b/dbcon/joblist/windowfunctionstep.cpp @@ -18,7 +18,7 @@ // $Id: windowfunctionstep.cpp 9681 2013-07-11 22:58:05Z xlou $ -//#define NDEBUG +// #define NDEBUG #include #include #include @@ -865,12 +865,10 @@ void WindowFunctionStep::execute() if (traceOn()) dlTimes.setFirstReadTime(); - StepTeleStats sts; - sts.query_uuid = fQueryUuid; - sts.step_uuid = fStepUuid; - sts.msg_type = StepTeleStats::ST_START; - sts.total_units_of_work = 1; - postStepStartTele(sts); + { + StepTeleStats sts(fQueryUuid, fStepUuid, StepTeleStats::ST_START, 1); + postStepStartTele(sts); + } try { @@ -930,9 +928,7 @@ void WindowFunctionStep::execute() fOutputDL->endOfInput(); - sts.msg_type = StepTeleStats::ST_SUMMARY; - sts.total_units_of_work = sts.units_of_work_completed = 1; - sts.rows = fRowsReturned; + StepTeleStats sts(fQueryUuid, fStepUuid, StepTeleStats::ST_SUMMARY, 1, 1, fRowsReturned); postStepSummaryTele(sts); if (traceOn()) @@ -982,9 +978,7 @@ void WindowFunctionStep::execute() fOutputDL->endOfInput(); - sts.msg_type = StepTeleStats::ST_SUMMARY; - sts.total_units_of_work = sts.units_of_work_completed = 1; - sts.rows = fRowsReturned; + StepTeleStats sts(fQueryUuid, fStepUuid, StepTeleStats::ST_SUMMARY, 1, 1, fRowsReturned); postStepSummaryTele(sts); if (traceOn()) diff --git a/utils/querytele/telestats.h b/utils/querytele/telestats.h index 026027c00..b874694ff 100644 --- a/utils/querytele/telestats.h +++ b/utils/querytele/telestats.h @@ -138,6 +138,52 @@ struct StepTeleStats ~StepTeleStats() = default; + // Constructor for creating a stats object with specified parameters + StepTeleStats(const boost::uuids::uuid& qUuid, const boost::uuids::uuid& sUuid, + STType msgType, int32_t totalWork, + int32_t completedWork = 0, int64_t rowCount = 0) + : StepTeleStats() // Reuse default constructor + { + query_uuid = qUuid; + step_uuid = sUuid; + msg_type = msgType; + total_units_of_work = totalWork; + units_of_work_completed = completedWork; + rows = rowCount; + } + + // Constructor for creating a stats object with IO and message stats + StepTeleStats(const boost::uuids::uuid& qUuid, const boost::uuids::uuid& sUuid, + STType msgType, int32_t totalWork, int32_t completedWork, + int64_t rowCount, int64_t physicalIO, int64_t cacheIO, + int64_t msgCount, int64_t bytesIn, int64_t bytesOut) + : StepTeleStats() // Reuse default constructor + { + query_uuid = qUuid; + step_uuid = sUuid; + msg_type = msgType; + total_units_of_work = totalWork; + units_of_work_completed = completedWork; + rows = rowCount; + phy_io = physicalIO; + cache_io = cacheIO; + msg_rcv_cnt = msgCount; + msg_bytes_in = bytesIn; + msg_bytes_out = bytesOut; + } + + // Constructor for creating a stats object with time tracking + StepTeleStats(const boost::uuids::uuid& qUuid, const boost::uuids::uuid& sUuid, + STType msgType, int32_t totalWork, int64_t timeStamp, + int32_t completedWork = 0, int64_t rowCount = 0) + : StepTeleStats(qUuid, sUuid, msgType, totalWork, completedWork, rowCount) // Delegate to base constructor + { + if (msgType == ST_START) + start_time = timeStamp; + else if (msgType == ST_SUMMARY) + end_time = timeStamp; + } + boost::uuids::uuid query_uuid; STType msg_type; StepType step_type;