52 int64_t elapsed_millis = (now - m_last_timestamp) / 1000000LL;
59 pct = (diff_sys * 100) / elapsed_millis;
60 collector->
update(
"cpu.sys", pct);
64 pct = (diff_user * 100) / elapsed_millis;
65 collector->
update(
"cpu.user", pct);
68 collector->
update(
"memory.virtual",
72 collector->
update(
"memory.resident",
76 collector->
update(
"memory.heap",
80 collector->
update(
"memory.heapSlack",
86 m_last_timestamp = now;
static const CpuInfo & cpu_info()
Retrieves updated CPU information (see SystemInfo.h)
MetricsProcess()
Constructor.
Collecting and (de)serializing system-wide statistics.
Abstract metrics collector.
Declarations for MetricsProcess.
Logging routines and macros.
void refresh()
Refreshes the statistics.
Compatibility Macros for C/C++.
Time related declarations.
struct ProcStat proc_stat
Process statistics (CPU user time, system time, vm size etc)
Collects, serializes and deserializes system-wide statistics.
void collect(int64_t now, MetricsCollector *collector) override
Collects process metrics.
virtual void update(const std::string &name, const std::string &value)=0
Updates string metric value.
const char * version_string()
int64_t get_ts64()
Returns the current time in nanoseconds as a 64bit number.