artdaq  v2_03_02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Pages
BoardReaderCore.hh
1 #ifndef artdaq_Application_MPI2_BoardReaderCore_hh
2 #define artdaq_Application_MPI2_BoardReaderCore_hh
3 
4 #include <string>
5 
6 #include "artdaq/Application/CommandableFragmentGenerator.hh"
7 #include "artdaq/Application/Commandable.hh"
8 #include "fhiclcpp/ParameterSet.h"
9 #include "canvas/Persistency/Provenance/RunID.h"
10 #include "artdaq/DAQrate/DataSenderManager.hh"
11 #include "artdaq/Application/StatisticsHelper.hh"
12 #include "artdaq-utilities/Plugins/MetricManager.hh"
13 
14 namespace artdaq
15 {
16  class BoardReaderCore;
17 }
18 
24 {
25 public:
26  static const std::string FRAGMENTS_PROCESSED_STAT_KEY;
27  static const std::string INPUT_WAIT_STAT_KEY;
28  static const std::string BRSYNC_WAIT_STAT_KEY;
29  static const std::string OUTPUT_WAIT_STAT_KEY;
30  static const std::string FRAGMENTS_PER_READ_STAT_KEY;
31 
38  BoardReaderCore(Commandable& parent_application, int rank,
39  std::string name);
40 
44  BoardReaderCore(BoardReaderCore const&) = delete;
45 
49  virtual ~BoardReaderCore();
50 
55  BoardReaderCore& operator=(BoardReaderCore const&) = delete;
56 
74  bool initialize(fhicl::ParameterSet const& pset, uint64_t, uint64_t);
75 
83  bool start(art::RunID id, uint64_t timeout, uint64_t timestamp);
84 
91  bool stop(uint64_t timeout, uint64_t timestamp);
92 
99  bool pause(uint64_t timeout, uint64_t timestamp);
100 
107  bool resume(uint64_t timeout, uint64_t timestamp);
108 
113  bool shutdown(uint64_t);
114 
120  bool soft_initialize(fhicl::ParameterSet const& pset, uint64_t, uint64_t);
121 
127  bool reinitialize(fhicl::ParameterSet const& pset, uint64_t, uint64_t);
128 
135  size_t process_fragments();
136 
145  std::string report(std::string const& which) const;
146 
151  static DataSenderManager* GetDataSenderManagerPtr() { return sender_ptr_.get(); }
152 private:
153  Commandable& parent_application_;
154  //MPI_Comm local_group_comm_;
155  std::unique_ptr<CommandableFragmentGenerator> generator_ptr_;
156  art::RunID run_id_;
157  std::string name_;
158 
159  fhicl::ParameterSet data_pset_;
160  int rt_priority_;
161  bool skip_seqId_test_;
162 
163  /* ELF 5/10/2017 Removing in favor of DataReceiverManager source suppression logic
164  int mpi_sync_fragment_interval_;
165  double mpi_sync_wait_threshold_fraction_;
166  int mpi_sync_wait_threshold_count_;
167  size_t mpi_sync_wait_interval_usec_;
168  int mpi_sync_wait_log_level_;
169  int mpi_sync_wait_log_interval_sec_;
170  */
171  static std::unique_ptr<artdaq::DataSenderManager> sender_ptr_;
172 
173  size_t fragment_count_;
174  artdaq::Fragment::sequence_id_t prev_seq_id_;
175  std::atomic<bool> stop_requested_;
176  std::atomic<bool> pause_requested_;
177 
178  // attributes and methods for statistics gathering & reporting
179  artdaq::StatisticsHelper statsHelper_;
180 
181  std::string buildStatisticsString_();
182 
183  artdaq::MetricManager metricMan_;
184 
185  void sendMetrics_();
186 };
187 
188 #endif /* artdaq_Application_MPI2_BoardReaderCore_hh */
This class manages MonitoredQuantity instances for the *Core classes.
BoardReaderCore(Commandable &parent_application, int rank, std::string name)
BoardReaderCore Constructor.
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.
static DataSenderManager * GetDataSenderManagerPtr()
Gets a handle to the DataSenderManager.
static const std::string FRAGMENTS_PROCESSED_STAT_KEY
Key for the Fragments Processed MonitoredQuantity.
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.
BoardReaderCore implements the state machine for the BoardReader artdaq application. It contains a CommandableFragmentGenerator, which generates Fragments which are then sent to a DataSenderManager by BoardReaderCore.
virtual ~BoardReaderCore()
BoardReaderCore Destructor.
bool reinitialize(fhicl::ParameterSet const &pset, uint64_t, uint64_t)
Reinitialize the BoardReader. No-Op.
bool soft_initialize(fhicl::ParameterSet const &pset, uint64_t, uint64_t)
Soft-Initialize the BoardReader. No-Op.
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 initialize(fhicl::ParameterSet const &pset, uint64_t, uint64_t)
Initialize the BoardReaderCore.
std::string report(std::string const &which) const
Send a report on a given run-time quantity.
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 shutdown(uint64_t)
Shutdown the BoardReader, and the CommandableFragmentGenerator.
size_t process_fragments()
Main working loop of the BoardReaderCore.
BoardReaderCore & operator=(BoardReaderCore const &)=delete
Copy Assignment Operator is deleted.