artdaq_utilities  v1_05_05
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...
 
double GetSystemCPUUsagePercent ()
 Return the current overall system CPU usage in % More...
 
double GetProcessCPUUsagePercent ()
 Return the current amount of CPU usage for the current process, % More...
 
unsigned long GetAvailableRAM ()
 Get the amount of available RAM in the system More...
 
unsigned long GetBufferedRAM ()
 Get the amount of RAM currently being used for cache More...
 
unsigned long GetTotalRAM ()
 Get the total amount of RAM in the system More...
 
double GetAvailableRAMPercent (bool buffers)
 Get the percentage of available RAM More...
 
unsigned long 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...
 
unsigned long GetNetworkReceiveBytes ()
 Get the amount of data received from the network in the last network collection interval (1.0 s) More...
 
unsigned long GetNetworkSendBytes ()
 Get the amount of data sent to the network in the last network collection interval (1.0 s) More...
 
unsigned long GetNetworkReceiveErrors ()
 Get the number of network receive errors in the last network collection interval (1.0 s) More...
 
unsigned long GetNetworkSendErrors ()
 Get the number of network send errors in the last network collection interval (1.0 s) More...
 
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 11 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 14 of file SystemMetricCollector.cc.

Member Function Documentation

unsigned long artdaq::SystemMetricCollector::GetAvailableRAM ( )

Get the amount of available RAM in the system

Returns
The amount of available (free) RAM in bytes

Definition at line 51 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 84 of file SystemMetricCollector.cc.

unsigned long 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 62 of file SystemMetricCollector.cc.

unsigned long artdaq::SystemMetricCollector::GetNetworkReceiveBytes ( )

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

Returns
The number of bytes recevied from the network in the last second

Definition at line 112 of file SystemMetricCollector.cc.

unsigned long artdaq::SystemMetricCollector::GetNetworkReceiveErrors ( )

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

Returns
The number of network receive errors in the last second

Definition at line 124 of file SystemMetricCollector.cc.

unsigned long artdaq::SystemMetricCollector::GetNetworkSendBytes ( )

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

Returns
The number of bytes sent to the network in the last second

Definition at line 118 of file SystemMetricCollector.cc.

unsigned long artdaq::SystemMetricCollector::GetNetworkSendErrors ( )

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

Returns
The number of network send errors in the last second

Definition at line 130 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 32 of file SystemMetricCollector.cc.

unsigned long 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 96 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 105 of file SystemMetricCollector.cc.

double artdaq::SystemMetricCollector::GetSystemCPUUsagePercent ( )

Return the current overall system CPU usage in %

Returns
System CPU usage, %

Definition at line 23 of file SystemMetricCollector.cc.

unsigned long 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 73 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 136 of file SystemMetricCollector.cc.


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