@@ -263,7 +263,7 @@ namespace
263263 CpuFrameQpcGatherCommand_ (size_t nextAvailableByteOffset) : outputOffset_{ (uint32_t )nextAvailableByteOffset } {}
264264 void Gather (const Context& ctx, uint8_t * pDestBlob) const override
265265 {
266- reinterpret_cast <uint64_t &>(pDestBlob[outputOffset_]) = ctx.cpuFrameQpc ;
266+ reinterpret_cast <uint64_t &>(pDestBlob[outputOffset_]) = ctx.cpuStart ;
267267 }
268268 uint32_t GetBeginOffset () const override
269269 {
@@ -298,7 +298,7 @@ namespace
298298 return ;
299299 }
300300 }
301- const auto val = TimestampDeltaToUnsignedMilliSeconds (ctx.cpuFrameQpc ,
301+ const auto val = TimestampDeltaToUnsignedMilliSeconds (ctx.cpuStart ,
302302 ctx.pSourceFrameData ->present_event .*pEnd, ctx.performanceCounterPeriodMs );
303303 reinterpret_cast <double &>(pDestBlob[outputOffset_]) = val;
304304 }
@@ -394,7 +394,7 @@ namespace
394394 }
395395 }
396396 const auto val = TimestampDeltaToMilliSeconds (ctx.pSourceFrameData ->present_event .*pStart - ctx.previousDisplayedQpc ,
397- ctx.cpuFrameQpc - ctx.previousDisplayedCpuStartQpc , ctx.performanceCounterPeriodMs );
397+ ctx.cpuStart - ctx.previousDisplayedCpuStartQpc , ctx.performanceCounterPeriodMs );
398398 reinterpret_cast <double &>(pDestBlob[outputOffset_]) = val;
399399 }
400400 uint32_t GetBeginOffset () const override
@@ -419,10 +419,12 @@ namespace
419419 CpuFrameQpcFrameTimeCommand_ (size_t nextAvailableByteOffset) : outputOffset_{ (uint32_t )nextAvailableByteOffset } {}
420420 void Gather (const Context& ctx, uint8_t * pDestBlob) const override
421421 {
422- const auto qpcDuration = (ctx.pSourceFrameData ->present_event .PresentStartTime - ctx.cpuFrameQpc ) +
423- ctx.pSourceFrameData ->present_event .TimeInPresent ;
424- const auto val = ctx.performanceCounterPeriodMs * double (qpcDuration);
425- reinterpret_cast <double &>(pDestBlob[outputOffset_]) = val;
422+ const auto cpuBusy = TimestampDeltaToUnsignedMilliSeconds (ctx.cpuStart , ctx.pSourceFrameData ->present_event .PresentStartTime ,
423+ ctx.performanceCounterPeriodMs );
424+ const auto cpuWait = TimestampDeltaToMilliSeconds (ctx.pSourceFrameData ->present_event .TimeInPresent ,
425+ ctx.performanceCounterPeriodMs );
426+
427+ reinterpret_cast <double &>(pDestBlob[outputOffset_]) = cpuBusy + cpuWait;
426428 }
427429 uint32_t GetBeginOffset () const override
428430 {
@@ -662,12 +664,12 @@ void PM_FRAME_QUERY::Context::UpdateSourceData(const PmNsmFrameData* pSourceFram
662664 pSourceFrameData = pSourceFrameData_in;
663665 dropped = pSourceFrameData->present_event .FinalState != PresentResult::Presented;
664666 if (pFrameDataOfLastPresented) {
665- cpuFrameQpc = pFrameDataOfLastPresented->present_event .PresentStartTime + pFrameDataOfLastPresented->present_event .TimeInPresent ;
667+ cpuStart = pFrameDataOfLastPresented->present_event .PresentStartTime + pFrameDataOfLastPresented->present_event .TimeInPresent ;
666668 }
667669 else {
668670 // TODO: log issue or invalidate related columns or drop frame (or some combination)
669671 pmlog_info (L" null pFrameDataOfLastPresented" );
670- cpuFrameQpc = 0 ;
672+ cpuStart = 0 ;
671673 }
672674 if (pFrameDataOfNextDisplayed) {
673675 nextDisplayedQpc = pFrameDataOfNextDisplayed->present_event .ScreenTime ;
0 commit comments