summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2017-01-30 16:11:27 +0100
committerRalf Baechle <ralf@linux-mips.org>2017-02-06 23:43:46 +0100
commit5b76d21caf636ec2cb88f036e39fd20fb414cb4f (patch)
tree8bead41e942ee6e2a3f0b9f7e69fcafef6235506
parentf1e670756f3c98a488b415e656692572a31baa91 (diff)
rsmemsiz: When parsing /proc/uptime, ignore idle time.
We don't use this information anyway later on. Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
-rw-r--r--rose/rsmemsiz.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/rose/rsmemsiz.c b/rose/rsmemsiz.c
index 96caca1..1d409ae 100644
--- a/rose/rsmemsiz.c
+++ b/rose/rsmemsiz.c
@@ -50,17 +50,16 @@ static char buf[300];
#define SET_IF_DESIRED(x,y) if (x) *(x) = (y) /* evals 'x' twice */
-static int uptime(double *uptime_secs, double *idle_secs)
+static int uptime(double *uptime_secs)
{
- double up=0, idle=0;
+ double up=0;
FILE_TO_BUF(PROC_UPTIME_FILE)
- if (sscanf(buf, "%lf %lf", &up, &idle) < 2) {
+ if (sscanf(buf, "%lf %*f", &up) < 1) {
fprintf(stdout, "ERROR: Bad data in %s\r", PROC_UPTIME_FILE);
return 0;
}
SET_IF_DESIRED(uptime_secs, up);
- SET_IF_DESIRED(idle_secs, idle);
return up; /* assume never be zero seconds in practice */
}
@@ -118,7 +117,7 @@ static unsigned **meminfo(void)
int main(int argc, char **argv)
{
int upminutes, uphours, updays;
- double uptime_secs, idle_secs;
+ double uptime_secs;
double av[3];
unsigned **mem;
char *p;
@@ -141,7 +140,7 @@ int main(int argc, char **argv)
}
/* read and calculate the amount of uptime and format it nicely */
- uptime(&uptime_secs, &idle_secs);
+ uptime(&uptime_secs);
updays = (int) uptime_secs / (60*60*24);
upminutes = (int) uptime_secs / 60;
uphours = upminutes / 60;