Belle II Software development
FlowMonitor Class Reference

Public Member Functions

bool open (RunInfoBuffer *m_info)
 
bool close ()
 
ronode_statusmonitor ()
 
const ronode_statusgetStatus () const
 
ronode_statusgetStatus ()
 
bool isAvailable () const
 

Private Attributes

std::string m_nodename
 
RunInfoBufferm_info
 
std::vector< IOInfom_ioinfo
 
std::string m_ip [2]
 
unsigned long long m_nbyte [2]
 
ronode_status m_status
 

Detailed Description

Definition at line 21 of file FlowMonitor.h.

Constructor & Destructor Documentation

◆ FlowMonitor()

FlowMonitor ( )
inline

Definition at line 24 of file FlowMonitor.h.

25 {
26 m_ioinfo.push_back(IOInfo());
27 m_ioinfo.push_back(IOInfo());
28 m_info = NULL;
29 m_status.connection_in = 0;
30 m_status.connection_out = 0;
31 }

◆ ~FlowMonitor()

~FlowMonitor ( )
inline

Definition at line 32 of file FlowMonitor.h.

32{}

Member Function Documentation

◆ close()

bool close ( )

Definition at line 32 of file FlowMonitor.cc.

33{
34 return true;
35}

◆ getStatus() [1/2]

ronode_status & getStatus ( )
inline

Definition at line 39 of file FlowMonitor.h.

39{ return m_status; }

◆ getStatus() [2/2]

const ronode_status & getStatus ( ) const
inline

Definition at line 38 of file FlowMonitor.h.

38{ return m_status; }

◆ isAvailable()

bool isAvailable ( ) const
inline

Definition at line 40 of file FlowMonitor.h.

40{ return m_info != NULL; }

◆ monitor()

ronode_status & monitor ( )

Definition at line 37 of file FlowMonitor.cc.

38{
39 if (m_info->isAvailable()) {
40 m_ioinfo[0].setLocalAddress(m_info->getInputAddress());
41 m_ioinfo[0].setLocalPort(m_info->getInputPort());
42 m_ioinfo[1].setLocalAddress(m_info->getOutputAddress());
43 m_ioinfo[1].setLocalPort(m_info->getOutputPort());
44 IOInfo::checkTCP(m_ioinfo);
45 unsigned int ctime = Time().getSecond();
46 ronode_info info;
47 memcpy(&info, m_info->get(), sizeof(ronode_info));
48 memcpy(&(m_status.header), &(info.header), sizeof(event_header));
49 double length = ctime - m_status.ctime;
50 m_status.eflag = info.eflag;
51 m_status.state = info.state;
52 m_status.expno = info.expno;
53 m_status.runno = info.runno;
54 m_status.subno = info.subno;
55 m_status.reserved_i[0] = info.reserved[0];
56 m_status.reserved_i[1] = info.reserved[1];
57 m_status.reserved_f[0] = info.reserved_f[0];
58 m_status.reserved_f[1] = info.reserved_f[1];
59 m_status.reserved_f[2] = info.reserved_f[2];
60 m_status.reserved_f[3] = info.reserved_f[3];
61 m_status.ctime = ctime;
62
63 double dcount;
64 double dnbyte;
65 m_status.evtrate_in = 0;
66 m_status.evtsize_in = 0;
67 m_status.flowrate_in = 0;
68 m_status.evtrate_out = 0;
69 m_status.evtsize_out = 0;
70 m_status.flowrate_out = 0;
71 if (m_ioinfo[0].getLocalPort() > 0) {
72 m_status.connection_in = m_ioinfo[0].getState() == 1;
73 m_status.nqueue_in = m_ioinfo[0].getRXQueue();
74 }
75 if (m_ioinfo[1].getLocalPort() > 0) {
76 m_status.connection_out = m_ioinfo[1].getState() == 1;
77 m_status.nqueue_out = m_ioinfo[1].getRXQueue();
78 }
79 if ((dcount = info.io[0].count - m_status.nevent_in) > 0) {
80 dnbyte = info.io[0].nbyte - m_nbyte[0];
81 m_status.evtrate_in = dcount / length / 1000.;
82 m_status.evtsize_in = dnbyte / dcount / 1000.;
83 m_status.flowrate_in = dnbyte / length / 1000000.;
84 m_status.nevent_in = info.io[0].count;
85 m_nbyte[0] = info.io[0].nbyte;
86 } else {
87 m_status.evtrate_in = 0;
88 m_status.evtsize_in = 0;
89 m_status.flowrate_in = 0;
90 }
91 if ((dcount = info.io[1].count - m_status.nevent_out) > 0) {
92 dnbyte = info.io[1].nbyte - m_nbyte[1];
93 m_status.evtrate_out = dcount / length / 1000.;
94 m_status.evtsize_out = dnbyte / dcount / 1000.;
95 m_status.flowrate_out = dnbyte / length / 1000000.;
96 m_status.nevent_out = info.io[1].count;
97 m_nbyte[1] = info.io[1].nbyte;
98 } else {
99 m_status.evtrate_out = 0;
100 m_status.evtsize_out = 0;
101 m_status.flowrate_out = 0;
102 }
103 }
104 return m_status;
105}

◆ open()

bool open ( RunInfoBuffer m_info)

Definition at line 16 of file FlowMonitor.cc.

17{
18 m_info = info;
19 if (m_info->isAvailable()) {
20 m_status.nodeid = m_info->getNodeId();
21 m_nbyte[0] = m_nbyte[1] = 0;
22 m_ioinfo[0].setLocalPort(m_info->getInputPort());
23 m_ioinfo[0].setLocalAddress(m_info->getInputAddress());
24 m_ip[0] = m_ioinfo[0].getLocalIP();
25 m_ioinfo[1].setLocalPort(m_info->getOutputPort());
26 m_ioinfo[1].setLocalAddress(m_info->getOutputAddress());
27 m_ip[1] = m_ioinfo[1].getLocalIP();
28 }
29 return true;
30}

Member Data Documentation

◆ m_info

RunInfoBuffer* m_info
private

Definition at line 44 of file FlowMonitor.h.

◆ m_ioinfo

std::vector<IOInfo> m_ioinfo
private

Definition at line 45 of file FlowMonitor.h.

◆ m_ip

std::string m_ip[2]
private

Definition at line 46 of file FlowMonitor.h.

◆ m_nbyte

unsigned long long m_nbyte[2]
private

Definition at line 47 of file FlowMonitor.h.

◆ m_nodename

std::string m_nodename
private

Definition at line 43 of file FlowMonitor.h.

◆ m_status

ronode_status m_status
private

Definition at line 48 of file FlowMonitor.h.


The documentation for this class was generated from the following files: