From 705d6519513456426b01e6efae9e999cb7349443 Mon Sep 17 00:00:00 2001 From: HiGarfield Date: Fri, 6 Dec 2024 02:47:09 +0800 Subject: [PATCH] Rename variables --- src/process_iterator_linux.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/process_iterator_linux.c b/src/process_iterator_linux.c index c138f29..2de823a 100644 --- a/src/process_iterator_linux.c +++ b/src/process_iterator_linux.c @@ -66,7 +66,7 @@ int init_process_iterator(struct process_iterator *it, struct process_filter *fi static int read_process_info(pid_t pid, struct process *p) { char statfile[32], exefile[32], state; - double utime, stime; + double usertime, systime; long ppid; FILE *fd; static double sc_clk_tck = -1.0; @@ -93,7 +93,7 @@ static int read_process_info(pid_t pid, struct process *p) return -1; } if (fscanf(fd, "%*d (%*[^)]) %c %ld %*d %*d %*d %*d %*d %*d %*d %*d %*d %lf %lf", - &state, &ppid, &utime, &stime) != 4 || + &state, &ppid, &usertime, &systime) != 4 || strchr("ZXx", state) != NULL) { fclose(fd); @@ -105,7 +105,7 @@ static int read_process_info(pid_t pid, struct process *p) { sc_clk_tck = (double)sysconf(_SC_CLK_TCK); } - p->cputime = (utime + stime) * 1000.0 / sc_clk_tck; + p->cputime = (usertime + systime) * 1000.0 / sc_clk_tck; return 0; }