lcls2
C++ API: public headers of xtcdata, psalg, psdaq and psana
Loading...
Searching...
No Matches
Pds::Eb::BatchManager Class Reference

Owns the page-aligned region in which batches are built and decides when a batch has expired. More...

#include <BatchManager.hh>

Public Member Functions

 BatchManager ()
 Construct with no region.
 
 ~BatchManager ()
 Free the region.
 
int initialize (size_t maxEntrySize, unsigned maxEntries, unsigned numBatches)
 Reallocate the region for numBatches batches of maxEntries entries of maxEntrySize bytes if that total size changed, and set the expiration mask from maxEntries.
 
void shutdown ()
 Zero the whole region; it is not freed.
 
void * fetch (unsigned idx) const
 Return the address of entry idx: the region start plus idx times the entry size.
 
void * batchRegion () const
 Return the start of the region.
 
size_t batchRegionSize () const
 Return the size of the region in bytes.
 
bool expired (uint64_t pid, uint64_t start) const
 Return true if pid and start differ in any bit above the low log2(maxEntries) bits, that is, if they lie in different batch periods.
 
void dump () const
 Print the region base, region size, maximum batch size and entry size to stderr.
 

Detailed Description

Owns the page-aligned region in which batches are built and decides when a batch has expired.

Constructor & Destructor Documentation

◆ BatchManager()

Pds::Eb::BatchManager::BatchManager ( )

Construct with no region.

◆ ~BatchManager()

Pds::Eb::BatchManager::~BatchManager ( )

Free the region.

Member Function Documentation

◆ batchRegion()

void * Pds::Eb::BatchManager::batchRegion ( ) const
inline

Return the start of the region.

◆ batchRegionSize()

size_t Pds::Eb::BatchManager::batchRegionSize ( ) const
inline

Return the size of the region in bytes.

◆ dump()

void Pds::Eb::BatchManager::dump ( ) const

Print the region base, region size, maximum batch size and entry size to stderr.

◆ expired()

bool Pds::Eb::BatchManager::expired ( uint64_t  pid,
uint64_t  start 
) const
inline

Return true if pid and start differ in any bit above the low log2(maxEntries) bits, that is, if they lie in different batch periods.

◆ fetch()

void * Pds::Eb::BatchManager::fetch ( unsigned  idx) const
inline

Return the address of entry idx: the region start plus idx times the entry size.

◆ initialize()

int Pds::Eb::BatchManager::initialize ( size_t  maxEntrySize,
unsigned  maxEntries,
unsigned  numBatches 
)

Reallocate the region for numBatches batches of maxEntries entries of maxEntrySize bytes if that total size changed, and set the expiration mask from maxEntries.

Returns 0, 1 if maxEntries is not a power of 2, or ENOMEM if allocation fails.

◆ shutdown()

void Pds::Eb::BatchManager::shutdown ( )

Zero the whole region; it is not freed.


The documentation for this class was generated from the following file: