From 1a5bf0366ac5d27931bd6eaf80e4bf99b55b43ce Mon Sep 17 00:00:00 2001 From: reinelt <> Date: Tue, 20 Jan 2004 12:45:47 +0000 Subject: [lcd4linux @ 2004-01-20 12:45:47 by reinelt] "Default screen" working with MatrixOrbital --- plugin_proc_stat.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'plugin_proc_stat.c') diff --git a/plugin_proc_stat.c b/plugin_proc_stat.c index 3857995..52c0ad6 100644 --- a/plugin_proc_stat.c +++ b/plugin_proc_stat.c @@ -1,4 +1,4 @@ -/* $Id: plugin_proc_stat.c,v 1.5 2004/01/18 09:01:45 reinelt Exp $ +/* $Id: plugin_proc_stat.c,v 1.6 2004/01/20 12:45:47 reinelt Exp $ * * plugin for /proc/stat parsing * @@ -23,6 +23,9 @@ * * * $Log: plugin_proc_stat.c,v $ + * Revision 1.6 2004/01/20 12:45:47 reinelt + * "Default screen" working with MatrixOrbital + * * Revision 1.5 2004/01/18 09:01:45 reinelt * /proc/stat parsing finished * @@ -248,8 +251,11 @@ static void my_cpu (RESULT *result, RESULT *arg1, RESULT *arg2) else if (strcasecmp(key, "idle" )==0) value=cpu_idle; else if (strcasecmp(key, "busy" )==0) value=cpu_total-cpu_idle; - value = 100*value/cpu_total; - + if (cpu_total>0.0) + value = 100*value/cpu_total; + else + value=0.0; + SetResult(&result, R_NUMBER, &value); } -- cgit v1.2.3