From: Nikolas Garofil Date: Mon, 16 Nov 2009 15:59:41 +0000 (+0100) Subject: Use seconds instead of centiseconds as unit for $pid_time_kernelmode, $pid_time_userm... X-Git-Url: http://vcs.maemo.org/git/?a=commitdiff_plain;h=84d6095c4027ffa82dbe6107d82886d85af9994b;p=monky Use seconds instead of centiseconds as unit for $pid_time_kernelmode, $pid_time_usermode and $pid_time --- diff --git a/doc/variables.xml b/doc/variables.xml index a3372af..b4c8343 100644 --- a/doc/variables.xml +++ b/doc/variables.xml @@ -2681,7 +2681,7 @@ - Amount of time that the process has been scheduled in user mode + Amount of time that the process has been scheduled in user mode in seconds @@ -2691,7 +2691,7 @@ - Amount of time that the process has been scheduled in user mode + Amount of time that the process has been scheduled in user mode in seconds diff --git a/src/proc.c b/src/proc.c index ada0b46..7f64cdc 100644 --- a/src/proc.c +++ b/src/proc.c @@ -478,7 +478,7 @@ void print_pid_time_kernelmode(struct text_object *obj, char *p, int p_max_size) buf = readfile(obj->data.s, &bytes_read, 1); if(buf != NULL) { sscanf(buf, "%*d %*s %*c %*d %*d %*d %*d %*d %*u %*u %*u %*u %*u %lu", &umtime); - snprintf(p, p_max_size, "%lu", umtime); + snprintf(p, p_max_size, "%.2f", (float) umtime / 100); free(buf); } } @@ -494,7 +494,7 @@ void print_pid_time_usermode(struct text_object *obj, char *p, int p_max_size) { buf = readfile(obj->data.s, &bytes_read, 1); if(buf != NULL) { sscanf(buf, "%*d %*s %*c %*d %*d %*d %*d %*d %*u %*u %*u %*u %*u %*u %lu", &kmtime); - snprintf(p, p_max_size, "%lu", kmtime); + snprintf(p, p_max_size, "%.2f", (float) kmtime / 100); free(buf); } } @@ -510,7 +510,7 @@ void print_pid_time(struct text_object *obj, char *p, int p_max_size) { buf = readfile(obj->data.s, &bytes_read, 1); if(buf != NULL) { sscanf(buf, "%*d %*s %*c %*d %*d %*d %*d %*d %*u %*u %*u %*u %*u %lu %lu", &umtime, &kmtime); - snprintf(p, p_max_size, "%lu", umtime + kmtime); + snprintf(p, p_max_size, "%.2f", (float) (umtime + kmtime) / 100); free(buf); } }