|
| EventSampler (std::vector< std::string > nodes, int port, std::string rbufname, int interval=5000) |
|
int | server () |
|
Definition at line 25 of file EventSampler.h.
◆ EventSampler()
EventSampler |
( |
std::vector< std::string > |
nodes, |
|
|
int |
port, |
|
|
std::string |
rbufname, |
|
|
int |
interval = 5000 |
|
) |
| |
Definition at line 18 of file EventSampler.cc.
18 : m_interval(interval)
19{
20
22
23
24 for (vector<string>::iterator it = nodes.begin(); it != nodes.end(); ++it) {
25 string& nodename = *it;
26 printf("EventSampler : connecting to %s (port %d)\n", nodename.c_str(), port);
28 if (sock == NULL) {
29 printf("EventSampler : error to connect to %s\n",
30 nodename.c_str());
31 } else {
32 m_socklist.push_back(sock);
33 }
34 fflush(stdout);
35 }
36 printf("EventSampler : init : socklist = %lu\n", m_socklist.size());
37 fflush(stdout);
38}
Class to manage a Ring Buffer placed in an IPC shared memory.
◆ ~EventSampler()
Definition at line 40 of file EventSampler.cc.
41{
42 for (vector<EvtSocketSend*>::iterator it = m_socklist.begin();
43 it != m_socklist.end(); ++it) {
45 delete sock;
46 m_socklist.erase(it);
47 }
48 delete m_rbuf;
49}
◆ server()
Definition at line 51 of file EventSampler.cc.
52{
53
54 fflush(stdout);
55 int nsample = 0;
56 for (;;) {
57 for (vector<EvtSocketSend*>::iterator it = m_socklist.begin();
58 it != m_socklist.end(); ++it) {
59
61
62
64
65
66 if (msg == NULL) {
67 printf("EventSampler : Error to receive data\n");
68 return -1;
69 }
70
72 delete msg;
73 nsample++;
74 if (nsample % 1000 == 0)
75 printf("EventSampler : %d events sampled and queued\n", nsample);
76 usleep(m_interval);
77 }
78 }
79}
Class to manage streamed object.
int paddedSize() const
Same as size(), but as size of an integer array.
char * buffer()
Get buffer address.
int insq(const int *buf, int size, bool checkTx=false)
Append a buffer to the RingBuffer.
◆ m_interval
◆ m_rbuf
◆ m_socklist
The documentation for this class was generated from the following files: