diff --git a/stimBuffApis/livoxGen1/ioUringAssemblyEngine.cpp b/stimBuffApis/livoxGen1/ioUringAssemblyEngine.cpp index fb53bd7..1fa27c4 100644 --- a/stimBuffApis/livoxGen1/ioUringAssemblyEngine.cpp +++ b/stimBuffApis/livoxGen1/ioUringAssemblyEngine.cpp @@ -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 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 (" diff --git a/stimBuffApis/livoxGen1/openClCollatingAndMeshingEngine.cpp b/stimBuffApis/livoxGen1/openClCollatingAndMeshingEngine.cpp index 06e8cf8..4083725 100644 --- a/stimBuffApis/livoxGen1/openClCollatingAndMeshingEngine.cpp +++ b/stimBuffApis/livoxGen1/openClCollatingAndMeshingEngine.cpp @@ -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;