From c57034d196582d99267d027abb52a05a55dc07f6 Mon Sep 17 00:00:00 2001 From: pavelmash <7467039+pavelmash@users.noreply.github.com> Date: Fri, 18 Dec 2020 12:30:47 +0200 Subject: [PATCH] #41 - process_cpu_seconds_total by utime + stime (#45) * Using utime + stime and _SC_CLK_TCK for process_cpu_seconds_total Co-authored-by: pavel.mash --- prom/src/prom_collector.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/prom/src/prom_collector.c b/prom/src/prom_collector.c index a72a6a7..dce3bb4 100644 --- a/prom/src/prom_collector.c +++ b/prom/src/prom_collector.c @@ -222,7 +222,7 @@ prom_map_t *prom_collector_process_collect(prom_collector_t *self) { prom_process_stat_t *stat = prom_process_stat_new(stat_f); // Set the metrics related to the stat file - r = prom_gauge_set(prom_process_cpu_seconds_total, ((stat->cutime + stat->cstime) / 100), NULL); + r = prom_gauge_set(prom_process_cpu_seconds_total, ((stat->utime + stat->stime) / sysconf(_SC_CLK_TCK)), NULL); if (r) { prom_process_limits_file_destroy(limits_f); prom_map_destroy(limits_map);