Reads DMA buffers from the PGP driver in bulk and assembles them into PGPEvents (one buffer per lane).
More...
#include <DrpBase.hh>
Inherited by Drp::Pgp, Drp::Pgp, Drp::Pgp, Drp::Pgp, and Drp::Pgp.
|
| | PgpReader (const Parameters ¶, MemPool &pool, unsigned maxRetCnt, unsigned dmaFreeCnt) |
| | Size the bulk-read arrays for maxRetCnt buffers and the free-index batch for dmaFreeCnt buffers (aborting if the pool has fewer DMA buffers than dmaFreeCnt), set up poll() on the device file descriptor and reset the pool counters.
|
| |
| virtual | ~PgpReader () |
| | Call flush().
|
| |
| int32_t | read () |
| | Read up to maxRetCnt DMA buffers.
|
| |
| void | flush () |
| | Return the DMA indices queued for freeing, return every DMA buffer that can still be read without counting it, and free all pebble buffers in use.
|
| |
| const Pds::TimingHeader * | handle (Detector *det, unsigned current) |
| | Process DMA buffer current of the last read() for detector det: record it in the PGPEvent chosen by its event counter and, once all lanes have arrived, check the event (counter jumps, common readout group, readout groups of SlowUpdates) and allocate a transition buffer (non-L1Accept) and a pebble buffer index.
|
| |
| void | freeDma (PGPEvent *event) |
| | Queue the DMA buffers of all lanes of event for return to the driver (returned in batches of dmaFreeCnt) and clear the lane mask of the event.
|
| |
| virtual void | handleBrokenEvent (const PGPEvent &event) |
| | Hook called for events that are dropped; the default does nothing.
|
| |
| virtual void | resetEventCounter () |
| | Reset the last completed event counter to 0; handle() calls this at BeginRun.
|
| |
| uint64_t | dmaBytes () const |
| | Return the total number of DMA bytes handled.
|
| |
| uint64_t | dmaSize () const |
| | Return the size of the last DMA buffer handled.
|
| |
| int64_t | latency () const |
| | Return the last measured TimingHeader latency in microseconds, updated about every 92857 pulse IDs (10 Hz per the code comment).
|
| |
| uint64_t | nDmaErrors () const |
| | Return the number of DMA buffers that reported an error.
|
| |
| uint64_t | nNoComRoG () const |
| | Return the number of events dropped because the common readout group was missing.
|
| |
| uint64_t | nMissingRoGs () const |
| | Return the number of SlowUpdates dropped because readout groups in Parameters::rogMask were missing.
|
| |
| uint64_t | nTmgHdrError () const |
| | Return the number of timing headers with the error bit set.
|
| |
| uint64_t | nPgpJumps () const |
| | Return the number of event counter jumps detected.
|
| |
| uint64_t | nNoTrDgrams () const |
| | Return the number of events dropped because no transition buffer was available.
|
| |
| int64_t | nPgpInUser () const |
| | Return dmaGetRxBuffinUserCount() for the device of the pool.
|
| |
| int64_t | nPgpInHw () const |
| | Return dmaGetRxBuffinHwCount() for the device of the pool.
|
| |
| int64_t | nPgpInPreHw () const |
| | Return dmaGetRxBuffinPreHwQCount() for the device of the pool.
|
| |
| int64_t | nPgpInRx () const |
| | Return dmaGetRxBuffinSwQCount() for the device of the pool.
|
| |
| std::chrono::nanoseconds | age (const XtcData::TimeStamp &time) const |
| | Return the latency of timestamp time (Pds::Eb::latency()) in nanoseconds.
|
| |
Reads DMA buffers from the PGP driver in bulk and assembles them into PGPEvents (one buffer per lane).
It checks event counters, readout groups and buffer sanity, and allocates pebble and transition buffers for complete events.
◆ PgpReader()
| Drp::PgpReader::PgpReader |
( |
const Parameters & |
para, |
|
|
MemPool & |
pool, |
|
|
unsigned |
maxRetCnt, |
|
|
unsigned |
dmaFreeCnt |
|
) |
| |
Size the bulk-read arrays for maxRetCnt buffers and the free-index batch for dmaFreeCnt buffers (aborting if the pool has fewer DMA buffers than dmaFreeCnt), set up poll() on the device file descriptor and reset the pool counters.
◆ ~PgpReader()
| virtual Drp::PgpReader::~PgpReader |
( |
| ) |
|
|
virtual |
◆ age()
◆ dmaBytes()
| uint64_t Drp::PgpReader::dmaBytes |
( |
| ) |
const |
|
inline |
Return the total number of DMA bytes handled.
◆ dmaSize()
| uint64_t Drp::PgpReader::dmaSize |
( |
| ) |
const |
|
inline |
Return the size of the last DMA buffer handled.
◆ flush()
| void Drp::PgpReader::flush |
( |
| ) |
|
Return the DMA indices queued for freeing, return every DMA buffer that can still be read without counting it, and free all pebble buffers in use.
◆ freeDma()
| void Drp::PgpReader::freeDma |
( |
PGPEvent * |
event | ) |
|
Queue the DMA buffers of all lanes of event for return to the driver (returned in batches of dmaFreeCnt) and clear the lane mask of the event.
Thread-safe.
◆ handle()
Process DMA buffer current of the last read() for detector det: record it in the PGPEvent chosen by its event counter and, once all lanes have arrived, check the event (counter jumps, common readout group, readout groups of SlowUpdates) and allocate a transition buffer (non-L1Accept) and a pebble buffer index.
Returns the TimingHeader of a complete, accepted event, otherwise nullptr; aborts on a DMA overflow or a header with zero pulse ID, timestamp or env.
◆ handleBrokenEvent()
| virtual void Drp::PgpReader::handleBrokenEvent |
( |
const PGPEvent & |
event | ) |
|
|
inlinevirtual |
Hook called for events that are dropped; the default does nothing.
Reimplemented in Drp::Pgp.
◆ latency()
| int64_t Drp::PgpReader::latency |
( |
| ) |
const |
|
inline |
Return the last measured TimingHeader latency in microseconds, updated about every 92857 pulse IDs (10 Hz per the code comment).
◆ nDmaErrors()
| uint64_t Drp::PgpReader::nDmaErrors |
( |
| ) |
const |
|
inline |
Return the number of DMA buffers that reported an error.
◆ nMissingRoGs()
| uint64_t Drp::PgpReader::nMissingRoGs |
( |
| ) |
const |
|
inline |
Return the number of SlowUpdates dropped because readout groups in Parameters::rogMask were missing.
◆ nNoComRoG()
| uint64_t Drp::PgpReader::nNoComRoG |
( |
| ) |
const |
|
inline |
Return the number of events dropped because the common readout group was missing.
◆ nNoTrDgrams()
| uint64_t Drp::PgpReader::nNoTrDgrams |
( |
| ) |
const |
|
inline |
Return the number of events dropped because no transition buffer was available.
◆ nPgpInHw()
| int64_t Drp::PgpReader::nPgpInHw |
( |
| ) |
const |
|
inline |
◆ nPgpInPreHw()
| int64_t Drp::PgpReader::nPgpInPreHw |
( |
| ) |
const |
|
inline |
◆ nPgpInRx()
| int64_t Drp::PgpReader::nPgpInRx |
( |
| ) |
const |
|
inline |
◆ nPgpInUser()
| int64_t Drp::PgpReader::nPgpInUser |
( |
| ) |
const |
|
inline |
◆ nPgpJumps()
| uint64_t Drp::PgpReader::nPgpJumps |
( |
| ) |
const |
|
inline |
Return the number of event counter jumps detected.
◆ nTmgHdrError()
| uint64_t Drp::PgpReader::nTmgHdrError |
( |
| ) |
const |
|
inline |
Return the number of timing headers with the error bit set.
◆ read()
| int32_t Drp::PgpReader::read |
( |
| ) |
|
Read up to maxRetCnt DMA buffers.
If the poll timeout is non-zero (100 ms initially, later 1 ms), first wait in poll(); after a successful read the timeout becomes 0 (pure polling) when buffers arrive faster than one per millisecond, else 1 ms. After an empty read, sleep with exponential back-off up to 1024 us. Returns the readDma() result.
◆ resetEventCounter()
| virtual void Drp::PgpReader::resetEventCounter |
( |
| ) |
|
|
inlinevirtual |
Reset the last completed event counter to 0; handle() calls this at BeginRun.
Reimplemented in Drp::Pgp.
◆ dest
| std::vector<uint32_t> Drp::PgpReader::dest |
|
protected |
◆ dmaErrors
| std::vector<uint32_t> Drp::PgpReader::dmaErrors |
|
protected |
◆ dmaFlags
| std::vector<uint32_t> Drp::PgpReader::dmaFlags |
|
protected |
◆ dmaIndex
| std::vector<uint32_t> Drp::PgpReader::dmaIndex |
|
protected |
◆ dmaRet
| std::vector<int32_t> Drp::PgpReader::dmaRet |
|
protected |
◆ m_count
| unsigned Drp::PgpReader::m_count |
|
protected |
◆ m_dmaBytes
| uint64_t Drp::PgpReader::m_dmaBytes |
|
protected |
◆ m_dmaIndices
| std::vector<uint32_t> Drp::PgpReader::m_dmaIndices |
|
protected |
◆ m_dmaOverrun
| bool Drp::PgpReader::m_dmaOverrun |
|
protected |
◆ m_dmaSize
| uint64_t Drp::PgpReader::m_dmaSize |
|
protected |
◆ m_lastComplete
| uint32_t Drp::PgpReader::m_lastComplete |
|
protected |
◆ m_lastData
| uint32_t Drp::PgpReader::m_lastData[6] |
|
protected |
◆ m_lastTid
◆ m_latency
| int64_t Drp::PgpReader::m_latency |
|
protected |
◆ m_latPid
| uint64_t Drp::PgpReader::m_latPid |
|
protected |
◆ m_lock
| std::mutex Drp::PgpReader::m_lock |
|
protected |
◆ m_nDmaErrors
| uint64_t Drp::PgpReader::m_nDmaErrors |
|
protected |
◆ m_nMissingRoGs
| uint64_t Drp::PgpReader::m_nMissingRoGs |
|
protected |
◆ m_nNoComRoG
| uint64_t Drp::PgpReader::m_nNoComRoG |
|
protected |
◆ m_nNoTrDgrams
| uint64_t Drp::PgpReader::m_nNoTrDgrams |
|
protected |
◆ m_nPgpJumps
| uint64_t Drp::PgpReader::m_nPgpJumps |
|
protected |
◆ m_nTmgHdrError
| uint64_t Drp::PgpReader::m_nTmgHdrError |
|
protected |
◆ m_para
◆ m_pfd
| pollfd Drp::PgpReader::m_pfd |
|
protected |
◆ m_pool
◆ m_t0
◆ m_tmo
| int Drp::PgpReader::m_tmo |
|
protected |
◆ m_us
| unsigned Drp::PgpReader::m_us |
|
protected |
The documentation for this class was generated from the following file: