artdaq
v3_07_01
|
CommandableFragmentGenerator derived class for testing. More...
Public Member Functions | |
CommandableFragmentGeneratorTest (const fhicl::ParameterSet &ps) | |
CommandableFragmentGeneratorTest Constructor. | |
void | setFireCount (size_t count) |
Have getNext_ generate count fragments. More... | |
void | setHwFail () |
Set the hwFail flag. | |
void | setEnabledIds (uint64_t bitmask) |
Set the enabled IDs mask for the Fragment Generator. More... | |
void | setTimestamp (artdaq::Fragment::timestamp_t ts) |
Set the timestamp to be used for the next Fragment. More... | |
artdaq::Fragment::timestamp_t | getTimestamp () |
Get the timestamp that will be used for the next Fragment. More... | |
void | waitForFrags () |
Wait for all fragments generated to be read by the CommandableFragmentGenerator More... | |
![]() | |
CommandableFragmentGenerator (const fhicl::ParameterSet &ps) | |
CommandableFragmentGenerator Constructor. More... | |
virtual | ~CommandableFragmentGenerator () |
CommandableFragmentGenerator Destructor. More... | |
void | joinThreads () |
Join any data-taking threads. Should be called when destructing CommandableFragmentGenerator. More... | |
bool | getNext (FragmentPtrs &output) overridefinal |
getNext calls either applyRequests or getNext_ to get any data that is ready to be sent to the EventBuilders More... | |
void | applyRequestsIgnoredMode (artdaq::FragmentPtrs &frags) |
Create fragments using data buffer for request mode Ignored. Precondition: dataBufferMutex_ and request_mutex_ are locked More... | |
void | applyRequestsSingleMode (artdaq::FragmentPtrs &frags) |
Create fragments using data buffer for request mode Single. Precondition: dataBufferMutex_ and request_mutex_ are locked More... | |
void | applyRequestsBufferMode (artdaq::FragmentPtrs &frags) |
Create fragments using data buffer for request mode Buffer. Precondition: dataBufferMutex_ and request_mutex_ are locked More... | |
void | applyRequestsWindowMode (artdaq::FragmentPtrs &frags) |
Create fragments using data buffer for request mode Window. Precondition: dataBufferMutex_ and request_mutex_ are locked More... | |
void | applyRequestsWindowMode_CheckAndFillDataBuffer (artdaq::FragmentPtrs &frags, artdaq::Fragment::fragment_id_t id, artdaq::Fragment::sequence_id_t seq, artdaq::Fragment::timestamp_t ts) |
Copy data from the relevant data buffer that matches the given timestamp. More... | |
bool | applyRequests (FragmentPtrs &frags) |
See if any requests have been received, and add the corresponding data Fragment objects to the output list. More... | |
bool | sendEmptyFragment (FragmentPtrs &frags, size_t sequenceId, Fragment::fragment_id_t fragmentId, std::string desc) |
Send an EmptyFragmentType Fragment. More... | |
void | sendEmptyFragments (FragmentPtrs &frags, std::map< Fragment::sequence_id_t, Fragment::timestamp_t > &requests) |
This function is for Buffered and Single request modes, as they can only respond to one data request at a time If the request message seqID > ev_counter, simply send empties until they're equal. More... | |
void | checkSentWindows (Fragment::sequence_id_t seq) |
Check the windows_sent_ooo_ map for sequence IDs that may be removed. More... | |
void | startDataThread () |
Function that launches the data thread (getDataLoop()) | |
void | startMonitoringThread () |
Function that launches the monitoring thread (getMonitoringDataLoop()) | |
void | getDataLoop () |
When separate_data_thread is set to true, this loop repeatedly calls getNext_ and adds returned Fragment objects to the data buffer, blocking when the data buffer is full. | |
bool | waitForDataBufferReady (Fragment::fragment_id_t id) |
Wait for the data buffer to drain (dataBufferIsTooLarge returns false), periodically reporting status. More... | |
bool | dataBufferIsTooLarge (Fragment::fragment_id_t id) |
Test the configured constraints on the data buffer. More... | |
void | getDataBufferStats (Fragment::fragment_id_t id) |
Calculate the size of the dataBuffer and report appropriate metrics. More... | |
void | getDataBuffersStats () |
Calculate the size of all dataBuffers and report appropriate metrics. | |
void | checkDataBuffer (Fragment::fragment_id_t id) |
Perform data buffer pruning operations for the given buffer. If the RequestMode is Single, removes all but the latest Fragment from the data buffer. More... | |
void | checkDataBuffers () |
Perform data buffer pruning operations for all buffers. | |
std::map < Fragment::sequence_id_t, std::chrono::steady_clock::time_point > | GetSentWindowList (Fragment::fragment_id_t id) |
Get the map of Window-mode requests fulfilled by this Fragment Geneerator for the given Fragment ID. More... | |
void | getMonitoringDataLoop () |
This function regularly calls checkHWStatus_(), and sets the isHardwareOK flag accordingly. | |
std::vector < Fragment::fragment_id_t > | fragmentIDs () override |
Get the list of Fragment IDs handled by this CommandableFragmentGenerator. More... | |
size_t | ev_counter () const |
Get the current value of the event counter. More... | |
RequestMode | request_mode () const |
Get the current request mode of the CommandableFragmentGenerator More... | |
void | StartCmd (int run, uint64_t timeout, uint64_t timestamp) |
Start the CommandableFragmentGenerator. More... | |
void | StopCmd (uint64_t timeout, uint64_t timestamp) |
Stop the CommandableFragmentGenerator. More... | |
void | PauseCmd (uint64_t timeout, uint64_t timestamp) |
Pause the CommandableFragmentGenerator. More... | |
void | ResumeCmd (uint64_t timeout, uint64_t timestamp) |
Resume the CommandableFragmentGenerator. More... | |
std::string | ReportCmd (std::string const &which="") |
Get a report about a user-specified run-time quantity. More... | |
virtual std::string | metricsReportingInstanceName () const |
Get the name used when reporting metrics. More... | |
bool | exception () const |
Get the current value of the exception flag. More... | |
virtual bool | metaCommand (std::string const &command, std::string const &arg) |
The meta-command is used for implementing user-specific commands in a CommandableFragmentGenerator. More... | |
Protected Member Functions | |
bool | getNext_ (artdaq::FragmentPtrs &frags) override |
Generate data and return it to CommandableFragmentGenerator. More... | |
bool | checkHWStatus_ () override |
Returns whether the hwFail flag has not been set. More... | |
void | start () override |
Perform start actions. No-Op. | |
void | stopNoMutex () override |
Perform immediate stop actions. No-Op. | |
void | stop () override |
Perform stop actions. No-Op. | |
void | pause () override |
Perform pause actions. No-Op. | |
void | resume () override |
Perform resume actions. No-Op. | |
![]() | |
int | run_number () const |
Get the current Run number. More... | |
int | subrun_number () const |
Get the current Subrun number. More... | |
uint64_t | timeout () const |
Timeout of last command. More... | |
uint64_t | timestamp () const |
Timestamp of last command. More... | |
artdaq::Fragment::fragment_id_t | fragment_id () const |
Get the Fragment ID of this Fragment generator. More... | |
bool | should_stop () const |
Get the current value of the should_stop flag. More... | |
bool | check_stop () |
Routine used by applyRequests to make sure that all outstanding requests have been fulfilled before returning. More... | |
int | board_id () const |
Gets the current board_id. More... | |
size_t | ev_counter_inc (size_t step=1, bool force=false) |
Increment the event counter, if the current RequestMode allows it. More... | |
void | set_exception (bool exception) |
Control the exception flag. More... | |
void | metricsReportingInstanceName (std::string const &name) |
Sets the name for metrics reporting. More... | |
std::string | printMode_ () |
Return the string representation of the current RequestMode. More... | |
size_t | dataBufferFragmentCount_ () |
Get the total number of Fragments in all data buffers. More... | |
std::map < artdaq::Fragment::sequence_id_t, artdaq::Fragment::timestamp_t > | GetRequests () const |
Get the current requests being handled by this CommandableFragmentGenerator More... | |
std::pair < artdaq::Fragment::sequence_id_t, artdaq::Fragment::timestamp_t > | GetNextRequest () const |
Get the next request (i.e. the request with the lowest sequence ID) to be handled by this CommandableFragmentGenerator More... | |
virtual bool | getNext_ (FragmentPtrs &output)=0 |
Obtain the next group of Fragments, if any are available. Return false if readout cannot continue, if we are 'stopped', or if we are not running in state-machine mode. Note that getNext_() must return n of each fragmentID declared by fragmentIDs_(). More... | |
virtual void | pauseNoMutex () |
On call to PauseCmd, pauseNoMutex() is called prior to PauseCmd acquiring the mutex More... | |
virtual std::string | report () |
Let's say that the contract with the report() functions is that they return a non-empty string if they have something useful to report, but if they don't know how to handle a given request, they simply return an empty string and the ReportCmd() takes care of saying "the xyz command is not currently supported". For backward compatibility, we keep the report function that takes no arguments and add one that takes a "which" argument. In the ReportCmd function, we'll call the more specific one first. More... | |
virtual std::string | reportSpecific (std::string const &what) |
Report the status of a specific quantity More... | |
Additional Inherited Members | |
![]() | |
using | Parameters = fhicl::WrappedTable< Config > |
Used for ParameterSet validation (if desired) | |
![]() | |
std::mutex | mutex_ |
Mutex used to ensure that multiple transition commands do not run at the same time. | |
CommandableFragmentGenerator derived class for testing.
Definition at line 20 of file CommandableFragmentGenerator_t.cc.
|
inlineoverrideprotectedvirtual |
Returns whether the hwFail flag has not been set.
Reimplemented from artdaq::CommandableFragmentGenerator.
Definition at line 44 of file CommandableFragmentGenerator_t.cc.
|
overrideprotected |
Generate data and return it to CommandableFragmentGenerator.
frags | FragmentPtrs list that new Fragments should be added to |
CommandableFragmentGeneratorTest merely default-constructs Fragments, emplacing them on the frags list.
Definition at line 134 of file CommandableFragmentGenerator_t.cc.
|
inline |
Get the timestamp that will be used for the next Fragment.
Definition at line 102 of file CommandableFragmentGenerator_t.cc.
|
inline |
Set the enabled IDs mask for the Fragment Generator.
bitmask | Bitmask of enabled IDs for the Fragment Generator |
For testing, this bitmask allows a configured Fragment ID to not be generated by a given call to setFireCount. This is used to create asymmetric response from the Fragment generator in the _MultipleIDs test cases
Definition at line 90 of file CommandableFragmentGenerator_t.cc.
|
inline |
Have getNext_ generate count fragments.
count | Number of fragments to generate |
Definition at line 76 of file CommandableFragmentGenerator_t.cc.
|
inline |
Set the timestamp to be used for the next Fragment.
ts | Timestamp to be used for the next Fragment |
Definition at line 96 of file CommandableFragmentGenerator_t.cc.
|
inline |
Wait for all fragments generated to be read by the CommandableFragmentGenerator
Definition at line 107 of file CommandableFragmentGenerator_t.cc.