9 #include <daq/dataflow/modules/DAQPerf.h>
11 #include <framework/datastore/StoreArray.h>
12 #include <rawdata/dataobjects/RawCOPPER.h>
31 setDescription(
"Monitor DAQ transfer performance");
34 addParam(
"Cycle", m_ncycle,
"Monitor cycle", 10000);
35 addParam(
"MonitorSize", m_mon,
"SW to monitor data flow",
false);
38 B2INFO(
"Rx: Constructor done.");
42 DAQPerfModule::~DAQPerfModule()
46 void DAQPerfModule::initialize()
55 void DAQPerfModule::beginRun()
60 void DAQPerfModule::event()
62 if (m_nevent % m_ncycle == 0) {
63 if (m_t0.tv_sec == 0) {
64 gettimeofday(&m_t0, NULL);
68 gettimeofday(&t, NULL);
69 double now = (double)t.tv_sec + (
double)t.tv_usec * 0.000001;
70 double t0 = (double)m_t0.tv_sec + (
double)m_t0.tv_usec * 0.000001;
71 double elapsed = now - t0;
72 printf(
"Event = %d : took %5.2f sec for %d evts -> %5.2f kHz",
73 m_nevent, elapsed, m_ncycle, (
double)m_ncycle / elapsed / 1000);
75 double aveflow = m_totbytes / elapsed / 1000000.0;
77 printf(
", %3.2f (MB/s)", aveflow);
80 gettimeofday(&m_t0, NULL);
87 for (
int i = 0; i < rawcprary.
getEntries(); ++i) {
88 rawsize += (double)(rawcprary[i]->TotalBufNwords());
90 m_totbytes += rawsize * 4;
97 void DAQPerfModule::endRun()
103 void DAQPerfModule::terminate()
A class definition of an input module for Sequential ROOT I/O.
Accessor to arrays stored in the data store.
int getEntries() const
Get the number of objects in the array.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Abstract base class for different kinds of events.