Skip to content

Commit c57034d

Browse files
pavelmashpavel.mash
and
pavel.mash
authored
#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 <[email protected]>
1 parent a9f411f commit c57034d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

prom/src/prom_collector.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ prom_map_t *prom_collector_process_collect(prom_collector_t *self) {
222222
prom_process_stat_t *stat = prom_process_stat_new(stat_f);
223223

224224
// Set the metrics related to the stat file
225-
r = prom_gauge_set(prom_process_cpu_seconds_total, ((stat->cutime + stat->cstime) / 100), NULL);
225+
r = prom_gauge_set(prom_process_cpu_seconds_total, ((stat->utime + stat->stime) / sysconf(_SC_CLK_TCK)), NULL);
226226
if (r) {
227227
prom_process_limits_file_destroy(limits_f);
228228
prom_map_destroy(limits_map);

0 commit comments

Comments
 (0)