Production: log durations and results for debugging

This commit is contained in:
2026-06-09 19:53:48 -04:00
parent ad88a5e1c8
commit 4a4c76b5ec
2 changed files with 46 additions and 7 deletions
@@ -29,6 +29,10 @@
namespace smo {
namespace stim_buff {
#ifndef SMO_PRINT_PCLOUD_ASSEMBLY_RESULTS
#define SMO_PRINT_PCLOUD_ASSEMBLY_RESULTS 1
#endif
inline LivoxProto1DllState& getLivoxProto1State() { return livoxProto1; }
struct DummyLivoxEthHeader
@@ -431,6 +435,29 @@ public:
callOriginalCb(success, loop);
}
void logAssemblyCycleResult(
const char *outcome, bool callbackSuccess) const
{
#if SMO_PRINT_PCLOUD_ASSEMBLY_RESULTS
size_t trackerAssembledCount = 0;
for (const auto &slotDesc : engine.assembledSlotsTracker)
{
if (slotDesc.assembled) {
++trackerAssembledCount;
}
}
std::cout << "AssembleFrameReq: " << outcome
<< " callbackSuccess=" << callbackSuccess
<< " timerFired=" << (timerFired.load() ? "yes" : "no")
<< " nSucceeded=" << loop.nSucceeded.load()
<< " nFailed=" << loop.nFailed.load()
<< " nTotal=" << loop.nTotal
<< " trackerAssembled=" << trackerAssembledCount
<< std::endl;
#endif
}
public:
void assembleFrameReq1_posted(
std::shared_ptr<AssembleFrameReq> context)
@@ -497,6 +524,8 @@ public:
{
context->engine.assemblyCycleComplete();
context->loop.setRemainingIterationsToFailure();
context->logAssemblyCycleResult(
"engine_cancelled_on_timer", false);
context->callOriginalCallback(false, context->loop);
return;
}
@@ -516,6 +545,8 @@ public:
{
context->engine.assemblyCycleComplete();
context->loop.setRemainingIterationsToFailure();
context->logAssemblyCycleResult(
"engine_cancelled_on_cqe", false);
context->callOriginalCallback(false, context->loop);
return;
}
@@ -566,6 +597,7 @@ public:
// Error: no slots succeeded - no data received successfully.
if (context->loop.nSucceeded.load() == 0)
{
context->logAssemblyCycleResult("no_slots_succeeded", false);
context->callOriginalCallback(false, context->loop);
return;
}
@@ -598,6 +630,7 @@ public:
<< ") > nTotal (" << context->loop.nTotal << ")\n";
}
context->logAssemblyCycleResult("all_slots_succeeded", true);
context->callOriginalCallback(true, context->loop);
return;
}
@@ -605,11 +638,12 @@ public:
if (context->loop.nSucceeded.load() < context->loop.nTotal)
{
// Success: some slots succeeded (less than total)
// Note: dummy fill for un-assembled slots will be implemented later
context->logAssemblyCycleResult("partial_slots_succeeded", true);
context->callOriginalCallback(true, context->loop);
return;
}
context->logAssemblyCycleResult("invalid_slot_count_state", false);
if (smoHooksPtr->OptionParser_getOptions().verbose)
{
std::cerr << __func__ << ": Invalid state: nSucceeded ("
@@ -28,6 +28,10 @@ extern const smo::stim_buff::SmoCallbacks* smoHooksPtr;
namespace smo {
namespace stim_buff {
#ifndef SMO_PRINT_PCLOUD_COLLATE_RESULTS
#define SMO_PRINT_PCLOUD_COLLATE_RESULTS 1
#endif
OpenClCollatingAndMeshingEngine::OpenClCollatingAndMeshingEngine(
PcloudStimulusProducer& parent_)
: parent(parent_),
@@ -1194,14 +1198,15 @@ OpenClCollatingAndMeshingEngine::compactCollateAndMeshFrameCReq(
}
(void)highIntensityCount;
#if 0
std::cout << __func__ << ": intensityRingBufferIndex="
#if SMO_PRINT_PCLOUD_COLLATE_RESULTS
std::cout << __func__ << ": collate done intensityRingBufferIndex="
<< (intensityStimFrame.has_value() ?
intensityStimFrame->get().ringBufferIndex : SIZE_MAX)
<< ", pointsPerDgram=" << pointsPerDgram
<< ", nSucceeded=" << nSucceeded
<< ", totalPoints=" << totalPoints
<< ", highIntensityCount=" << highIntensityCount << std::endl;
<< " pointsPerDgram=" << pointsPerDgram
<< " nSucceeded=" << nSucceeded
<< " totalPoints=" << totalPoints
<< " highIntensityCount=" << highIntensityCount
<< std::endl;
#endif
co_return success;