artdaq  v3_08_00
BoardReaderCore.cc
1 
2 #include "artdaq/DAQdata/Globals.hh" // include these 2 first -
3 #define TRACE_NAME (app_name + "_BoardReaderCore").c_str()
4 
5 #include "artdaq-core/Data/Fragment.hh"
6 #include "artdaq-core/Utilities/ExceptionHandler.hh"
7 #include "artdaq/Application/BoardReaderCore.hh"
8 #include "artdaq/Application/TaskType.hh"
9 #include "artdaq/Generators/makeCommandableFragmentGenerator.hh"
10 
11 #include <pthread.h>
12 #include <sched.h>
13 #include <algorithm>
14 #include "canvas/Utilities/Exception.h"
15 #include "cetlib_except/exception.h"
16 
17 const std::string artdaq::BoardReaderCore::
18  FRAGMENTS_PROCESSED_STAT_KEY("BoardReaderCoreFragmentsProcessed");
19 const std::string artdaq::BoardReaderCore::
20  INPUT_WAIT_STAT_KEY("BoardReaderCoreInputWaitTime");
21 const std::string artdaq::BoardReaderCore::
22  BRSYNC_WAIT_STAT_KEY("BoardReaderCoreBRSyncWaitTime");
23 const std::string artdaq::BoardReaderCore::
24  OUTPUT_WAIT_STAT_KEY("BoardReaderCoreOutputWaitTime");
25 const std::string artdaq::BoardReaderCore::
26  FRAGMENTS_PER_READ_STAT_KEY("BoardReaderCoreFragmentsPerRead");
27 
28 std::unique_ptr<artdaq::DataSenderManager> artdaq::BoardReaderCore::sender_ptr_ = nullptr;
29 
31  : parent_application_(parent_application)
32  /*, local_group_comm_(local_group_comm)*/
33  , generator_ptr_(nullptr)
34  , run_id_(art::RunID::flushRun())
35  , fragment_count_(0)
36  , stop_requested_(false)
37  , pause_requested_(false)
38 {
39  TLOG(TLVL_DEBUG) << "Constructor";
45 }
46 
48 {
49  TLOG(TLVL_DEBUG) << "Destructor";
50 }
51 
52 bool artdaq::BoardReaderCore::initialize(fhicl::ParameterSet const& pset, uint64_t, uint64_t)
53 {
54  TLOG(TLVL_DEBUG) << "initialize method called with "
55  << "ParameterSet = \"" << pset.to_string() << "\".";
56 
57  // pull out the relevant parts of the ParameterSet
58  fhicl::ParameterSet daq_pset;
59  try
60  {
61  daq_pset = pset.get<fhicl::ParameterSet>("daq");
62  }
63  catch (...)
64  {
65  TLOG(TLVL_ERROR)
66  << "Unable to find the DAQ parameters in the initialization "
67  << "ParameterSet: \"" + pset.to_string() + "\".";
68  return false;
69  }
70  fhicl::ParameterSet fr_pset;
71  try
72  {
73  fr_pset = daq_pset.get<fhicl::ParameterSet>("fragment_receiver");
74  data_pset_ = fr_pset;
75  }
76  catch (...)
77  {
78  TLOG(TLVL_ERROR)
79  << "Unable to find the fragment_receiver parameters in the DAQ "
80  << "initialization ParameterSet: \"" + daq_pset.to_string() + "\".";
81  return false;
82  }
83 
84  // pull out the Metric part of the ParameterSet
85  fhicl::ParameterSet metric_pset;
86  try
87  {
88  metric_pset = daq_pset.get<fhicl::ParameterSet>("metrics");
89  }
90  catch (...)
91  {} // OK if there's no metrics table defined in the FHiCL
92 
93  if (metric_pset.is_empty())
94  {
95  TLOG(TLVL_INFO) << "No metric plugins appear to be defined";
96  }
97  try
98  {
99  metricMan->initialize(metric_pset, app_name);
100  }
101  catch (...)
102  {
103  ExceptionHandler(ExceptionHandlerRethrow::no,
104  "Error loading metrics in BoardReaderCore::initialize()");
105  }
106 
107  if (daq_pset.has_key("rank"))
108  {
109  if (my_rank >= 0 && daq_pset.get<int>("rank") != my_rank)
110  {
111  TLOG(TLVL_WARNING) << "BoardReader rank specified at startup is different than rank specified at configure! Using rank received at configure!";
112  }
113  my_rank = daq_pset.get<int>("rank");
114  }
115  if (my_rank == -1)
116  {
117  TLOG(TLVL_ERROR) << "BoardReader rank not specified at startup or in configuration! Aborting";
118  exit(1);
119  }
120 
121  // create the requested CommandableFragmentGenerator
122  std::string frag_gen_name = fr_pset.get<std::string>("generator", "");
123  if (frag_gen_name.length() == 0)
124  {
125  TLOG(TLVL_ERROR)
126  << "No fragment generator (parameter name = \"generator\") was "
127  << "specified in the fragment_receiver ParameterSet. The "
128  << "DAQ initialization PSet was \"" << daq_pset.to_string() << "\".";
129  return false;
130  }
131 
132  try
133  {
134  generator_ptr_ = artdaq::makeCommandableFragmentGenerator(frag_gen_name, fr_pset);
135  }
136  catch (...)
137  {
138  std::stringstream exception_string;
139  exception_string << "Exception thrown during initialization of fragment generator of type \""
140  << frag_gen_name << "\"";
141 
142  ExceptionHandler(ExceptionHandlerRethrow::no, exception_string.str());
143 
144  TLOG(TLVL_DEBUG) << "FHiCL parameter set used to initialize the fragment generator which threw an exception: " << fr_pset.to_string();
145 
146  return false;
147  }
148  metricMan->setPrefix(generator_ptr_->metricsReportingInstanceName());
149 
150  rt_priority_ = fr_pset.get<int>("rt_priority", 0);
151 
152  // fetch the monitoring parameters and create the MonitoredQuantity instances
153  statsHelper_.createCollectors(fr_pset, 100, 30.0, 60.0, FRAGMENTS_PROCESSED_STAT_KEY);
154 
155  // check if we should skip the sequence ID test...
156  skip_seqId_test_ = (generator_ptr_->fragmentIDs().size() > 1 || generator_ptr_->request_mode() != RequestMode::Ignored);
157 
158  verbose_ = fr_pset.get<bool>("verbose", true);
159 
160  return true;
161 }
162 
163 bool artdaq::BoardReaderCore::start(art::RunID id, uint64_t timeout, uint64_t timestamp)
164 {
165  TLOG((verbose_ ? TLVL_INFO : TLVL_DEBUG)) << "Starting run " << id.run();
166  stop_requested_.store(false);
167  pause_requested_.store(false);
168 
169  fragment_count_ = 0;
170  prev_seq_id_ = 0;
171  statsHelper_.resetStatistics();
172 
173  metricMan->do_start();
174  generator_ptr_->StartCmd(id.run(), timeout, timestamp);
175  run_id_ = id;
176 
177  TLOG((verbose_ ? TLVL_INFO : TLVL_DEBUG)) << "Completed the Start transition (Started run) for run " << run_id_.run()
178  << ", timeout = " << timeout << ", timestamp = " << timestamp;
179  return true;
180 }
181 
182 bool artdaq::BoardReaderCore::stop(uint64_t timeout, uint64_t timestamp)
183 {
184  TLOG((verbose_ ? TLVL_INFO : TLVL_DEBUG)) << "Stopping run " << run_id_.run() << " after " << fragment_count_ << " fragments.";
185  stop_requested_.store(true);
186 
187  TLOG(TLVL_DEBUG) << "Stopping CommandableFragmentGenerator BEGIN";
188  generator_ptr_->StopCmd(timeout, timestamp);
189  TLOG(TLVL_DEBUG) << "Stopping CommandableFragmentGenerator END";
190 
191  TLOG(TLVL_DEBUG) << "Stopping DataSenderManager";
192  if (sender_ptr_) sender_ptr_->StopSender();
193 
194  TLOG((verbose_ ? TLVL_INFO : TLVL_DEBUG)) << "Completed the Stop transition for run " << run_id_.run();
195  return true;
196 }
197 
198 bool artdaq::BoardReaderCore::pause(uint64_t timeout, uint64_t timestamp)
199 {
200  TLOG((verbose_ ? TLVL_INFO : TLVL_DEBUG)) << "Pausing run " << run_id_.run() << " after " << fragment_count_ << " fragments.";
201  pause_requested_.store(true);
202  generator_ptr_->PauseCmd(timeout, timestamp);
203  TLOG((verbose_ ? TLVL_INFO : TLVL_DEBUG)) << "Completed the Pause transition for run " << run_id_.run();
204  return true;
205 }
206 
207 bool artdaq::BoardReaderCore::resume(uint64_t timeout, uint64_t timestamp)
208 {
209  TLOG((verbose_ ? TLVL_INFO : TLVL_DEBUG)) << "Resuming run " << run_id_.run();
210  pause_requested_.store(false);
211  metricMan->do_start();
212  generator_ptr_->ResumeCmd(timeout, timestamp);
213  TLOG((verbose_ ? TLVL_INFO : TLVL_DEBUG)) << "Completed the Resume transition for run " << run_id_.run();
214  return true;
215 }
216 
218 {
219  TLOG((verbose_ ? TLVL_INFO : TLVL_DEBUG)) << "Starting Shutdown transition";
220  generator_ptr_->joinThreads(); // Cleanly shut down the CommandableFragmentGenerator
221  generator_ptr_.reset(nullptr);
222  metricMan->shutdown();
223  TLOG((verbose_ ? TLVL_INFO : TLVL_DEBUG)) << "Completed Shutdown transition";
224  return true;
225 }
226 
227 bool artdaq::BoardReaderCore::soft_initialize(fhicl::ParameterSet const& pset, uint64_t timeout, uint64_t timestamp)
228 {
229  TLOG(TLVL_DEBUG) << "soft_initialize method called with "
230  << "ParameterSet = \"" << pset.to_string()
231  << "\". Forwarding to initialize.";
232  return initialize(pset, timeout, timestamp);
233 }
234 
235 bool artdaq::BoardReaderCore::reinitialize(fhicl::ParameterSet const& pset, uint64_t timeout, uint64_t timestamp)
236 {
237  TLOG(TLVL_DEBUG) << "reinitialize method called with "
238  << "ParameterSet = \"" << pset.to_string()
239  << "\". Forwarding to initalize.";
240  return initialize(pset, timeout, timestamp);
241 }
242 
244 {
245  if (rt_priority_ > 0)
246  {
247 #pragma GCC diagnostic push
248 #pragma GCC diagnostic ignored "-Wmissing-field-initializers"
249  sched_param s_param = {};
250  s_param.sched_priority = rt_priority_;
251  if (pthread_setschedparam(pthread_self(), SCHED_RR, &s_param))
252  TLOG(TLVL_WARNING) << "setting realtime priority failed";
253 #pragma GCC diagnostic pop
254  }
255 
256  // try-catch block here?
257 
258  // how to turn RT PRI off?
259  if (rt_priority_ > 0)
260  {
261 #pragma GCC diagnostic push
262 #pragma GCC diagnostic ignored "-Wmissing-field-initializers"
263  sched_param s_param = {};
264  s_param.sched_priority = rt_priority_;
265  int status = pthread_setschedparam(pthread_self(), SCHED_RR, &s_param);
266  if (status != 0)
267  {
268  TLOG(TLVL_ERROR)
269  << "Failed to set realtime priority to " << rt_priority_
270  << ", return code = " << status;
271  }
272 #pragma GCC diagnostic pop
273  }
274 
275  TLOG(TLVL_DEBUG) << "Initializing DataSenderManager. my_rank=" << my_rank;
276  sender_ptr_.reset(new artdaq::DataSenderManager(data_pset_));
277 
278  TLOG(TLVL_DEBUG) << "Waiting for first fragment.";
279  artdaq::MonitoredQuantityStats::TIME_POINT_T startTime;
280  double delta_time;
281  artdaq::FragmentPtrs frags;
282  auto targetFragCount = generator_ptr_->fragmentIDs().size();
283 
284  bool active = true;
285 
286  while (active)
287  {
288  startTime = artdaq::MonitoredQuantity::getCurrentTime();
289 
290  TLOG(18) << "process_fragments getNext start";
291  active = generator_ptr_->getNext(frags);
292  TLOG(18) << "process_fragments getNext done (active=" << active << ")";
293  // 08-May-2015, KAB & JCF: if the generator getNext() method returns false
294  // (which indicates that the data flow has stopped) *and* the reason that
295  // it has stopped is because there was an exception that wasn't handled by
296  // the experiment-specific FragmentGenerator class, we move to the
297  // InRunError state so that external observers (e.g. RunControl or
298  // DAQInterface) can see that there was a problem.
299  if (!active && generator_ptr_ && generator_ptr_->exception())
300  {
301  parent_application_.in_run_failure();
302  }
303 
304  delta_time = artdaq::MonitoredQuantity::getCurrentTime() - startTime;
305  statsHelper_.addSample(INPUT_WAIT_STAT_KEY, delta_time);
306 
307  TLOG(16) << "process_fragments INPUT_WAIT=" << delta_time;
308 
309  if (!active) { break; }
310  statsHelper_.addSample(FRAGMENTS_PER_READ_STAT_KEY, frags.size());
311 
312  for (auto& fragPtr : frags)
313  {
314  if (!fragPtr.get())
315  {
316  TLOG(TLVL_WARNING) << "Encountered a bad fragment pointer in fragment " << fragment_count_ << ". "
317  << "This is most likely caused by a problem with the Fragment Generator!";
318  continue;
319  }
320  if (fragment_count_ == 0)
321  {
322  TLOG(TLVL_DEBUG) << "Received first Fragment from Fragment Generator, sequence ID " << fragPtr->sequenceID() << ", size = " << fragPtr->sizeBytes() << " bytes.";
323  }
324  artdaq::Fragment::sequence_id_t sequence_id = fragPtr->sequenceID();
325  SetMFIteration("Sequence ID " + std::to_string(sequence_id));
326  statsHelper_.addSample(FRAGMENTS_PROCESSED_STAT_KEY, fragPtr->size());
327 
328  /*if ((fragment_count_ % 250) == 0)
329  {
330  TLOG(TLVL_DEBUG)
331  << "Sending fragment " << fragment_count_
332  << " with sequence id " << sequence_id << ".";
333  }*/
334 
335  // check for continous sequence IDs
336  if (!skip_seqId_test_ && abs(static_cast<int64_t>(sequence_id) - static_cast<int64_t>(prev_seq_id_)) > 1)
337  {
338  TLOG(TLVL_WARNING)
339  << "Missing sequence IDs: current sequence ID = "
340  << sequence_id << ", previous sequence ID = "
341  << prev_seq_id_ << ".";
342  }
343  prev_seq_id_ = sequence_id;
344 
345  startTime = artdaq::MonitoredQuantity::getCurrentTime();
346  TLOG(17) << "process_fragments seq=" << sequence_id << " sendFragment start";
347  auto res = sender_ptr_->sendFragment(std::move(*fragPtr));
348  if (sender_ptr_->GetSentSequenceIDCount(sequence_id) == targetFragCount)
349  {
350  sender_ptr_->RemoveRoutingTableEntry(sequence_id);
351  }
352  TLOG(17) << "process_fragments seq=" << sequence_id << " sendFragment done (dest=" << res.first << ", sts=" << TransferInterface::CopyStatusToString(res.second) << ")";
353  ++fragment_count_;
354  statsHelper_.addSample(OUTPUT_WAIT_STAT_KEY,
355  artdaq::MonitoredQuantity::getCurrentTime() - startTime);
356 
357  bool readyToReport = statsHelper_.readyToReport();
358  if (readyToReport)
359  TLOG(TLVL_INFO) << buildStatisticsString_();
360 
361  // Turn on lvls (mem and/or slow) 3,13,14 to log every send.
362  TLOG(((fragment_count_ == 1) ? TLVL_DEBUG
363  : (((fragment_count_ % 250) == 0 || readyToReport) ? 13 : 14)))
364  << ((fragment_count_ == 1)
365  ? "Sent first Fragment"
366  : "Sending fragment " + std::to_string(fragment_count_))
367  << " with SeqID " << sequence_id << ".";
368  }
369  if (statsHelper_.statsRollingWindowHasMoved()) { sendMetrics_(); }
370  frags.clear();
371  }
372 
373  sender_ptr_.reset(nullptr);
374 
375  // 11-May-2015, KAB: call MetricManager::do_stop whenever we exit the
376  // processing fragments loop so that metrics correctly go to zero when
377  // there is no data flowing
378  metricMan->do_stop();
379 
380  TLOG(TLVL_DEBUG) << "process_fragments loop end";
381 }
382 
383 std::string artdaq::BoardReaderCore::report(std::string const& which) const
384 {
385  std::string resultString;
386 
387  // pass the request to the FragmentGenerator instance, if it's available
388  if (generator_ptr_.get() != 0 && which != "core")
389  {
390  resultString = generator_ptr_->ReportCmd(which);
391  if (resultString.length() > 0) { return resultString; }
392  }
393 
394  // handle the request at this level, if we can
395  // --> nothing here yet
396 
397  // if we haven't been able to come up with any report so far, say so
398  std::string tmpString = app_name + " run number = ";
399  tmpString.append(boost::lexical_cast<std::string>(run_id_.run()));
400 
401  tmpString.append(", Sent Fragment count = ");
402  tmpString.append(boost::lexical_cast<std::string>(fragment_count_));
403 
404  if (which != "" && which != "core")
405  {
406  tmpString.append(". Command=\"" + which + "\" is not currently supported.");
407  }
408  return tmpString;
409 }
410 
411 bool artdaq::BoardReaderCore::metaCommand(std::string const& command, std::string const& arg)
412 {
413  TLOG(TLVL_DEBUG) << "metaCommand method called with "
414  << "command = \"" << command << "\""
415  << ", arg = \"" << arg << "\""
416  << ".";
417 
418  if (generator_ptr_) return generator_ptr_->metaCommand(command, arg);
419 
420  return true;
421 }
422 
423 std::string artdaq::BoardReaderCore::buildStatisticsString_()
424 {
425  std::ostringstream oss;
426  oss << app_name << " statistics:" << std::endl;
427 
428  double fragmentCount = 1.0;
429  artdaq::MonitoredQuantityPtr mqPtr = artdaq::StatisticsCollection::getInstance().getMonitoredQuantity(FRAGMENTS_PROCESSED_STAT_KEY);
430  if (mqPtr.get() != 0)
431  {
432  artdaq::MonitoredQuantityStats stats;
433  mqPtr->getStats(stats);
434  oss << " Fragment statistics: "
435  << stats.recentSampleCount << " fragments received at "
436  << stats.recentSampleRate << " fragments/sec, effective data rate = "
437  << (stats.recentValueRate * sizeof(artdaq::RawDataType) / 1024.0 / 1024.0) << " MB/sec, monitor window = "
438  << stats.recentDuration << " sec, min::max event size = "
439  << (stats.recentValueMin * sizeof(artdaq::RawDataType) / 1024.0 / 1024.0)
440  << "::"
441  << (stats.recentValueMax * sizeof(artdaq::RawDataType) / 1024.0 / 1024.0)
442  << " MB" << std::endl;
443  fragmentCount = std::max(double(stats.recentSampleCount), 1.0);
444  oss << " Average times per fragment: ";
445  if (stats.recentSampleRate > 0.0)
446  {
447  oss << " elapsed time = "
448  << (1.0 / stats.recentSampleRate) << " sec";
449  }
450  }
451 
452  // 31-Dec-2014, KAB - Just a reminder that using "fragmentCount" in the
453  // denominator of the calculations below is important because the way that
454  // the accumulation of these statistics is done is not fragment-by-fragment
455  // but read-by-read (where each read can contain multiple fragments).
456  // 29-Aug-2016, KAB - BRSYNC_WAIT and OUTPUT_WAIT are now done fragment-by-
457  // fragment, but we'll leave the calculation the same. (The alternative
458  // would be to use recentValueAverage().)
459 
460  mqPtr = artdaq::StatisticsCollection::getInstance().getMonitoredQuantity(INPUT_WAIT_STAT_KEY);
461  if (mqPtr.get() != 0)
462  {
463  oss << ", input wait time = "
464  << (mqPtr->getRecentValueSum() / fragmentCount) << " sec";
465  }
466 
467  mqPtr = artdaq::StatisticsCollection::getInstance().getMonitoredQuantity(BRSYNC_WAIT_STAT_KEY);
468  if (mqPtr.get() != 0)
469  {
470  oss << ", BRsync wait time = "
471  << (mqPtr->getRecentValueSum() / fragmentCount) << " sec";
472  }
473 
474  mqPtr = artdaq::StatisticsCollection::getInstance().getMonitoredQuantity(OUTPUT_WAIT_STAT_KEY);
475  if (mqPtr.get() != 0)
476  {
477  oss << ", output wait time = "
478  << (mqPtr->getRecentValueSum() / fragmentCount) << " sec";
479  }
480 
481  oss << std::endl
482  << " Fragments per read: ";
483  mqPtr = artdaq::StatisticsCollection::getInstance().getMonitoredQuantity(FRAGMENTS_PER_READ_STAT_KEY);
484  if (mqPtr.get() != 0)
485  {
486  artdaq::MonitoredQuantityStats stats;
487  mqPtr->getStats(stats);
488  oss << "average = "
489  << stats.recentValueAverage
490  << ", min::max = "
491  << stats.recentValueMin
492  << "::"
493  << stats.recentValueMax;
494  }
495 
496  return oss.str();
497 }
498 
499 void artdaq::BoardReaderCore::sendMetrics_()
500 {
501  //TLOG(TLVL_DEBUG) << "Sending metrics " << __LINE__ ;
502  double fragmentCount = 1.0;
503  artdaq::MonitoredQuantityPtr mqPtr = artdaq::StatisticsCollection::getInstance().getMonitoredQuantity(FRAGMENTS_PROCESSED_STAT_KEY);
504  if (mqPtr.get() != 0)
505  {
506  artdaq::MonitoredQuantityStats stats;
507  mqPtr->getStats(stats);
508  fragmentCount = std::max(double(stats.recentSampleCount), 1.0);
509  metricMan->sendMetric("Fragment Count", static_cast<unsigned long>(stats.fullSampleCount), "fragments", 1, MetricMode::LastPoint);
510  metricMan->sendMetric("Fragment Rate", stats.recentSampleRate, "fragments/sec", 1, MetricMode::Average);
511  metricMan->sendMetric("Average Fragment Size", (stats.recentValueAverage * sizeof(artdaq::RawDataType)), "bytes/fragment", 2, MetricMode::Average);
512  metricMan->sendMetric("Data Rate", (stats.recentValueRate * sizeof(artdaq::RawDataType)), "bytes/sec", 2, MetricMode::Average);
513  }
514 
515  // 31-Dec-2014, KAB - Just a reminder that using "fragmentCount" in the
516  // denominator of the calculations below is important because the way that
517  // the accumulation of these statistics is done is not fragment-by-fragment
518  // but read-by-read (where each read can contain multiple fragments).
519  // 29-Aug-2016, KAB - BRSYNC_WAIT and OUTPUT_WAIT are now done fragment-by-
520  // fragment, but we'll leave the calculation the same. (The alternative
521  // would be to use recentValueAverage().)
522 
523  mqPtr = artdaq::StatisticsCollection::getInstance().getMonitoredQuantity(INPUT_WAIT_STAT_KEY);
524  if (mqPtr.get() != 0)
525  {
526  metricMan->sendMetric("Avg Input Wait Time", (mqPtr->getRecentValueSum() / fragmentCount), "seconds/fragment", 3, MetricMode::Average);
527  }
528 
529  mqPtr = artdaq::StatisticsCollection::getInstance().getMonitoredQuantity(BRSYNC_WAIT_STAT_KEY);
530  if (mqPtr.get() != 0)
531  {
532  metricMan->sendMetric("Avg BoardReader Sync Wait Time", (mqPtr->getRecentValueSum() / fragmentCount), "seconds/fragment", 3, MetricMode::Average);
533  }
534 
535  mqPtr = artdaq::StatisticsCollection::getInstance().getMonitoredQuantity(OUTPUT_WAIT_STAT_KEY);
536  if (mqPtr.get() != 0)
537  {
538  metricMan->sendMetric("Avg Output Wait Time", (mqPtr->getRecentValueSum() / fragmentCount), "seconds/fragment", 3, MetricMode::Average);
539  }
540 
541  mqPtr = artdaq::StatisticsCollection::getInstance().getMonitoredQuantity(FRAGMENTS_PER_READ_STAT_KEY);
542  if (mqPtr.get() != 0)
543  {
544  metricMan->sendMetric("Avg Frags Per Read", mqPtr->getRecentValueAverage(), "fragments/read", 4, MetricMode::Average);
545  }
546 }
void addMonitoredQuantityName(std::string const &statKey)
Add a MonitoredQuantity name to the list.
Commandable is the base class for all artdaq components which implement the artdaq state machine...
Definition: Commandable.hh:20
Sends Fragment objects using TransferInterface plugins. Uses Routing Tables if confgiured, otherwise will Round-Robin Fragments to the destinations.
bool initialize(fhicl::ParameterSet const &pset, uint64_t timeout, uint64_t timestamp)
Initialize the BoardReaderCore.
static const std::string FRAGMENTS_PROCESSED_STAT_KEY
Key for the Fragments Processed MonitoredQuantity.
bool reinitialize(fhicl::ParameterSet const &pset, uint64_t timeout, uint64_t timestamp)
Reinitialize the BoardReader. No-Op.
static const std::string INPUT_WAIT_STAT_KEY
Key for the Input Wait MonitoredQuantity.
bool stop(uint64_t timeout, uint64_t timestamp)
Stop the BoardReader, and the CommandableFragmentGenerator.
virtual ~BoardReaderCore()
BoardReaderCore Destructor.
static std::string CopyStatusToString(CopyStatus in)
Convert a CopyStatus variable to its string represenatation
BoardReaderCore(Commandable &parent_application)
BoardReaderCore Constructor.
std::unique_ptr< CommandableFragmentGenerator > makeCommandableFragmentGenerator(std::string const &generator_plugin_spec, fhicl::ParameterSet const &ps)
Load a CommandableFragmentGenerator plugin.
static const std::string BRSYNC_WAIT_STAT_KEY
Key for the Sync Wait MonitoredQuantity.
static const std::string FRAGMENTS_PER_READ_STAT_KEY
Key for the Fragments Per Read MonitoredQuantity.
static const std::string OUTPUT_WAIT_STAT_KEY
Key for the Output Wait MonitoredQuantity.
bool soft_initialize(fhicl::ParameterSet const &pset, uint64_t timeout, uint64_t timestamp)
Soft-Initialize the BoardReader. No-Op.
std::string report(std::string const &which) const
Send a report on a given run-time quantity.
void process_fragments()
Main working loop of the BoardReaderCore.
bool shutdown(uint64_t timeout)
Shutdown the BoardReader, and the CommandableFragmentGenerator.
bool start(art::RunID id, uint64_t timeout, uint64_t timestamp)
Start the BoardReader, and the CommandableFragmentGenerator.
bool resume(uint64_t timeout, uint64_t timestamp)
Resume the BoardReader, and the CommandableFragmentGenerator.
bool pause(uint64_t timeout, uint64_t timestamp)
Pause the BoardReader, and the CommandableFragmentGenerator.
bool metaCommand(std::string const &command, std::string const &arg)
Run a user-defined command on the CommandableFragmentGenerator.