PcloudStimBuff,IoUringAssmEngn: add frame assembly perf profiling

We now time the frame assembly sequence.
This commit is contained in:
2025-11-20 03:26:43 -04:00
parent 9e64c510cc
commit 9ce1ced92d
3 changed files with 33 additions and 8 deletions
@@ -432,6 +432,9 @@ public:
// Initialize loop with number of slots
context->loop = AsynchronousLoop(engine.frameAssemblyDesc->numSlots);
// Record assembly start time
engine.assemblyStartTime = std::chrono::high_resolution_clock::now();
/** FIXME:
* I'm suspicious of this std::bind return object here. What if us
* setting it to null inside of stop() doesn't actually cause the
@@ -528,6 +531,10 @@ public:
*/
// Ensure we only execute once using atomic exchange
if (context->handlerExecuted.exchange(true)) { return; }
// Record assembly end time
context->engine.assemblyEndTime =
std::chrono::high_resolution_clock::now();
// Cancel the timer, stop the engine and process frame, if any.
context->engine.assemblyCycleComplete();
@@ -851,5 +858,15 @@ void IoUringAssemblyEngine::printSlotBytes(size_t slotIndex, size_t nBytes)
}
}
std::chrono::milliseconds IoUringAssemblyEngine::getAssemblyDuration() const
{
auto duration = assemblyEndTime - assemblyStartTime;
if (duration.count() < 0)
{
return std::chrono::milliseconds(0);
}
return std::chrono::duration_cast<std::chrono::milliseconds>(duration);
}
} // namespace stim_buff
} // namespace smo