CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
evf::GlobalEvFOutputEventWriter Class Reference

Public Member Functions

void close ()
 
void doOutputEvent (EventMsgBuilder const &msg)
 
void doOutputEventAsync (std::unique_ptr< EventMsgBuilder > msg, edm::WaitingTaskHolder iHolder)
 
uint32 get_adler32 () const
 
unsigned long getAccepted () const
 
std::string const & getFilePath () const
 
 GlobalEvFOutputEventWriter (std::string const &filePath)
 
void incAccepted ()
 
edm::SerialTaskQueuequeue ()
 
void throttledCheck ()
 
 ~GlobalEvFOutputEventWriter ()
 

Private Attributes

std::atomic< unsigned long > accepted_
 
std::string filePath_
 
edm::propagate_const< std::unique_ptr< StreamerOutputFile > > stream_writer_events_
 
edm::SerialTaskQueue writeQueue_
 

Detailed Description

Definition at line 44 of file GlobalEvFOutputModule.cc.

Constructor & Destructor Documentation

◆ GlobalEvFOutputEventWriter()

evf::GlobalEvFOutputEventWriter::GlobalEvFOutputEventWriter ( std::string const &  filePath)
inlineexplicit

Definition at line 46 of file GlobalEvFOutputModule.cc.

◆ ~GlobalEvFOutputEventWriter()

evf::GlobalEvFOutputEventWriter::~GlobalEvFOutputEventWriter ( )
inline

Definition at line 49 of file GlobalEvFOutputModule.cc.

49 {}

Member Function Documentation

◆ close()

void evf::GlobalEvFOutputEventWriter::close ( void  )
inline

Definition at line 51 of file GlobalEvFOutputModule.cc.

References stream_writer_events_.

Referenced by esMonitoring.AsyncLineReaderMixin::handle_close(), and esMonitoring.FDJsonServer::handle_close().

51 { stream_writer_events_->close(); }
edm::propagate_const< std::unique_ptr< StreamerOutputFile > > stream_writer_events_

◆ doOutputEvent()

void evf::GlobalEvFOutputEventWriter::doOutputEvent ( EventMsgBuilder const &  msg)
inline

Definition at line 53 of file GlobalEvFOutputModule.cc.

References incAccepted(), mps_check::msg, and stream_writer_events_.

Referenced by doOutputEventAsync().

53  {
54  EventMsgView eview(msg.startAddress());
55  stream_writer_events_->write(eview);
56  incAccepted();
57  }
tuple msg
Definition: mps_check.py:286
edm::propagate_const< std::unique_ptr< StreamerOutputFile > > stream_writer_events_

◆ doOutputEventAsync()

void evf::GlobalEvFOutputEventWriter::doOutputEventAsync ( std::unique_ptr< EventMsgBuilder msg,
edm::WaitingTaskHolder  iHolder 
)
inline

Definition at line 59 of file GlobalEvFOutputModule.cc.

References doOutputEvent(), edm::WaitingTaskHolder::group(), watchdog::group, eostools::move(), mps_check::msg, edm::SerialTaskQueue::push(), throttledCheck(), createJobs::tmp, and writeQueue_.

59  {
61  auto group = iHolder.group();
62  writeQueue_.push(*group, [holder = std::move(iHolder), msg = msg.release(), this]() {
63  try {
64  std::unique_ptr<EventMsgBuilder> own(msg);
65  doOutputEvent(*msg); //msg is written and discarded at this point
66  } catch (...) {
67  auto tmp = holder;
68  tmp.doneWaiting(std::current_exception());
69  }
70  });
71  }
void push(oneapi::tbb::task_group &, const T &iAction)
asynchronously pushes functor iAction into queue
void doOutputEvent(EventMsgBuilder const &msg)
oneapi::tbb::task_group * group() const noexcept
tuple msg
Definition: mps_check.py:286
tmp
align.sh
Definition: createJobs.py:716
def move(src, dest)
Definition: eostools.py:511

◆ get_adler32()

uint32 evf::GlobalEvFOutputEventWriter::get_adler32 ( ) const
inline

Definition at line 85 of file GlobalEvFOutputModule.cc.

References stream_writer_events_.

85 { return stream_writer_events_->adler32(); }
edm::propagate_const< std::unique_ptr< StreamerOutputFile > > stream_writer_events_

◆ getAccepted()

unsigned long evf::GlobalEvFOutputEventWriter::getAccepted ( ) const
inline

Definition at line 89 of file GlobalEvFOutputModule.cc.

References accepted_.

89 { return accepted_; }
std::atomic< unsigned long > accepted_

◆ getFilePath()

std::string const& evf::GlobalEvFOutputEventWriter::getFilePath ( ) const
inline

Definition at line 87 of file GlobalEvFOutputModule.cc.

References filePath_.

◆ incAccepted()

void evf::GlobalEvFOutputEventWriter::incAccepted ( )
inline

Definition at line 90 of file GlobalEvFOutputModule.cc.

References accepted_.

Referenced by doOutputEvent().

90 { accepted_++; }
std::atomic< unsigned long > accepted_

◆ queue()

edm::SerialTaskQueue& evf::GlobalEvFOutputEventWriter::queue ( )
inline

Definition at line 92 of file GlobalEvFOutputModule.cc.

References writeQueue_.

92 { return writeQueue_; }

◆ throttledCheck()

void evf::GlobalEvFOutputEventWriter::throttledCheck ( )
inline

Definition at line 73 of file GlobalEvFOutputModule.cc.

References svgfig::load(), and edm::shutdown_flag.

Referenced by doOutputEventAsync().

73  {
74  unsigned int counter = 0;
75  while (edm::Service<evf::EvFDaqDirector>()->inputThrottled()) {
76  if (edm::shutdown_flag.load(std::memory_order_relaxed))
77  break;
78  if (!(counter % 100))
79  edm::LogWarning("FedRawDataInputSource") << "Input throttled detected, writing is paused...";
80  usleep(100000);
81  counter++;
82  }
83  }
volatile std::atomic< bool > shutdown_flag
def load(fileName)
Definition: svgfig.py:547
Log< level::Warning, false > LogWarning

Member Data Documentation

◆ accepted_

std::atomic<unsigned long> evf::GlobalEvFOutputEventWriter::accepted_
private

Definition at line 96 of file GlobalEvFOutputModule.cc.

Referenced by getAccepted(), and incAccepted().

◆ filePath_

std::string evf::GlobalEvFOutputEventWriter::filePath_
private

Definition at line 95 of file GlobalEvFOutputModule.cc.

Referenced by getFilePath().

◆ stream_writer_events_

edm::propagate_const<std::unique_ptr<StreamerOutputFile> > evf::GlobalEvFOutputEventWriter::stream_writer_events_
private

Definition at line 97 of file GlobalEvFOutputModule.cc.

Referenced by close(), doOutputEvent(), and get_adler32().

◆ writeQueue_

edm::SerialTaskQueue evf::GlobalEvFOutputEventWriter::writeQueue_
private

Definition at line 98 of file GlobalEvFOutputModule.cc.

Referenced by doOutputEventAsync(), and queue().