[metrics] Changed the extension from cpp to cc.

- Fix date of CMakeLists.txt.
- Initialization of the used variables in the cpu usage calculation.
master
AlaiaL 4 years ago committed by Andre Puschmann
parent 41cf15f5ad
commit 723c56051e

@ -24,7 +24,7 @@
namespace srslte {
/// Metrics that will be returned in the system.
/// Metrics of cpu usage, memory consumption and number of thread used by the process.
struct sys_metrics_t {
unsigned process_realmem_kB = 0;
unsigned process_virtualmem_kB = 0;

@ -35,12 +35,18 @@ class sys_metrics_processor
struct proc_stats_info {
proc_stats_info();
// Initialize the variables that will be used.
int long num_threads = 0;
unsigned long utime = 0;
unsigned long stime = 0;
// Rest of the information of the stats file.
int pid, ppid, pgrp, session, tty_nr, tpgid, exit_signal, processor, exit_code;
unsigned flags, rt_priority, policy;
unsigned long minflt, cminflt, majflt, cmajflt, utime, stime, vsize, rsslim, startcode, endcode, startstack,
kstkesp, kstkeip, signal, blocked, sigignore, sigcatch, wchan, nswap, cnswap, guest_time, start_data, end_data,
start_brk, arg_start, arg_end, env_start, env_end;
int long cutime, cstime, priority, nice, num_threads, itrealvalue, rss, cguest_time;
unsigned long minflt, cminflt, majflt, cmajflt, vsize, rsslim, startcode, endcode, startstack, kstkesp, kstkeip,
signal, blocked, sigignore, sigcatch, wchan, nswap, cnswap, guest_time, start_data, end_data, start_brk,
arg_start, arg_end, env_start, env_end;
int long cutime, cstime, priority, nice, itrealvalue, rss, cguest_time;
unsigned long long starttime, delaycct_blkio_ticks;
char state;
std::string comm;

@ -1,5 +1,5 @@
#
# Copyright 2013-2020 Software Radio Systems Limited
# Copyright 2013-2021 Software Radio Systems Limited
#
# By using this file, you agree to the terms and conditions set
# forth in the LICENSE file which can be found at the top level of
@ -7,7 +7,7 @@
#
set(SOURCES
sys_metrics_processor.cpp)
sys_metrics_processor.cc)
find_package(Threads REQUIRED)

@ -32,6 +32,10 @@ sys_metrics_processor::proc_stats_info::proc_stats_info()
std::string line;
{
std::ifstream file("/proc/self/stat");
if (!file) {
return;
}
std::getline(file, line);
}
Loading…
Cancel
Save