artdaq_utilities  v1_05_11a
artdaq::SystemMetricCollector Class Reference

Collects metrics from the system, using proc filesystem or kernel API calls More...

#include <artdaq-utilities/Plugins/SystemMetricCollector.hh>

Public Member Functions

 SystemMetricCollector (bool processMetrics, bool systemMetrics)
 SystemMetricCollector Constructor More...
 
void GetSystemCPUUsage ()
 Calculate the system CPU usage percentages More...
 
double GetProcessCPUUsagePercent ()
 Return the current amount of CPU usage for the current process, % More...
 
uint64_t GetAvailableRAM ()
 Get the amount of available RAM in the system More...
 
uint64_t GetBufferedRAM ()
 Get the amount of RAM currently being used for cache More...
 
uint64_t GetTotalRAM ()
 Get the total amount of RAM in the system More...
 
double GetAvailableRAMPercent (bool buffers)
 Get the percentage of available RAM More...
 
uint64_t GetProcessMemUsage ()
 Get the amount of RAM being used by this process More...
 
double GetProcessMemUsagePercent ()
 Get the amount of RAM being used by this process More...
 
uint64_t GetNetworkReceiveBytes (std::string ifname)
 Get the amount of data received from the network in the last network collection interval (1.0 s) More...
 
uint64_t GetNetworkSendBytes (std::string ifname)
 Get the amount of data sent to the network in the last network collection interval (1.0 s) More...
 
uint64_t GetNetworkReceiveErrors (std::string ifname)
 Get the number of network receive errors in the last network collection interval (1.0 s) More...
 
uint64_t GetNetworkSendErrors (std::string ifname)
 Get the number of network send errors in the last network collection interval (1.0 s) More...
 
uint64_t GetNetworkTCPRetransSegs ()
 Return the current number of TCP (total) segments retransmitted, segments More...
 
std::list< std::string > GetNetworkInterfaceNames ()
 
std::list< std::unique_ptr
< MetricData > > 
SendMetrics ()
 Send the configured metrics More...
 

Detailed Description

Collects metrics from the system, using proc filesystem or kernel API calls

Definition at line 12 of file SystemMetricCollector.hh.

Constructor & Destructor Documentation

artdaq::SystemMetricCollector::SystemMetricCollector ( bool  processMetrics,
bool  systemMetrics 
)

SystemMetricCollector Constructor

Parameters
processMetricsWhether to collect process-level metrics (i.e. process CPU/RAM)
systemMetricsWhether to collect system-level metrics (i.e. System CPU/RAM/Network)

Definition at line 16 of file SystemMetricCollector.cc.

Member Function Documentation

uint64_t artdaq::SystemMetricCollector::GetAvailableRAM ( )

Get the amount of available RAM in the system

Returns
The amount of available (free) RAM in bytes

Definition at line 83 of file SystemMetricCollector.cc.

double artdaq::SystemMetricCollector::GetAvailableRAMPercent ( bool  buffers)

Get the percentage of available RAM

Parameters
buffersWhether cache RAM should be counted as available
Returns
The amount of available RAM, in %

Definition at line 116 of file SystemMetricCollector.cc.

uint64_t artdaq::SystemMetricCollector::GetBufferedRAM ( )

Get the amount of RAM currently being used for cache

Returns
The amount of RAM used in cache in bytes

Definition at line 94 of file SystemMetricCollector.cc.

uint64_t artdaq::SystemMetricCollector::GetNetworkReceiveBytes ( std::string  ifname)

Get the amount of data received from the network in the last network collection interval (1.0 s)

Parameters
ifnameName of the interface to collect
Returns
The number of bytes recevied from the network in the last second

Definition at line 145 of file SystemMetricCollector.cc.

uint64_t artdaq::SystemMetricCollector::GetNetworkReceiveErrors ( std::string  ifname)

Get the number of network receive errors in the last network collection interval (1.0 s)

Parameters
ifnameName of the interface to collect
Returns
The number of network receive errors in the last second

Definition at line 157 of file SystemMetricCollector.cc.

uint64_t artdaq::SystemMetricCollector::GetNetworkSendBytes ( std::string  ifname)

Get the amount of data sent to the network in the last network collection interval (1.0 s)

Parameters
ifnameName of the interface to collect
Returns
The number of bytes sent to the network in the last second

Definition at line 151 of file SystemMetricCollector.cc.

uint64_t artdaq::SystemMetricCollector::GetNetworkSendErrors ( std::string  ifname)

Get the number of network send errors in the last network collection interval (1.0 s)

Parameters
ifnameName of the interface to collect
Returns
The number of network send errors in the last second

Definition at line 195 of file SystemMetricCollector.cc.

uint64_t artdaq::SystemMetricCollector::GetNetworkTCPRetransSegs ( )

Return the current number of TCP (total) segments retransmitted, segments

Returns
the current number of TCP (total) segments retransmitted, segments

Definition at line 163 of file SystemMetricCollector.cc.

double artdaq::SystemMetricCollector::GetProcessCPUUsagePercent ( )

Return the current amount of CPU usage for the current process, %

Returns
The current amount of CPU usage for the current process, %

Definition at line 62 of file SystemMetricCollector.cc.

uint64_t artdaq::SystemMetricCollector::GetProcessMemUsage ( )

Get the amount of RAM being used by this process

Returns
The amount of RAM being used by this process, in bytes

Definition at line 128 of file SystemMetricCollector.cc.

double artdaq::SystemMetricCollector::GetProcessMemUsagePercent ( )

Get the amount of RAM being used by this process

Returns
The amount of RAM used by this process, as a percentage of the total RAM in the system

Definition at line 137 of file SystemMetricCollector.cc.

void artdaq::SystemMetricCollector::GetSystemCPUUsage ( )

Calculate the system CPU usage percentages

Definition at line 36 of file SystemMetricCollector.cc.

uint64_t artdaq::SystemMetricCollector::GetTotalRAM ( )

Get the total amount of RAM in the system

Returns
The total amount of RAM in the system, in bytes

Definition at line 105 of file SystemMetricCollector.cc.

std::list< std::unique_ptr< artdaq::MetricData > > artdaq::SystemMetricCollector::SendMetrics ( )

Send the configured metrics

Returns
A list of MetricData pointers for direct injection into MetricManager

Definition at line 211 of file SystemMetricCollector.cc.


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