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

Replays the datagrams of a list of xtc files, file after file, into a shared-memory monitor server (an XtcMonitorServer subclass defined in XtcRunSet.cc). More...

#include <XtcRunSet.hh>

Public Member Functions

 XtcRunSet ()
 Start with no paths, no server and no open file.
 
 ~XtcRunSet ()
 If connect() created a server, call its XtcMonitorServer::unlink(), which sets its terminate flag and closes and unlinks its message queues (the shared memory is not unlinked); the server object is not deleted.
 
void addSinglePath (std::string path)
 Append path to the file list (not sorted).
 
void addPathsFromDir (std::string dirPath, std::string matchString="")
 Add every entry of dirPath ("." if empty) whose name contains ".xtc" and whose path contains matchString (any path if empty); the new paths are sorted and appended.
 
void addPathsFromRunPrefix (std::string runPrefix)
 Split runPrefix at its last '/' into a directory and a name prefix and call addPathsFromDir(directory, prefix); without a '/' the current directory is searched.
 
void addPathsFromListFile (std::string listFile)
 Read whitespace-separated file names from listFile and append them, sorted.
 
void connect (char *partitionTag, unsigned sizeOfBuffers, int numberOfBuffers, unsigned nclients, int rate, bool verbose=false, bool veryverbose=false, bool interactive=false)
 On the first call only: store the flags, set the period to 1e9/rate ns (0, unthrottled, if rate <= 0), and create the monitor server for partitionTag with the given buffer sizes and client count.
 
void run ()
 Pass every datagram of the listed files, in order, to the server's events(); connect() must have been called first.
 
void wait ()
 Call wait() on the server created by connect().
 
void exit ()
 Call the server's XtcMonitorServer::unlink() (sets its terminate flag and closes and unlinks its message queues; the shared memory is not unlinked) and print "Unlinked/exited server".
 

Detailed Description

Replays the datagrams of a list of xtc files, file after file, into a shared-memory monitor server (an XtcMonitorServer subclass defined in XtcRunSet.cc).

Constructor & Destructor Documentation

◆ XtcRunSet()

XtcRunSet::XtcRunSet ( )

Start with no paths, no server and no open file.

◆ ~XtcRunSet()

XtcRunSet::~XtcRunSet ( )

If connect() created a server, call its XtcMonitorServer::unlink(), which sets its terminate flag and closes and unlinks its message queues (the shared memory is not unlinked); the server object is not deleted.

Member Function Documentation

◆ addPathsFromDir()

void XtcRunSet::addPathsFromDir ( std::string  dirPath,
std::string  matchString = "" 
)

Add every entry of dirPath ("." if empty) whose name contains ".xtc" and whose path contains matchString (any path if empty); the new paths are sorted and appended.

Prints the arguments and each added path; if the directory cannot be opened it calls perror() and returns.

◆ addPathsFromListFile()

void XtcRunSet::addPathsFromListFile ( std::string  listFile)

Read whitespace-separated file names from listFile and append them, sorted.

Prints the file name; if it cannot be opened it calls perror() and returns.

◆ addPathsFromRunPrefix()

void XtcRunSet::addPathsFromRunPrefix ( std::string  runPrefix)

Split runPrefix at its last '/' into a directory and a name prefix and call addPathsFromDir(directory, prefix); without a '/' the current directory is searched.

◆ addSinglePath()

void XtcRunSet::addSinglePath ( std::string  path)

Append path to the file list (not sorted).

◆ connect()

void XtcRunSet::connect ( char *  partitionTag,
unsigned  sizeOfBuffers,
int  numberOfBuffers,
unsigned  nclients,
int  rate,
bool  verbose = false,
bool  veryverbose = false,
bool  interactive = false 
)

On the first call only: store the flags, set the period to 1e9/rate ns (0, unthrottled, if rate <= 0), and create the monitor server for partitionTag with the given buffer sizes and client count.

Prints the rate and the time taken to open shared memory. The server runs in distribute(true) mode with 4 spare buffers; later calls do nothing.

◆ exit()

void XtcRunSet::exit ( )

Call the server's XtcMonitorServer::unlink() (sets its terminate flag and closes and unlinks its message queues; the shared memory is not unlinked) and print "Unlinked/exited server".

◆ run()

void XtcRunSet::run ( )

Pass every datagram of the listed files, in order, to the server's events(); connect() must have been called first.

When verbose, non-L1Accept transitions are printed and L1Accepts show an average rate; a nonzero period makes it sleep (or, if interactive, wait for a carriage return) to hold the rate. Returns when the files are used up or one fails to open; files are read with an XtcFileIterator of maximum datagram size 0x4000000.

◆ wait()

void XtcRunSet::wait ( )

Call wait() on the server created by connect().


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