9#include "daq/expreco/EventSampler.h"
18EventSampler::EventSampler(
const vector<string>& nodes,
int port,
const string& rbufname,
int interval) : m_interval(interval)
25 const string& nodename = *it;
26 printf(
"EventSampler : connecting to %s (port %d)\n", nodename.c_str(), port);
29 printf(
"EventSampler : error to connect to %s\n",
32 m_socklist.push_back(sock);
36 printf(
"EventSampler : init : socklist = %zu\n", m_socklist.size());
40EventSampler::~EventSampler()
42 for (EvtSocketSend* sock : m_socklist) {
49int EventSampler::server()
55 for (vector<EvtSocketSend*>::iterator it = m_socklist.begin();
56 it != m_socklist.end(); ++it) {
58 EvtSocketSend* sock = *it;
61 EvtMessage* msg = sock->recv();
65 printf(
"EventSampler : Error to receive data\n");
72 if (nsample % 1000 == 0)
73 printf(
"EventSampler : %d events sampled and queued\n", nsample);
int paddedSize() const
Same as size(), but as size of an integer array.
char * buffer()
Get buffer address.
Class to manage a Ring Buffer placed in an IPC shared memory.
Abstract base class for different kinds of events.