5 #include <unordered_map>
6 #include "artdaq-utilities/Plugins/MetricData.hh"
94 std::list<std::string> GetNetworkInterfaceNames();
99 std::list<std::unique_ptr<MetricData>>
SendMetrics();
104 uint64_t user{0}, nice{0}, system{0}, idle{0}, iowait{0}, irq{0}, softirq{0};
105 uint64_t totalUsage{0}, total{0};
107 cpustat ReadProcStat_();
108 static size_t GetCPUCount_();
110 double nonIdleCPUPercent_;
111 double userCPUPercent_;
112 double systemCPUPercent_;
113 double idleCPUPercent_;
114 double iowaitCPUPercent_;
115 double irqCPUPercent_;
119 uint64_t send_bytes{0}, recv_bytes{0}, send_errs{0}, recv_errs{0};
120 std::chrono::steady_clock::time_point collectionTime;
124 std::unordered_map<std::string, netstat> stats;
125 std::chrono::steady_clock::time_point collectionTime;
127 netstats ReadProcNetDev_();
128 void UpdateNetstat_();
131 struct tms lastProcessCPUTimes_;
132 clock_t lastProcessCPUTime_;
133 netstats thisNetStat_;
134 netstats lastNetStat_;
135 bool sendProcessMetrics_;
136 bool sendSystemMetrics_;
uint64_t GetNetworkTCPRetransSegs()
Return the current number of TCP (total) segments retransmitted, segments
uint64_t GetTotalRAM()
Get the total amount of RAM in the system
uint64_t GetNetworkReceiveErrors(std::string ifname)
Get the number of network receive errors in the last network collection interval (1.0 s)
uint64_t GetNetworkSendBytes(std::string ifname)
Get the amount of data sent to the network in the last network collection interval (1...
uint64_t GetProcessMemUsage()
Get the amount of RAM being used by this process
std::list< std::unique_ptr< MetricData > > SendMetrics()
Send the configured metrics
uint64_t GetNetworkSendErrors(std::string ifname)
Get the number of network send errors in the last network collection interval (1.0 s) ...
Collects metrics from the system, using proc filesystem or kernel API calls
double GetAvailableRAMPercent(bool buffers)
Get the percentage of available RAM
void GetSystemCPUUsage()
Calculate the system CPU usage percentages
uint64_t GetAvailableRAM()
Get the amount of available RAM in the system
double GetProcessCPUUsagePercent()
Return the current amount of CPU usage for the current process, %
SystemMetricCollector(bool processMetrics, bool systemMetrics)
SystemMetricCollector Constructor
double GetProcessMemUsagePercent()
Get the amount of RAM being used by this process
uint64_t GetNetworkReceiveBytes(std::string ifname)
Get the amount of data received from the network in the last network collection interval (1...
uint64_t GetBufferedRAM()
Get the amount of RAM currently being used for cache