keerthitheja:
I have a local queue to which the buffer from Wait()/WaitFor() are enqueued. Now, I have two writer threads, which access the front of this local queue and the images are written to the disk (I am locking and unlocking the local queue before poping them out). So, now whenever, I save the image to disk, the buffer memory set by RegisteredFlowSetPool() is freed.
This works perfectly as long as the saving time is shorter than 1/fps. I.e. there are always buffers available.
The intention of FlowSetInfo is to give infos about size and alignment, i.e. memory stuff.
(We developed the Flows with external memory, like a GPU, in mind).
So not the number of “queued” buffers.
If you are using GigE you can access the Nodemap of the Datastream.
I will post a small snippet in the next post …
Or even simpler:
Number of Buffers in Pool = Number of Buffer - Numbers of Buffers you currently hold.
1 Like
I’m not entirely certain this is compatible with the AcquistionStack::GenTL, but maybe it helps.
void getStreamInfos(const Cvb::Stream& stream)
{
using S = Cvb::Driver::StreamInfo;
// basic success
aquired = getStatisticsInfo(stream, S::NumBuffersAcquired);
delivered = getStatisticsInfo(stream, S::NumBuffersDelivered);
// basic error
lost = getStatisticsInfo(stream, S::NumBuffersLost);
lostTransfer = getStatisticsInfo(stream, S::NumBuffersLostTransfer);
lostLocked = getStatisticsInfo(stream, S::NumBuffersLostLocked);
// usually gev issues
corruptArrival = getStatisticsInfo(stream, S::NumBuffersCorruptOnArrival);
corruptDelivery = getStatisticsInfo(stream, S::NumBuffersCorruptOnDelivery);
// advanced generic info
locked = getStatisticsInfo(stream, S::NumBuffersLocked);
pending = getStatisticsInfo(stream, S::NumBuffersPending);
beingFilled = getStatisticsInfo(stream, S::NumBuffersBeingFilled);
announced = getStatisticsInfo(stream, S::NumBuffersAnnounced);
queued = getStatisticsInfo(stream, S::NumBuffersQueued);
// gev package info
packages = getStatisticsInfo(stream, S::NumPacketsReceived);
resendPackages = getStatisticsInfo(stream, S::NumResends);
// err ... no clue
triggerLost = getStatisticsInfo(stream, S::NumTriggersLost);
}
inline uint64_t getStatisticsInfo(const Cvb::Stream& stream, Cvb::Driver::StreamInfo info)
{
try
{
return stream.Statistics<uint64_t>(info);
}
catch (std::exception e)
{
std::cerr << "failed to get info about (as number): " << static_cast<int>(info) << ". Reason: " << e.what() << std::endl;
}
catch (...)
{
std::cerr << "failed to get info about (as number): " << static_cast<int>(info) << ". Reason: catch(...)" << std::endl;
}
return ~uint64_t(0); // i.e. max value is error or not available
}
1 Like