DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
dunedaq::snbmodules::SNBRequestHandlerModel< ReadoutType, LatencyBufferType > Class Template Reference

#include <SNBRequestHandlerModel.hpp>

Inheritance diagram for dunedaq::snbmodules::SNBRequestHandlerModel< ReadoutType, LatencyBufferType >:
[legend]
Collaboration diagram for dunedaq::snbmodules::SNBRequestHandlerModel< ReadoutType, LatencyBufferType >:
[legend]

Classes

struct  RequestElement
 

Public Types

using RDT = ReadoutType
 
using LBT = LatencyBufferType
 
using RequestResult
 
using ResultCode
 
- Public Types inherited from dunedaq::opmonlib::MonitorableObject
using NodePtr = std::weak_ptr<MonitorableObject>
 
using NewNodePtr = std::shared_ptr<MonitorableObject>
 
using ElementId = std::string
 

Public Member Functions

 SNBRequestHandlerModel (std::shared_ptr< LatencyBufferType > &latency_buffer, std::unique_ptr< datahandlinglibs::FrameErrorRegistry > &error_registry)
 
void conf (const dunedaq::appmodel::DataHandlerModule *)
 
void scrap (const appfwk::DAQModule::CommandData_t &) override
 
void start (const appfwk::DAQModule::CommandData_t &)
 
void stop (const appfwk::DAQModule::CommandData_t &)
 
void record (const appfwk::DAQModule::CommandData_t &args) override
 
void cleanup_check () override
 Check if cleanup is necessary and execute it if necessary.
 
virtual void periodic_data_transmission () override
 Periodic data transmission - relevant for trigger in particular.
 
void issue_request (dfmessages::DataRequest datarequest, bool is_retry=false) override
 Issue a data request to the request handler.
 
virtual dunedaq::daqdataformats::timestamp_t get_cutoff_timestamp ()
 
virtual bool supports_cutoff_timestamp ()
 
void reset_oldest_time ()
 
std::uint64_t get_oldest_time () override
 Get oldest timestamp in the buffer.
 
- Public Member Functions inherited from dunedaq::datahandlinglibs::RequestHandlerConcept< ReadoutType, LatencyBufferType >
 RequestHandlerConcept ()
 
virtual ~RequestHandlerConcept ()
 
 RequestHandlerConcept (const RequestHandlerConcept &)=delete
 RequestHandlerConcept is not copy-constructible.
 
RequestHandlerConceptoperator= (const RequestHandlerConcept &)=delete
 RequestHandlerConcept is not copy-assginable.
 
 RequestHandlerConcept (RequestHandlerConcept &&)=delete
 RequestHandlerConcept is not move-constructible.
 
RequestHandlerConceptoperator= (RequestHandlerConcept &&)=delete
 RequestHandlerConcept is not move-assignable.
 
- Public Member Functions inherited from dunedaq::opmonlib::MonitorableObject
 MonitorableObject (const MonitorableObject &)=delete
 
MonitorableObjectoperator= (const MonitorableObject &)=delete
 
 MonitorableObject (MonitorableObject &&)=delete
 
MonitorableObjectoperator= (MonitorableObject &&)=delete
 
virtual ~MonitorableObject ()=default
 
auto get_opmon_id () const noexcept
 
auto get_opmon_level () const noexcept
 

Protected Member Functions

daqdataformats::FragmentHeader create_fragment_header (const dfmessages::DataRequest &dr)
 
std::unique_ptr< daqdataformats::Fragmentcreate_empty_fragment (const dfmessages::DataRequest &dr)
 
void dump_to_buffer (const void *data, std::size_t size, void *buffer, uint32_t buffer_pos, const std::size_t &buffer_size)
 
void periodic_cleanups ()
 
void periodic_data_transmissions ()
 
void cleanup ()
 
void check_waiting_requests ()
 
std::vector< std::pair< void *, size_t > > get_fragment_pieces (uint64_t start_win_ts, uint64_t end_win_ts, RequestResult &rres)
 
RequestResult data_request (dfmessages::DataRequest dr) override
 
virtual void generate_opmon_data () override
 
- Protected Member Functions inherited from dunedaq::datahandlinglibs::RequestHandlerConcept< ReadoutType, LatencyBufferType >
const std::string & resultCodeAsString (ResultCode rc)
 
- Protected Member Functions inherited from dunedaq::opmonlib::MonitorableObject
 MonitorableObject ()=default
 
void register_node (ElementId name, NewNodePtr)
 
void publish (google::protobuf::Message &&, CustomOrigin &&co={}, OpMonLevel l=to_level(EntryOpMonLevel::kDefault)) const noexcept
 

Protected Attributes

std::shared_ptr< LatencyBufferType > & m_latency_buffer
 
datahandlinglibs::BufferedFileWriter m_buffered_writer
 
utilities::ReusableThread m_recording_thread
 
utilities::ReusableThread m_cleanup_thread
 
utilities::ReusableThread m_periodic_transmission_thread
 
std::map< dfmessages::DataRequest, int > m_request_counter
 
std::mutex m_cv_mutex
 
std::condition_variable m_cv
 
std::atomic< boolm_cleanup_requested = false
 
std::atomic< int > m_requests_running = 0
 
std::vector< RequestElementm_waiting_requests
 
std::mutex m_waiting_requests_lock
 
std::unique_ptr< boost::asio::thread_pool > m_request_handler_thread_pool
 
size_t m_num_request_handling_threads = 0
 
std::unique_ptr< datahandlinglibs::FrameErrorRegistry > & m_error_registry
 
std::chrono::time_point< std::chrono::high_resolution_clock > m_t0
 
std::atomic< boolm_run_marker = false
 
std::thread m_waiting_queue_thread
 
std::atomic< boolm_recording = false
 
std::atomic< uint64_t > m_next_timestamp_to_record = std::numeric_limits<uint64_t>::max()
 
bool m_configured
 
std::mutex m_pop_list_mutex
 
std::set< uint64_t > m_pop_list
 
size_t m_buffer_capacity
 
daqdataformats::SourceID m_sourceid
 
uint16_t m_detid
 
std::string m_output_file
 
size_t m_stream_buffer_size = 0
 
bool m_recording_configured = false
 
bool m_warn_on_timeout = true
 
bool m_warn_about_empty_buffer = true
 
uint32_t m_periodic_data_transmission_ms = 0
 
std::vector< std::string > m_frag_out_conn_ids
 
std::atomic< int > m_pop_counter
 
std::atomic< int > m_num_buffer_cleanups { 0 }
 
std::atomic< int > m_pop_reqs
 
std::atomic< int > m_pops_count
 
std::atomic< int > m_occupancy
 
std::atomic< int > m_num_requests_found { 0 }
 
std::atomic< int > m_num_requests_bad { 0 }
 
std::atomic< int > m_num_requests_old_window { 0 }
 
std::atomic< int > m_num_requests_delayed { 0 }
 
std::atomic< int > m_num_requests_uncategorized { 0 }
 
std::atomic< int > m_num_requests_timed_out { 0 }
 
std::atomic< int > m_handled_requests { 0 }
 
std::atomic< int > m_response_time_acc { 0 }
 
std::atomic< int > m_response_time_min { std::numeric_limits<int>::max() }
 
std::atomic< int > m_response_time_max { 0 }
 
std::atomic< int > m_payloads_written { 0 }
 
std::atomic< int > m_bytes_written { 0 }
 
std::atomic< uint64_t > m_num_periodic_sent { 0 }
 
std::atomic< uint64_t > m_num_periodic_send_failed { 0 }
 
std::atomic< uint64_t > m_oldest_timestamp { 0 }
 
int m_fragment_send_timeout_ms
 
- Protected Attributes inherited from dunedaq::datahandlinglibs::RequestHandlerConcept< ReadoutType, LatencyBufferType >
std::map< ResultCode, std::string > ResultCodeStrings
 

Private Attributes

int m_request_timeout_ms
 

Additional Inherited Members

- Static Public Member Functions inherited from dunedaq::opmonlib::MonitorableObject
static bool publishable_metric (OpMonLevel entry, OpMonLevel system) noexcept
 
- Protected Types inherited from dunedaq::datahandlinglibs::RequestHandlerConcept< ReadoutType, LatencyBufferType >
enum  ResultCode {
  kFound = 0 , kNotFound , kTooOld , kNotYet ,
  kPartial , kPartiallyOld , kCleanup , kUnknown
}
 

Detailed Description

template<class ReadoutType, class LatencyBufferType>
class dunedaq::snbmodules::SNBRequestHandlerModel< ReadoutType, LatencyBufferType >

Definition at line 80 of file SNBRequestHandlerModel.hpp.

Member Typedef Documentation

◆ LBT

template<class ReadoutType , class LatencyBufferType >
using dunedaq::snbmodules::SNBRequestHandlerModel< ReadoutType, LatencyBufferType >::LBT = LatencyBufferType

Definition at line 85 of file SNBRequestHandlerModel.hpp.

◆ RDT

template<class ReadoutType , class LatencyBufferType >
using dunedaq::snbmodules::SNBRequestHandlerModel< ReadoutType, LatencyBufferType >::RDT = ReadoutType

Definition at line 84 of file SNBRequestHandlerModel.hpp.

◆ RequestResult

template<class ReadoutType , class LatencyBufferType >
using dunedaq::snbmodules::SNBRequestHandlerModel< ReadoutType, LatencyBufferType >::RequestResult

◆ ResultCode

template<class ReadoutType , class LatencyBufferType >
using dunedaq::snbmodules::SNBRequestHandlerModel< ReadoutType, LatencyBufferType >::ResultCode

Constructor & Destructor Documentation

◆ SNBRequestHandlerModel()

template<class ReadoutType , class LatencyBufferType >
dunedaq::snbmodules::SNBRequestHandlerModel< ReadoutType, LatencyBufferType >::SNBRequestHandlerModel ( std::shared_ptr< LatencyBufferType > & latency_buffer,
std::unique_ptr< datahandlinglibs::FrameErrorRegistry > & error_registry )
inlineexplicit

Definition at line 93 of file SNBRequestHandlerModel.hpp.

95 : m_latency_buffer(latency_buffer)
100 , m_error_registry(error_registry)
102 , m_pop_counter{ 0 }
103 , m_pop_reqs(0)
104 , m_pops_count(0)
105 , m_occupancy(0)
106 //, m_response_time_log()
107 //, m_response_time_log_lock()
108 {
109 TLOG_DEBUG(TLVL_WORK_STEPS) << "SNBRequestHandlerModel created...";
110 }
std::unique_ptr< datahandlinglibs::FrameErrorRegistry > & m_error_registry
std::shared_ptr< LatencyBufferType > & m_latency_buffer
#define TLOG_DEBUG(lvl,...)
Definition Logging.hpp:112

Member Function Documentation

◆ check_waiting_requests()

template<class RDT , class LBT >
void dunedaq::snbmodules::SNBRequestHandlerModel< RDT, LBT >::check_waiting_requests ( )
protected

Definition at line 325 of file SNBRequestHandlerModel.hxx.

326{
327 // At run stop, we wait until all waiting requests have either:
328 //
329 // 1. been serviced because an item past the end of the window arrived in the buffer
330 // 2. timed out by going past m_request_timeout_ms, and returned a partial fragment
331 while (m_run_marker.load()) {
332 if (m_waiting_requests.size() > 0) {
333
334 std::lock_guard<std::mutex> lock_guard(m_waiting_requests_lock);
335
336 auto last_frame = m_latency_buffer->back(); // NOLINT
337 uint64_t newest_ts = last_frame == nullptr ? std::numeric_limits<uint64_t>::min() // NOLINT(build/unsigned)
338 : last_frame->get_timestamp();
339
340 for (auto iter = m_waiting_requests.begin(); iter != m_waiting_requests.end();) {
341 if ((*iter).request.request_information.window_end <= newest_ts) {
342 issue_request((*iter).request, true);
343 iter = m_waiting_requests.erase(iter);
344 } else if (std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::high_resolution_clock::now() -
345 (*iter).start_time)
346 .count() >= m_request_timeout_ms) {
347 issue_request((*iter).request, true);
348 if (m_warn_on_timeout) {
349 ers::warning(
350 dunedaq::datahandlinglibs::VerboseRequestTimedOut(ERS_HERE,
351 m_sourceid,
352 (*iter).request.trigger_number,
353 (*iter).request.sequence_number,
354 (*iter).request.run_number,
355 (*iter).request.request_information.window_begin,
356 (*iter).request.request_information.window_end,
357 (*iter).request.data_destination));
358 }
361 iter = m_waiting_requests.erase(iter);
362 } else {
363 ++iter;
364 }
365 }
366 }
367 std::this_thread::sleep_for(std::chrono::milliseconds(1));
368 }
369}

◆ cleanup()

template<class RDT , class LBT >
void dunedaq::snbmodules::SNBRequestHandlerModel< RDT, LBT >::cleanup ( )
protectedvirtual

Implements dunedaq::datahandlinglibs::RequestHandlerConcept< ReadoutType, LatencyBufferType >.

Definition at line 297 of file SNBRequestHandlerModel.hxx.

298{
299 ++m_pop_reqs;
300 unsigned popped = 0;
301 {
302 std::lock_guard<std::mutex> lk(m_pop_list_mutex);
303 while (!m_pop_list.empty() && m_latency_buffer->occupancy() > 1) {
304 auto ts = m_latency_buffer->front()->get_timestamp();
305 if (m_pop_list.count(ts)) {
306 m_latency_buffer->pop(1);
307 popped++;
308 m_pop_list.erase(ts);
309 } else {
310 break;
311 }
312 }
313 }
314 m_occupancy = m_latency_buffer->occupancy();
315 m_pops_count += popped;
316 m_error_registry->remove_errors_until(m_latency_buffer->front()->get_timestamp());
317
318 // Update hte oldest timestamp monitorable
319 m_oldest_timestamp = m_latency_buffer->front()->get_timestamp();
321}

◆ cleanup_check()

template<class RDT , class LBT >
void dunedaq::snbmodules::SNBRequestHandlerModel< RDT, LBT >::cleanup_check ( )
overridevirtual

Check if cleanup is necessary and execute it if necessary.

Implements dunedaq::datahandlinglibs::RequestHandlerConcept< ReadoutType, LatencyBufferType >.

Definition at line 141 of file SNBRequestHandlerModel.hxx.

142{
143 std::unique_lock<std::mutex> lock(m_cv_mutex);
144 if (!m_pop_list.empty() && !m_cleanup_requested.exchange(true)) {
145 m_cv.wait(lock, [&] { return m_requests_running == 0; });
146 cleanup();
147 m_cleanup_requested = false;
148 m_cv.notify_all();
149 }
150}

◆ conf()

template<class RDT , class LBT >
void dunedaq::snbmodules::SNBRequestHandlerModel< RDT, LBT >::conf ( const dunedaq::appmodel::DataHandlerModule * conf)
virtual

Implements dunedaq::datahandlinglibs::RequestHandlerConcept< ReadoutType, LatencyBufferType >.

Definition at line 8 of file SNBRequestHandlerModel.hxx.

9{
10
11 auto reqh_conf = conf->get_module_configuration()->get_request_handler();
12 m_sourceid.id = conf->get_source_id();
13 m_sourceid.subsystem = RDT::subsystem;
14 m_detid = conf->get_detector_id();
15
16 m_buffer_capacity = conf->get_module_configuration()->get_latency_buffer()->get_size();
17 m_num_request_handling_threads = reqh_conf->get_handler_threads();
18 m_request_timeout_ms = reqh_conf->get_request_timeout();
19
20 for (auto output : conf->get_outputs()) {
21 if (output->get_data_type() == "Fragment") {
22 m_fragment_send_timeout_ms = output->get_send_timeout_ms();
23 // 19-Dec-2024, KAB: store the names/IDs of the Fragment output connections so that
24 // we can confirm that they are ready for sending at 'start' time.
25 m_frag_out_conn_ids.push_back(output->UID());
26 }
27 }
28
29 if (m_recording_configured == false) {
30 auto dr = reqh_conf->get_data_recorder();
31 if (dr != nullptr) {
32 m_output_file = dr->get_output_file();
33 if (remove(m_output_file.c_str()) == 0) {
34 TLOG_DEBUG(TLVL_WORK_STEPS) << "Removed existing output file from previous run: " << m_output_file << std::endl;
35 }
36 m_stream_buffer_size = dr->get_streaming_buffer_size();
38 m_output_file, m_stream_buffer_size, dr->get_compression_algorithm(), dr->get_use_o_direct());
40 }
41 }
42
43 m_warn_on_timeout = reqh_conf->get_warn_on_timeout();
44 m_warn_about_empty_buffer = reqh_conf->get_warn_on_empty_buffer();
45 m_periodic_data_transmission_ms = reqh_conf->get_periodic_data_transmission_ms();
46
50
51 std::ostringstream oss;
52 oss << "RequestHandler configured. ";
53 TLOG_DEBUG(TLVL_WORK_STEPS) << oss.str();
54}
void open(std::string filename, size_t buffer_size, std::string compression_algorithm="None", bool use_o_direct=true)
void conf(const dunedaq::appmodel::DataHandlerModule *)
datahandlinglibs::BufferedFileWriter m_buffered_writer
void set_name(const std::string &name, int tid)
void remove(QString const &db, QString const &fn)
Subsystem subsystem
The general subsystem of the source of the data.
Definition SourceID.hpp:69
ID_t id
Unique identifier of the source of the data.
Definition SourceID.hpp:74

◆ create_empty_fragment()

template<class RDT , class LBT >
std::unique_ptr< daqdataformats::Fragment > dunedaq::snbmodules::SNBRequestHandlerModel< RDT, LBT >::create_empty_fragment ( const dfmessages::DataRequest & dr)
protected

Definition at line 260 of file SNBRequestHandlerModel.hxx.

261{
262 auto frag_header = create_fragment_header(dr);
263 frag_header.error_bits |= (0x1 << static_cast<size_t>(daqdataformats::FragmentErrorBits::kDataNotFound));
264 auto fragment = std::make_unique<daqdataformats::Fragment>(std::vector<std::pair<void*, size_t>>());
265 fragment->set_header_fields(frag_header);
266 return fragment;
267}
daqdataformats::FragmentHeader create_fragment_header(const dfmessages::DataRequest &dr)
@ kDataNotFound
The requested data was not found at all, so the fragment is empty.

◆ create_fragment_header()

template<class ReadoutType , class LatencyBufferType >
daqdataformats::FragmentHeader dunedaq::snbmodules::SNBRequestHandlerModel< ReadoutType, LatencyBufferType >::create_fragment_header ( const dfmessages::DataRequest & dr)
inlineprotected

Definition at line 164 of file SNBRequestHandlerModel.hpp.

165 {
166 daqdataformats::FragmentHeader fh;
167 fh.size = sizeof(fh);
168 fh.trigger_number = dr.trigger_number;
169 fh.trigger_timestamp = dr.trigger_timestamp;
170 fh.window_begin = dr.request_information.window_begin;
171 fh.window_end = dr.request_information.window_end;
172 fh.run_number = dr.run_number;
173 fh.fragment_type = static_cast<daqdataformats::fragment_type_t>(ReadoutType::fragment_type);
174 fh.sequence_number = dr.sequence_number;
175 fh.detector_id = m_detid;
176 fh.element_id = { m_sourceid.subsystem, m_sourceid.id };
177 return fh;
178 }
uint32_t fragment_type_t
Type used to represent Fragment type ID.
Definition Types.hpp:28

◆ data_request()

template<class RDT , class LBT >
SNBRequestHandlerModel< RDT, LBT >::RequestResult dunedaq::snbmodules::SNBRequestHandlerModel< RDT, LBT >::data_request ( dfmessages::DataRequest dr)
overrideprotectedvirtual

Implements dunedaq::datahandlinglibs::RequestHandlerConcept< ReadoutType, LatencyBufferType >.

Definition at line 443 of file SNBRequestHandlerModel.hxx.

444{
445 // Prepare response
446 RequestResult rres(ResultCode::kUnknown, dr);
447
448 // Prepare FragmentHeader and empty Fragment pieces list
449 auto frag_header = create_fragment_header(dr);
450 std::vector<std::pair<void*, size_t>> frag_pieces;
451 std::ostringstream oss;
452
453 // bool local_data_not_found_flag = false;
454 if (m_latency_buffer->occupancy() == 0) {
456 ers::warning(datahandlinglibs::RequestOnEmptyBuffer(ERS_HERE, m_sourceid, "Data not found"));
457 }
458 frag_header.error_bits |= (0x1 << static_cast<size_t>(daqdataformats::FragmentErrorBits::kDataNotFound));
459 rres.result_code = ResultCode::kNotFound;
461 } else {
462 frag_pieces = get_fragment_pieces(dr.request_information.window_begin, dr.request_information.window_end, rres);
463
464 auto front_element = m_latency_buffer->front(); // NOLINT
465 auto last_element = m_latency_buffer->back(); // NOLINT
466 uint64_t last_ts = front_element->get_timestamp(); // NOLINT(build/unsigned)
467 uint64_t newest_ts = last_element->get_timestamp(); // NOLINT(build/unsigned)
468 TLOG_DEBUG(TLVL_WORK_STEPS) << "Data request for trig/seq_num=" << dr.trigger_number << "." << dr.sequence_number
469 << " and SourceID[" << m_sourceid << "] with" << " Trigger TS=" << dr.trigger_timestamp
470 << " Oldest stored TS=" << last_ts << " Newest stored TS=" << newest_ts
471 << " Start of window TS=" << dr.request_information.window_begin
472 << " End of window TS=" << dr.request_information.window_end
473 << " Latency buffer occupancy=" << m_latency_buffer->occupancy()
474 << " frag_pieces result_code=" << rres.result_code
475 << " number of frag_pieces=" << frag_pieces.size();
476
477 switch (rres.result_code) {
478 case ResultCode::kTooOld:
479 // return empty frag
482 frag_header.error_bits |= (0x1 << static_cast<size_t>(daqdataformats::FragmentErrorBits::kDataNotFound));
483 break;
484 case ResultCode::kPartiallyOld:
487 frag_header.error_bits |= (0x1 << static_cast<size_t>(daqdataformats::FragmentErrorBits::kIncomplete));
488 frag_header.error_bits |= (0x1 << static_cast<size_t>(daqdataformats::FragmentErrorBits::kDataNotFound));
489 break;
490 case ResultCode::kFound:
492 break;
493 case ResultCode::kPartial:
494 frag_header.error_bits |= (0x1 << static_cast<size_t>(daqdataformats::FragmentErrorBits::kIncomplete));
496 break;
497 case ResultCode::kNotYet:
498 frag_header.error_bits |= (0x1 << static_cast<size_t>(daqdataformats::FragmentErrorBits::kDataNotFound));
500 break;
501 default:
502 // Unknown result of data search
504 frag_header.error_bits |= (0x1 << static_cast<size_t>(daqdataformats::FragmentErrorBits::kDataNotFound));
505 }
506 }
507 // Create fragment from pieces
508 rres.fragment = std::make_unique<daqdataformats::Fragment>(frag_pieces);
509
510 // Set header
511 rres.fragment->set_header_fields(frag_header);
512
513 return rres;
514}
#define ERS_HERE
typename dunedaq::datahandlinglibs::RequestHandlerConcept< ReadoutType, LatencyBufferType >::RequestResult RequestResult
std::vector< std::pair< void *, size_t > > get_fragment_pieces(uint64_t start_win_ts, uint64_t end_win_ts, RequestResult &rres)
@ kIncomplete
Only part of the requested data is present in the fragment.
void warning(const Issue &issue)
Definition ers.hpp:115

◆ dump_to_buffer()

template<class ReadoutType , class LatencyBufferType >
void dunedaq::snbmodules::SNBRequestHandlerModel< ReadoutType, LatencyBufferType >::dump_to_buffer ( const void * data,
std::size_t size,
void * buffer,
uint32_t buffer_pos,
const std::size_t & buffer_size )
inlineprotected

Definition at line 184 of file SNBRequestHandlerModel.hpp.

189 {
190 auto bytes_to_copy = size;
191 while (bytes_to_copy > 0) {
192 auto n = std::min(bytes_to_copy, buffer_size - buffer_pos);
193 std::memcpy(static_cast<char*>(buffer) + buffer_pos, static_cast<const char*>(data), n);
194 buffer_pos += n;
195 bytes_to_copy -= n;
196 if (buffer_pos == buffer_size) {
197 buffer_pos = 0;
198 }
199 }
200 }
FELIX Initialization std::string initerror FELIX queue timed std::string queuename Unexpected chunk size

◆ generate_opmon_data()

template<class RDT , class LBT >
void dunedaq::snbmodules::SNBRequestHandlerModel< RDT, LBT >::generate_opmon_data ( )
overrideprotectedvirtual

Hook for customisable pubblication. The function can throw, exception will be caught by the monitoring thread

Reimplemented from dunedaq::opmonlib::MonitorableObject.

Definition at line 208 of file SNBRequestHandlerModel.hxx.

209{
210 datahandlinglibs::opmon::RequestHandlerInfo info;
211
212 info.set_num_requests_handled(m_handled_requests.exchange(0));
213 info.set_num_requests_found(m_num_requests_found.exchange(0));
214 info.set_num_requests_bad(m_num_requests_bad.exchange(0));
215 info.set_num_requests_old_window(m_num_requests_old_window.exchange(0));
216 info.set_num_requests_delayed(m_num_requests_delayed.exchange(0));
217 info.set_num_requests_uncategorized(m_num_requests_uncategorized.exchange(0));
218 info.set_num_requests_timed_out(m_num_requests_timed_out.exchange(0));
219 info.set_num_requests_waiting(m_waiting_requests.size());
220
221 int new_pop_reqs = 0;
222 int new_pop_count = 0;
223 int new_occupancy = 0;
224 info.set_tot_request_response_time(m_response_time_acc.exchange(0));
225 info.set_max_request_response_time(m_response_time_max.exchange(0));
226 info.set_min_request_response_time(m_response_time_min.exchange(std::numeric_limits<int>::max()));
227 auto now = std::chrono::high_resolution_clock::now();
228 new_pop_reqs = m_pop_reqs.exchange(0);
229 new_pop_count = m_pops_count.exchange(0);
230 new_occupancy = m_occupancy;
231 double seconds = std::chrono::duration_cast<std::chrono::microseconds>(now - m_t0).count() / 1000000.;
232 TLOG_DEBUG(TLVL_HOUSEKEEPING) << "Cleanup request rate: " << new_pop_reqs / seconds / 1. << " [Hz]"
233 << " Dropped: " << new_pop_count << " Occupancy: " << new_occupancy;
234
235 if (info.num_requests_handled() > 0) {
236
237 info.set_avg_request_response_time(info.tot_request_response_time() / info.num_requests_handled());
238 TLOG_DEBUG(TLVL_HOUSEKEEPING) << "Completed requests: " << info.num_requests_handled()
239 << " | Avarage response time: " << info.avg_request_response_time() << "[us]"
240 << " | Periodic sends: " << info.num_periodic_sent();
241 }
242
243 m_t0 = now;
244
245 info.set_num_buffer_cleanups(m_num_buffer_cleanups.exchange(0));
246 info.set_num_periodic_sent(m_num_periodic_sent.exchange(0));
247 info.set_num_periodic_send_failed(m_num_periodic_send_failed.exchange(0));
248
249 this->publish(std::move(info));
250
251 datahandlinglibs::opmon::RecordingInfo rinfo;
252 rinfo.set_recording_status(m_recording ? "Y" : "N");
253 rinfo.set_packets_recorded(m_payloads_written.exchange(0));
254 rinfo.set_bytes_recorded(m_bytes_written.exchange(0));
255 this->publish(std::move(rinfo));
256}
void publish(google::protobuf::Message &&, CustomOrigin &&co={}, OpMonLevel l=to_level(EntryOpMonLevel::kDefault)) const noexcept
std::chrono::time_point< std::chrono::high_resolution_clock > m_t0
static int64_t now()

◆ get_cutoff_timestamp()

template<class ReadoutType , class LatencyBufferType >
virtual dunedaq::daqdataformats::timestamp_t dunedaq::snbmodules::SNBRequestHandlerModel< ReadoutType, LatencyBufferType >::get_cutoff_timestamp ( )
inlinevirtual

Definition at line 153 of file SNBRequestHandlerModel.hpp.

153{ return 0; }

◆ get_fragment_pieces()

template<class RDT , class LBT >
std::vector< std::pair< void *, size_t > > dunedaq::snbmodules::SNBRequestHandlerModel< RDT, LBT >::get_fragment_pieces ( uint64_t start_win_ts,
uint64_t end_win_ts,
RequestResult & rres )
protected

Definition at line 373 of file SNBRequestHandlerModel.hxx.

374{
375
376 TLOG_DEBUG(TLVL_WORK_STEPS) << "Looking for frags between " << start_win_ts << " and " << end_win_ts;
377
378 std::vector<std::pair<void*, size_t>> frag_pieces;
379 // Data availability is calculated here
380 auto front_element = m_latency_buffer->front(); // NOLINT
381 auto last_element = m_latency_buffer->back(); // NOLINT
382 uint64_t last_ts = front_element->get_timestamp(); // NOLINT(build/unsigned)
383 uint64_t newest_ts = last_element->get_timestamp(); // NOLINT(build/unsigned)
384
385 if (start_win_ts > newest_ts) {
386 // No element is as small as the start window-> request is far in the future
387 rres.result_code = ResultCode::kNotYet; // give it another chance
388 } else if (end_win_ts <= last_ts) {
389 rres.result_code = ResultCode::kTooOld;
390 } else {
391 RDT request_element = RDT();
392 auto start_timestamp = start_win_ts;
393 request_element.set_timestamp(start_timestamp);
394
395 auto start_iter = m_latency_buffer->begin();
396
397 if (!start_iter.good()) {
398 // Accessor problem
399 rres.result_code = ResultCode::kNotFound;
400 } else {
401 TLOG_DEBUG(TLVL_WORK_STEPS) << "Lower bound found " << start_iter->get_timestamp()
402 << ", --> distance from window: "
403 << int64_t(start_win_ts) - int64_t(start_iter->get_timestamp());
404
405 rres.result_code = ResultCode::kFound;
406
407 auto elements_handled = 0;
408
409 RDT* element = &(*start_iter);
410
411 while (start_iter.good() && element->get_timestamp() <= end_win_ts) {
412 std::lock_guard<std::mutex> lk(m_pop_list_mutex);
413 if (m_pop_list.count(element->get_timestamp()) ) {
414 TLOG_DEBUG(50) << "skip processing for current element " << element->get_timestamp()
415 << ", already included in trigger.";
416 }
417 else if (element->get_timestamp() < start_win_ts) {
418 TLOG_DEBUG(50) << "skip processing for current element " << element->get_timestamp()
419 << ", out of readout window.";
420 }
421
422 else {
423 // TLOG_DEBUG(50) << "Add element " << element->get_timestamp();
424 // SNB mode, the whole aggregated object (e.g.: superchunk) can be copied
425 frag_pieces.emplace_back(
426 std::make_pair<void*, size_t>(static_cast<void*>((*start_iter).begin()), element->get_payload_size()));
427
428 m_pop_list.insert(element->get_timestamp());
429 }
430
431 elements_handled++;
432 ++start_iter;
433 element = &(*start_iter);
434 }
435 }
436 }
437 TLOG_DEBUG(TLVL_WORK_STEPS) << "*** Number of frames retrieved: " << frag_pieces.size();
438 return frag_pieces;
439}

◆ get_oldest_time()

template<class ReadoutType , class LatencyBufferType >
std::uint64_t dunedaq::snbmodules::SNBRequestHandlerModel< ReadoutType, LatencyBufferType >::get_oldest_time ( )
inlineoverridevirtual

Get oldest timestamp in the buffer.

Implements dunedaq::datahandlinglibs::RequestHandlerConcept< ReadoutType, LatencyBufferType >.

Definition at line 160 of file SNBRequestHandlerModel.hpp.

160{ return m_oldest_timestamp.load(); } // NOLINT(build/unsigned)

◆ issue_request()

template<class RDT , class LBT >
void dunedaq::snbmodules::SNBRequestHandlerModel< RDT, LBT >::issue_request ( dfmessages::DataRequest ,
bool = false )
overridevirtual

Issue a data request to the request handler.

Implements dunedaq::datahandlinglibs::RequestHandlerConcept< ReadoutType, LatencyBufferType >.

Definition at line 154 of file SNBRequestHandlerModel.hxx.

155{
156 boost::asio::post(*m_request_handler_thread_pool, [&, datarequest, is_retry]() { // start a thread from pool
157 auto t_req_begin = std::chrono::high_resolution_clock::now();
158 {
159 std::unique_lock<std::mutex> lock(m_cv_mutex);
160 m_cv.wait(lock, [&] { return !m_cleanup_requested; });
162 }
163 m_cv.notify_all();
164 auto result = data_request(datarequest);
165 {
166 std::lock_guard<std::mutex> lock(m_cv_mutex);
168 }
169 m_cv.notify_all();
170 if ((result.result_code == ResultCode::kNotYet || result.result_code == ResultCode::kPartial) &&
171 m_request_timeout_ms > 0 && is_retry == false) {
172 TLOG_DEBUG(TLVL_WORK_STEPS) << "Re-queue request. "
173 << " with timestamp=" << result.data_request.trigger_timestamp;
174 std::lock_guard<std::mutex> wait_lock_guard(m_waiting_requests_lock);
175 m_waiting_requests.push_back(RequestElement(datarequest, std::chrono::high_resolution_clock::now()));
176 } else {
177 try { // Send to fragment connection
178 TLOG_DEBUG(TLVL_WORK_STEPS) << "Sending fragment with trigger/sequence_number "
179 << result.fragment->get_trigger_number() << "."
180 << result.fragment->get_sequence_number() << ", run number "
181 << result.fragment->get_run_number() << ", and DetectorID "
182 << result.fragment->get_detector_id() << ", and SourceID "
183 << result.fragment->get_element_id() << ", and size " << result.fragment->get_size()
184 << ", and result code " << result.result_code;
185 // Send fragment
187 ->send(std::move(result.fragment), std::chrono::milliseconds(m_fragment_send_timeout_ms));
188
189 } catch (const ers::Issue& excpt) {
190 ers::warning(datahandlinglibs::CannotWriteToQueue(ERS_HERE, m_sourceid, datarequest.data_destination, excpt));
191 }
192 }
193
194 auto t_req_end = std::chrono::high_resolution_clock::now();
195 auto us_req_took = std::chrono::duration_cast<std::chrono::microseconds>(t_req_end - t_req_begin);
196 TLOG_DEBUG(TLVL_WORK_STEPS) << "Responding to data request took: " << us_req_took.count() << "[us]";
197 m_response_time_acc.fetch_add(us_req_took.count());
198 if (us_req_took.count() > m_response_time_max.load())
199 m_response_time_max.store(us_req_took.count());
200 if (us_req_took.count() < m_response_time_min.load())
201 m_response_time_min.store(us_req_took.count());
203 });
204}
RequestResult data_request(dfmessages::DataRequest dr) override
std::unique_ptr< boost::asio::thread_pool > m_request_handler_thread_pool
Base class for any user define issue.
Definition Issue.hpp:69
static std::shared_ptr< iomanager::SenderConcept< Datatype > > get_iom_sender(iomanager::ConnectionId const &id)

◆ periodic_cleanups()

template<class RDT , class LBT >
void dunedaq::snbmodules::SNBRequestHandlerModel< RDT, LBT >::periodic_cleanups ( )
protected

Definition at line 271 of file SNBRequestHandlerModel.hxx.

272{
273 while (m_run_marker.load()) {
275 std::this_thread::sleep_for(std::chrono::milliseconds(50));
276 }
277}
void cleanup_check() override
Check if cleanup is necessary and execute it if necessary.

◆ periodic_data_transmission()

template<class RDT , class LBT >
void dunedaq::snbmodules::SNBRequestHandlerModel< RDT, LBT >::periodic_data_transmission ( )
overridevirtual

Periodic data transmission - relevant for trigger in particular.

Implements dunedaq::datahandlinglibs::RequestHandlerConcept< ReadoutType, LatencyBufferType >.

Definition at line 291 of file SNBRequestHandlerModel.hxx.

292{
293}

◆ periodic_data_transmissions()

template<class RDT , class LBT >
void dunedaq::snbmodules::SNBRequestHandlerModel< RDT, LBT >::periodic_data_transmissions ( )
protected

Definition at line 281 of file SNBRequestHandlerModel.hxx.

282{
283 while (m_run_marker.load()) {
285 std::this_thread::sleep_for(std::chrono::milliseconds(m_periodic_data_transmission_ms));
286 }
287}
virtual void periodic_data_transmission() override
Periodic data transmission - relevant for trigger in particular.

◆ record()

template<class RDT , class LBT >
void dunedaq::snbmodules::SNBRequestHandlerModel< RDT, LBT >::record ( const appfwk::DAQModule::CommandData_t & args)
overridevirtual

Implements dunedaq::datahandlinglibs::RequestHandlerConcept< ReadoutType, LatencyBufferType >.

Definition at line 133 of file SNBRequestHandlerModel.hxx.

134{
135 ers::error(datahandlinglibs::CommandError(ERS_HERE, m_sourceid, "DLH is not configured for recording"));
136 return;
137}
void error(const Issue &issue)
Definition ers.hpp:81

◆ reset_oldest_time()

template<class ReadoutType , class LatencyBufferType >
void dunedaq::snbmodules::SNBRequestHandlerModel< ReadoutType, LatencyBufferType >::reset_oldest_time ( )
inline

Definition at line 157 of file SNBRequestHandlerModel.hpp.

157{ m_oldest_timestamp.store(0); }

◆ scrap()

◆ start()

template<class RDT , class LBT >
void dunedaq::snbmodules::SNBRequestHandlerModel< RDT, LBT >::start ( const appfwk::DAQModule::CommandData_t & )
virtual

Implements dunedaq::datahandlinglibs::RequestHandlerConcept< ReadoutType, LatencyBufferType >.

Definition at line 67 of file SNBRequestHandlerModel.hxx.

68{
69 // Reset opmon variables
79 m_pop_reqs = 0;
80 m_pops_count = 0;
83
84 m_t0 = std::chrono::high_resolution_clock::now();
85
86 // 19-Dec-2024, KAB: check that Fragment senders are ready to send. This is done so
87 // that the IOManager infrastructure fetches the necessary connection details from
88 // the ConnectivityService at 'start' time, instead of the first time that the sender
89 // is used to send data. This avoids delays in the sending of the first fragment in
90 // the first data-taking run in a DAQ session. Such delays can lead to undesirable
91 // system behavior like trigger inhibits.
92 for (auto frag_out_conn : m_frag_out_conn_ids) {
94 if (sender != nullptr) {
95 bool is_ready = sender->is_ready_for_sending(std::chrono::milliseconds(100));
96 TLOG_DEBUG(0) << "The Fragment sender for " << frag_out_conn << " " << (is_ready ? "is" : "is not")
97 << " ready, my source_id is [" << m_sourceid << "]";
98 }
99 }
100
101 m_request_handler_thread_pool = std::make_unique<boost::asio::thread_pool>(m_num_request_handling_threads);
102
103 m_run_marker.store(true);
107 }
108
110}
bool set_work(Function &&f, Args &&... args)

◆ stop()

template<class RDT , class LBT >
void dunedaq::snbmodules::SNBRequestHandlerModel< RDT, LBT >::stop ( const appfwk::DAQModule::CommandData_t & )
virtual

Implements dunedaq::datahandlinglibs::RequestHandlerConcept< ReadoutType, LatencyBufferType >.

Definition at line 114 of file SNBRequestHandlerModel.hxx.

115{
116 m_run_marker.store(false);
118 std::this_thread::sleep_for(std::chrono::milliseconds(10));
119 }
121 std::this_thread::sleep_for(std::chrono::milliseconds(10));
122 }
124 std::this_thread::sleep_for(std::chrono::milliseconds(10));
125 }
126 TLOG() << "Latency buffer occupancy at stop: " << m_latency_buffer->occupancy();
129}
#define TLOG(...)
Definition macro.hpp:22

◆ supports_cutoff_timestamp()

template<class ReadoutType , class LatencyBufferType >
virtual bool dunedaq::snbmodules::SNBRequestHandlerModel< ReadoutType, LatencyBufferType >::supports_cutoff_timestamp ( )
inlinevirtual

Definition at line 154 of file SNBRequestHandlerModel.hpp.

154{ return false; }

Member Data Documentation

◆ m_buffer_capacity

template<class ReadoutType , class LatencyBufferType >
size_t dunedaq::snbmodules::SNBRequestHandlerModel< ReadoutType, LatencyBufferType >::m_buffer_capacity
protected

Definition at line 265 of file SNBRequestHandlerModel.hpp.

◆ m_buffered_writer

template<class ReadoutType , class LatencyBufferType >
datahandlinglibs::BufferedFileWriter dunedaq::snbmodules::SNBRequestHandlerModel< ReadoutType, LatencyBufferType >::m_buffered_writer
protected

Definition at line 229 of file SNBRequestHandlerModel.hpp.

◆ m_bytes_written

template<class ReadoutType , class LatencyBufferType >
std::atomic<int> dunedaq::snbmodules::SNBRequestHandlerModel< ReadoutType, LatencyBufferType >::m_bytes_written { 0 }
protected

Definition at line 293 of file SNBRequestHandlerModel.hpp.

293{ 0 };

◆ m_cleanup_requested

template<class ReadoutType , class LatencyBufferType >
std::atomic<bool> dunedaq::snbmodules::SNBRequestHandlerModel< ReadoutType, LatencyBufferType >::m_cleanup_requested = false
protected

Definition at line 241 of file SNBRequestHandlerModel.hpp.

◆ m_cleanup_thread

template<class ReadoutType , class LatencyBufferType >
utilities::ReusableThread dunedaq::snbmodules::SNBRequestHandlerModel< ReadoutType, LatencyBufferType >::m_cleanup_thread
protected

Definition at line 232 of file SNBRequestHandlerModel.hpp.

◆ m_configured

template<class ReadoutType , class LatencyBufferType >
bool dunedaq::snbmodules::SNBRequestHandlerModel< ReadoutType, LatencyBufferType >::m_configured
protected

Definition at line 262 of file SNBRequestHandlerModel.hpp.

◆ m_cv

template<class ReadoutType , class LatencyBufferType >
std::condition_variable dunedaq::snbmodules::SNBRequestHandlerModel< ReadoutType, LatencyBufferType >::m_cv
protected

Definition at line 240 of file SNBRequestHandlerModel.hpp.

◆ m_cv_mutex

template<class ReadoutType , class LatencyBufferType >
std::mutex dunedaq::snbmodules::SNBRequestHandlerModel< ReadoutType, LatencyBufferType >::m_cv_mutex
protected

Definition at line 239 of file SNBRequestHandlerModel.hpp.

◆ m_detid

template<class ReadoutType , class LatencyBufferType >
uint16_t dunedaq::snbmodules::SNBRequestHandlerModel< ReadoutType, LatencyBufferType >::m_detid
protected

Definition at line 267 of file SNBRequestHandlerModel.hpp.

◆ m_error_registry

template<class ReadoutType , class LatencyBufferType >
std::unique_ptr<datahandlinglibs::FrameErrorRegistry>& dunedaq::snbmodules::SNBRequestHandlerModel< ReadoutType, LatencyBufferType >::m_error_registry
protected

Definition at line 251 of file SNBRequestHandlerModel.hpp.

◆ m_frag_out_conn_ids

template<class ReadoutType , class LatencyBufferType >
std::vector<std::string> dunedaq::snbmodules::SNBRequestHandlerModel< ReadoutType, LatencyBufferType >::m_frag_out_conn_ids
protected

Definition at line 274 of file SNBRequestHandlerModel.hpp.

◆ m_fragment_send_timeout_ms

template<class ReadoutType , class LatencyBufferType >
int dunedaq::snbmodules::SNBRequestHandlerModel< ReadoutType, LatencyBufferType >::m_fragment_send_timeout_ms
protected

Definition at line 304 of file SNBRequestHandlerModel.hpp.

◆ m_handled_requests

template<class ReadoutType , class LatencyBufferType >
std::atomic<int> dunedaq::snbmodules::SNBRequestHandlerModel< ReadoutType, LatencyBufferType >::m_handled_requests { 0 }
protected

Definition at line 288 of file SNBRequestHandlerModel.hpp.

288{ 0 };

◆ m_latency_buffer

template<class ReadoutType , class LatencyBufferType >
std::shared_ptr<LatencyBufferType>& dunedaq::snbmodules::SNBRequestHandlerModel< ReadoutType, LatencyBufferType >::m_latency_buffer
protected

Definition at line 226 of file SNBRequestHandlerModel.hpp.

◆ m_next_timestamp_to_record

template<class ReadoutType , class LatencyBufferType >
std::atomic<uint64_t> dunedaq::snbmodules::SNBRequestHandlerModel< ReadoutType, LatencyBufferType >::m_next_timestamp_to_record = std::numeric_limits<uint64_t>::max()
protected

Definition at line 259 of file SNBRequestHandlerModel.hpp.

◆ m_num_buffer_cleanups

template<class ReadoutType , class LatencyBufferType >
std::atomic<int> dunedaq::snbmodules::SNBRequestHandlerModel< ReadoutType, LatencyBufferType >::m_num_buffer_cleanups { 0 }
protected

Definition at line 278 of file SNBRequestHandlerModel.hpp.

278{ 0 };

◆ m_num_periodic_send_failed

template<class ReadoutType , class LatencyBufferType >
std::atomic<uint64_t> dunedaq::snbmodules::SNBRequestHandlerModel< ReadoutType, LatencyBufferType >::m_num_periodic_send_failed { 0 }
protected

Definition at line 295 of file SNBRequestHandlerModel.hpp.

295{ 0 }; // NOLINT(build/unsigned)

◆ m_num_periodic_sent

template<class ReadoutType , class LatencyBufferType >
std::atomic<uint64_t> dunedaq::snbmodules::SNBRequestHandlerModel< ReadoutType, LatencyBufferType >::m_num_periodic_sent { 0 }
protected

Definition at line 294 of file SNBRequestHandlerModel.hpp.

294{ 0 }; // NOLINT(build/unsigned)

◆ m_num_request_handling_threads

template<class ReadoutType , class LatencyBufferType >
size_t dunedaq::snbmodules::SNBRequestHandlerModel< ReadoutType, LatencyBufferType >::m_num_request_handling_threads = 0
protected

Definition at line 248 of file SNBRequestHandlerModel.hpp.

◆ m_num_requests_bad

template<class ReadoutType , class LatencyBufferType >
std::atomic<int> dunedaq::snbmodules::SNBRequestHandlerModel< ReadoutType, LatencyBufferType >::m_num_requests_bad { 0 }
protected

Definition at line 283 of file SNBRequestHandlerModel.hpp.

283{ 0 };

◆ m_num_requests_delayed

template<class ReadoutType , class LatencyBufferType >
std::atomic<int> dunedaq::snbmodules::SNBRequestHandlerModel< ReadoutType, LatencyBufferType >::m_num_requests_delayed { 0 }
protected

Definition at line 285 of file SNBRequestHandlerModel.hpp.

285{ 0 };

◆ m_num_requests_found

template<class ReadoutType , class LatencyBufferType >
std::atomic<int> dunedaq::snbmodules::SNBRequestHandlerModel< ReadoutType, LatencyBufferType >::m_num_requests_found { 0 }
protected

Definition at line 282 of file SNBRequestHandlerModel.hpp.

282{ 0 };

◆ m_num_requests_old_window

template<class ReadoutType , class LatencyBufferType >
std::atomic<int> dunedaq::snbmodules::SNBRequestHandlerModel< ReadoutType, LatencyBufferType >::m_num_requests_old_window { 0 }
protected

Definition at line 284 of file SNBRequestHandlerModel.hpp.

284{ 0 };

◆ m_num_requests_timed_out

template<class ReadoutType , class LatencyBufferType >
std::atomic<int> dunedaq::snbmodules::SNBRequestHandlerModel< ReadoutType, LatencyBufferType >::m_num_requests_timed_out { 0 }
protected

Definition at line 287 of file SNBRequestHandlerModel.hpp.

287{ 0 };

◆ m_num_requests_uncategorized

template<class ReadoutType , class LatencyBufferType >
std::atomic<int> dunedaq::snbmodules::SNBRequestHandlerModel< ReadoutType, LatencyBufferType >::m_num_requests_uncategorized { 0 }
protected

Definition at line 286 of file SNBRequestHandlerModel.hpp.

286{ 0 };

◆ m_occupancy

template<class ReadoutType , class LatencyBufferType >
std::atomic<int> dunedaq::snbmodules::SNBRequestHandlerModel< ReadoutType, LatencyBufferType >::m_occupancy
protected

Definition at line 281 of file SNBRequestHandlerModel.hpp.

◆ m_oldest_timestamp

template<class ReadoutType , class LatencyBufferType >
std::atomic<uint64_t> dunedaq::snbmodules::SNBRequestHandlerModel< ReadoutType, LatencyBufferType >::m_oldest_timestamp { 0 }
protected

Definition at line 296 of file SNBRequestHandlerModel.hpp.

296{ 0 }; // NOLINT(build/unsigned)

◆ m_output_file

template<class ReadoutType , class LatencyBufferType >
std::string dunedaq::snbmodules::SNBRequestHandlerModel< ReadoutType, LatencyBufferType >::m_output_file
protected

Definition at line 268 of file SNBRequestHandlerModel.hpp.

◆ m_payloads_written

template<class ReadoutType , class LatencyBufferType >
std::atomic<int> dunedaq::snbmodules::SNBRequestHandlerModel< ReadoutType, LatencyBufferType >::m_payloads_written { 0 }
protected

Definition at line 292 of file SNBRequestHandlerModel.hpp.

292{ 0 };

◆ m_periodic_data_transmission_ms

template<class ReadoutType , class LatencyBufferType >
uint32_t dunedaq::snbmodules::SNBRequestHandlerModel< ReadoutType, LatencyBufferType >::m_periodic_data_transmission_ms = 0
protected

Definition at line 273 of file SNBRequestHandlerModel.hpp.

◆ m_periodic_transmission_thread

template<class ReadoutType , class LatencyBufferType >
utilities::ReusableThread dunedaq::snbmodules::SNBRequestHandlerModel< ReadoutType, LatencyBufferType >::m_periodic_transmission_thread
protected

Definition at line 233 of file SNBRequestHandlerModel.hpp.

◆ m_pop_counter

template<class ReadoutType , class LatencyBufferType >
std::atomic<int> dunedaq::snbmodules::SNBRequestHandlerModel< ReadoutType, LatencyBufferType >::m_pop_counter
protected

Definition at line 277 of file SNBRequestHandlerModel.hpp.

◆ m_pop_list

template<class ReadoutType , class LatencyBufferType >
std::set<uint64_t> dunedaq::snbmodules::SNBRequestHandlerModel< ReadoutType, LatencyBufferType >::m_pop_list
protected

Definition at line 264 of file SNBRequestHandlerModel.hpp.

◆ m_pop_list_mutex

template<class ReadoutType , class LatencyBufferType >
std::mutex dunedaq::snbmodules::SNBRequestHandlerModel< ReadoutType, LatencyBufferType >::m_pop_list_mutex
protected

Definition at line 263 of file SNBRequestHandlerModel.hpp.

◆ m_pop_reqs

template<class ReadoutType , class LatencyBufferType >
std::atomic<int> dunedaq::snbmodules::SNBRequestHandlerModel< ReadoutType, LatencyBufferType >::m_pop_reqs
protected

Definition at line 279 of file SNBRequestHandlerModel.hpp.

◆ m_pops_count

template<class ReadoutType , class LatencyBufferType >
std::atomic<int> dunedaq::snbmodules::SNBRequestHandlerModel< ReadoutType, LatencyBufferType >::m_pops_count
protected

Definition at line 280 of file SNBRequestHandlerModel.hpp.

◆ m_recording

template<class ReadoutType , class LatencyBufferType >
std::atomic<bool> dunedaq::snbmodules::SNBRequestHandlerModel< ReadoutType, LatencyBufferType >::m_recording = false
protected

Definition at line 258 of file SNBRequestHandlerModel.hpp.

◆ m_recording_configured

template<class ReadoutType , class LatencyBufferType >
bool dunedaq::snbmodules::SNBRequestHandlerModel< ReadoutType, LatencyBufferType >::m_recording_configured = false
protected

Definition at line 270 of file SNBRequestHandlerModel.hpp.

◆ m_recording_thread

template<class ReadoutType , class LatencyBufferType >
utilities::ReusableThread dunedaq::snbmodules::SNBRequestHandlerModel< ReadoutType, LatencyBufferType >::m_recording_thread
protected

Definition at line 230 of file SNBRequestHandlerModel.hpp.

◆ m_request_counter

template<class ReadoutType , class LatencyBufferType >
std::map<dfmessages::DataRequest, int> dunedaq::snbmodules::SNBRequestHandlerModel< ReadoutType, LatencyBufferType >::m_request_counter
protected

Definition at line 236 of file SNBRequestHandlerModel.hpp.

◆ m_request_handler_thread_pool

template<class ReadoutType , class LatencyBufferType >
std::unique_ptr<boost::asio::thread_pool> dunedaq::snbmodules::SNBRequestHandlerModel< ReadoutType, LatencyBufferType >::m_request_handler_thread_pool
protected

Definition at line 247 of file SNBRequestHandlerModel.hpp.

◆ m_request_timeout_ms

template<class ReadoutType , class LatencyBufferType >
int dunedaq::snbmodules::SNBRequestHandlerModel< ReadoutType, LatencyBufferType >::m_request_timeout_ms
private

Definition at line 307 of file SNBRequestHandlerModel.hpp.

◆ m_requests_running

template<class ReadoutType , class LatencyBufferType >
std::atomic<int> dunedaq::snbmodules::SNBRequestHandlerModel< ReadoutType, LatencyBufferType >::m_requests_running = 0
protected

Definition at line 242 of file SNBRequestHandlerModel.hpp.

◆ m_response_time_acc

template<class ReadoutType , class LatencyBufferType >
std::atomic<int> dunedaq::snbmodules::SNBRequestHandlerModel< ReadoutType, LatencyBufferType >::m_response_time_acc { 0 }
protected

Definition at line 289 of file SNBRequestHandlerModel.hpp.

289{ 0 };

◆ m_response_time_max

template<class ReadoutType , class LatencyBufferType >
std::atomic<int> dunedaq::snbmodules::SNBRequestHandlerModel< ReadoutType, LatencyBufferType >::m_response_time_max { 0 }
protected

Definition at line 291 of file SNBRequestHandlerModel.hpp.

291{ 0 };

◆ m_response_time_min

template<class ReadoutType , class LatencyBufferType >
std::atomic<int> dunedaq::snbmodules::SNBRequestHandlerModel< ReadoutType, LatencyBufferType >::m_response_time_min { std::numeric_limits<int>::max() }
protected

Definition at line 290 of file SNBRequestHandlerModel.hpp.

290{ std::numeric_limits<int>::max() };

◆ m_run_marker

template<class ReadoutType , class LatencyBufferType >
std::atomic<bool> dunedaq::snbmodules::SNBRequestHandlerModel< ReadoutType, LatencyBufferType >::m_run_marker = false
protected

Definition at line 255 of file SNBRequestHandlerModel.hpp.

◆ m_sourceid

template<class ReadoutType , class LatencyBufferType >
daqdataformats::SourceID dunedaq::snbmodules::SNBRequestHandlerModel< ReadoutType, LatencyBufferType >::m_sourceid
protected

Definition at line 266 of file SNBRequestHandlerModel.hpp.

◆ m_stream_buffer_size

template<class ReadoutType , class LatencyBufferType >
size_t dunedaq::snbmodules::SNBRequestHandlerModel< ReadoutType, LatencyBufferType >::m_stream_buffer_size = 0
protected

Definition at line 269 of file SNBRequestHandlerModel.hpp.

◆ m_t0

template<class ReadoutType , class LatencyBufferType >
std::chrono::time_point<std::chrono::high_resolution_clock> dunedaq::snbmodules::SNBRequestHandlerModel< ReadoutType, LatencyBufferType >::m_t0
protected

Definition at line 252 of file SNBRequestHandlerModel.hpp.

◆ m_waiting_queue_thread

template<class ReadoutType , class LatencyBufferType >
std::thread dunedaq::snbmodules::SNBRequestHandlerModel< ReadoutType, LatencyBufferType >::m_waiting_queue_thread
protected

Definition at line 257 of file SNBRequestHandlerModel.hpp.

◆ m_waiting_requests

template<class ReadoutType , class LatencyBufferType >
std::vector<RequestElement> dunedaq::snbmodules::SNBRequestHandlerModel< ReadoutType, LatencyBufferType >::m_waiting_requests
protected

Definition at line 243 of file SNBRequestHandlerModel.hpp.

◆ m_waiting_requests_lock

template<class ReadoutType , class LatencyBufferType >
std::mutex dunedaq::snbmodules::SNBRequestHandlerModel< ReadoutType, LatencyBufferType >::m_waiting_requests_lock
protected

Definition at line 244 of file SNBRequestHandlerModel.hpp.

◆ m_warn_about_empty_buffer

template<class ReadoutType , class LatencyBufferType >
bool dunedaq::snbmodules::SNBRequestHandlerModel< ReadoutType, LatencyBufferType >::m_warn_about_empty_buffer = true
protected

Definition at line 272 of file SNBRequestHandlerModel.hpp.

◆ m_warn_on_timeout

template<class ReadoutType , class LatencyBufferType >
bool dunedaq::snbmodules::SNBRequestHandlerModel< ReadoutType, LatencyBufferType >::m_warn_on_timeout = true
protected

Definition at line 271 of file SNBRequestHandlerModel.hpp.


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