Lg1:pcloudStimProd: Add ambience trigger debugging
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#include <config.h>
|
||||
#include <opts.h>
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
#include <unistd.h>
|
||||
#include <iomanip>
|
||||
#include <cstddef>
|
||||
@@ -14,9 +15,32 @@
|
||||
#include "livoxGen1.h"
|
||||
#include "pcloudStimulusProducer.h"
|
||||
|
||||
#ifndef SMO_DEBUG_PCLOUD_AMBIENCE_INTRIN
|
||||
#define SMO_DEBUG_PCLOUD_AMBIENCE_INTRIN 0
|
||||
#endif
|
||||
|
||||
namespace smo {
|
||||
namespace stim_buff {
|
||||
|
||||
#if SMO_DEBUG_PCLOUD_AMBIENCE_INTRIN
|
||||
namespace {
|
||||
|
||||
char ambienceComparatorOpChar(ParamComparatorOp op)
|
||||
{
|
||||
switch (op)
|
||||
{
|
||||
case OP_CMP_GT:
|
||||
return '>';
|
||||
case OP_CMP_LT:
|
||||
return '<';
|
||||
}
|
||||
|
||||
return '?';
|
||||
}
|
||||
|
||||
} // namespace
|
||||
#endif
|
||||
|
||||
extern const SmoCallbacks* smoHooksPtr;
|
||||
|
||||
// OpenCL kernels are used to collate and produce our StimFrames.
|
||||
@@ -551,6 +575,28 @@ public:
|
||||
[[maybe_unused]] std::shared_ptr<ProduceFrameReq> context,
|
||||
bool success, StimulusFrame& /*stimulusFrame*/)
|
||||
{
|
||||
#if SMO_DEBUG_PCLOUD_AMBIENCE_INTRIN
|
||||
uint32_t logLightPassbandCount = 0;
|
||||
uint32_t logDarkPassbandCount = 0;
|
||||
bool logLightAmbience = false;
|
||||
bool logDarkAmbience = false;
|
||||
if (success)
|
||||
{
|
||||
if (context->lightAmbienceStimFrame.has_value())
|
||||
{
|
||||
logLightPassbandCount = *reinterpret_cast<const uint32_t*>(
|
||||
context->lightAmbienceStimFrame->get().slotDesc.vaddr);
|
||||
logLightAmbience = true;
|
||||
}
|
||||
if (context->darkAmbienceStimFrame.has_value())
|
||||
{
|
||||
logDarkPassbandCount = *reinterpret_cast<const uint32_t*>(
|
||||
context->darkAmbienceStimFrame->get().slotDesc.vaddr);
|
||||
logDarkAmbience = true;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// Release intensity frame if it was used
|
||||
if (context->intensityStimFrame.has_value()) {
|
||||
context->intensityStimFrame->get().lock.writeRelease();
|
||||
@@ -591,6 +637,77 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
#if SMO_DEBUG_PCLOUD_AMBIENCE_INTRIN
|
||||
if (logLightAmbience)
|
||||
{
|
||||
auto lightBuff =
|
||||
pcloudProducer.lightAmbienceStimulusBuffer.load(
|
||||
std::memory_order_acquire);
|
||||
if (lightBuff)
|
||||
{
|
||||
std::cerr << __func__ << ": pcloudLightAmbience "
|
||||
<< "passbandCount=" << logLightPassbandCount
|
||||
<< " (per-slot avg intensity "
|
||||
<< ambienceComparatorOpChar(
|
||||
lightBuff->passbandCountGtComparator.op)
|
||||
<< " " << lightBuff->passbandCountGtComparator.value
|
||||
<< ")";
|
||||
if (lightBuff->negtrinInterestConfig.has_value())
|
||||
{
|
||||
const auto& nc = *lightBuff->negtrinInterestConfig;
|
||||
std::cerr << " negtrinInterestThr=" << nc.threshold;
|
||||
if (nc.percentage != 0U)
|
||||
{
|
||||
std::cerr << " (from " << nc.percentage << "%)";
|
||||
}
|
||||
std::cerr << " meetsNegtrinInterest="
|
||||
<< (lightBuff->shouldTriggerNegtrinEvent(
|
||||
logLightPassbandCount)
|
||||
? "yes" : "no");
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << " negtrinInterest(n/a)";
|
||||
}
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
}
|
||||
if (logDarkAmbience)
|
||||
{
|
||||
auto darkBuff =
|
||||
pcloudProducer.darkAmbienceStimulusBuffer.load(
|
||||
std::memory_order_acquire);
|
||||
if (darkBuff)
|
||||
{
|
||||
std::cerr << __func__ << ": pcloudDarkAmbience "
|
||||
<< "passbandCount=" << logDarkPassbandCount
|
||||
<< " (per-slot avg intensity "
|
||||
<< ambienceComparatorOpChar(
|
||||
darkBuff->passbandCountLtComparator.op)
|
||||
<< " " << darkBuff->passbandCountLtComparator.value
|
||||
<< ")";
|
||||
if (darkBuff->postrinInterestConfig.has_value())
|
||||
{
|
||||
const auto& pc = *darkBuff->postrinInterestConfig;
|
||||
std::cerr << " postrinInterestThr=" << pc.threshold;
|
||||
if (pc.percentage != 0U)
|
||||
{
|
||||
std::cerr << " (from " << pc.percentage << "%)";
|
||||
}
|
||||
std::cerr << " meetsPostrinInterest="
|
||||
<< (darkBuff->shouldTriggerPostrinEvent(
|
||||
logDarkPassbandCount)
|
||||
? "yes" : "no");
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << " postrinInterest(n/a)";
|
||||
}
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
// Print execution durations
|
||||
auto assemblyDuration = pcloudProducer.ioUringAssemblyEngine.getAssemblyDuration();
|
||||
|
||||
Reference in New Issue
Block a user