9#include <daq/dataflow/modules/DAQPerf.h>
11#include <framework/datastore/StoreArray.h>
12#include <rawdata/dataobjects/RawCOPPER.h>
34 addParam(
"Cycle", m_ncycle,
"Monitor cycle", 10000);
35 addParam(
"MonitorSize", m_mon,
"SW to monitor data flow",
false);
38 B2INFO(
"Rx: Constructor done.");
42DAQPerfModule::~DAQPerfModule()
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;
void initialize() override
Module functions to be called from main process.
void event() override
This method is the core of the module.
void endRun() override
This method is called if the current run ends.
void terminate() override
This method is called at the end of the event processing.
DAQPerfModule()
Constructor / Destructor.
void beginRun() override
Module functions to be called from event process.
void setDescription(const std::string &description)
Sets the description of the module.
Accessor to arrays stored in the data store.
int getEntries() const
Get the number of objects in the array.
void addParam(const std::string &name, T ¶mVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Abstract base class for different kinds of events.