aboutsummaryrefslogtreecommitdiffstats
path: root/plugin_proc_stat.c
diff options
context:
space:
mode:
authorreinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2004-01-18 06:54:08 +0000
committerreinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2004-01-18 06:54:08 +0000
commitbe7822ae1c0d3dd37cb371ec030defef0cb739ba (patch)
tree23ddd5db5bc45bbc05b514a1ae4bd53b94863572 /plugin_proc_stat.c
parentd672d4d499f0df79bc371b0ca9ca4a7f44477311 (diff)
downloadlcd4linux-be7822ae1c0d3dd37cb371ec030defef0cb739ba.tar.gz
[lcd4linux @ 2004-01-18 06:54:08 by reinelt]
bug in expr.c fixed (thanks to Xavier) some progress with /proc/stat parsing git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@318 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
Diffstat (limited to 'plugin_proc_stat.c')
-rw-r--r--plugin_proc_stat.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/plugin_proc_stat.c b/plugin_proc_stat.c
index 90ddd45..5c9f65e 100644
--- a/plugin_proc_stat.c
+++ b/plugin_proc_stat.c
@@ -1,4 +1,4 @@
-/* $Id: plugin_proc_stat.c,v 1.3 2004/01/16 11:12:26 reinelt Exp $
+/* $Id: plugin_proc_stat.c,v 1.4 2004/01/18 06:54:08 reinelt Exp $
*
* plugin for /proc/stat parsing
*
@@ -23,6 +23,10 @@
*
*
* $Log: plugin_proc_stat.c,v $
+ * Revision 1.4 2004/01/18 06:54:08 reinelt
+ * bug in expr.c fixed (thanks to Xavier)
+ * some progress with /proc/stat parsing
+ *
* Revision 1.3 2004/01/16 11:12:26 reinelt
* some bugs in plugin_xmms fixed, parsing moved to own function
* plugin_proc_stat nearly finished
@@ -85,6 +89,10 @@ static int renew(int msec)
static void hash_set1 (char *key1, char *val)
{
+ double number;
+
+ number=atof(val);
+
hash_set (&Stat, key1, val);
}
@@ -93,8 +101,7 @@ static void hash_set2 (char *key1, char *key2, char *val)
char key[32];
snprintf (key, sizeof(key), "%s.%s", key1, key2);
- // debug ("Michi: hash_set(%s, %s)", key, val);
- hash_set (&Stat, key, val);
+ hash_set1 (key, val);
}
static void hash_set3 (char *key1, char *key2, char *key3, char *val)
@@ -102,8 +109,7 @@ static void hash_set3 (char *key1, char *key2, char *key3, char *val)
char key[32];
snprintf (key, sizeof(key), "%s.%s.%s", key1, key2, key3);
- debug ("Michi: hash_set(%s)=<%s>", key, val);
- hash_set (&Stat, key, val);
+ hash_set1 (key, val);
}
@@ -114,7 +120,8 @@ static int parse_proc_stat (void)
// update every 10 msec
if (!renew(10)) return 0;
- stream=fopen("/proc/stat", "r");
+ // stream=fopen("/proc/stat", "r");
+ stream=fopen("proc_stat", "r");
if (stream==NULL) {
error ("fopen(/proc/stat) failed: %s", strerror(errno));
return -1;
@@ -161,7 +168,6 @@ static int parse_proc_stat (void)
hash_set3 ("disk_io", dev, "rblk", strtok(NULL, " ,"));
hash_set3 ("disk_io", dev, "wio", strtok(NULL, " ,"));
hash_set3 ("disk_io", dev, "wblk", strtok(NULL, " ,)"));
- // Fixme: check this one...
dev=strtok(NULL, " \t\n:()");
}
}