aboutsummaryrefslogtreecommitdiffstats
path: root/plugin_proc_stat.c
diff options
context:
space:
mode:
authorreinelt <>2004-01-18 06:54:08 +0000
committerreinelt <>2004-01-18 06:54:08 +0000
commit9fdad968332d4a70090cf813f0620e3c5d66a0ef (patch)
tree23ddd5db5bc45bbc05b514a1ae4bd53b94863572 /plugin_proc_stat.c
parent78edc6d12b0f0017cf88d8dca930ee2c41f99948 (diff)
downloadlcd4linux-9fdad968332d4a70090cf813f0620e3c5d66a0ef.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
Diffstat (limited to '')
-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:()");
}
}