aboutsummaryrefslogtreecommitdiffstats
path: root/plugin_meminfo.c
diff options
context:
space:
mode:
authorreinelt <>2004-01-21 10:48:17 +0000
committerreinelt <>2004-01-21 10:48:17 +0000
commit25221f8a2f8be7d5a1d6c51af09d33872e9f3a5a (patch)
tree69c46372045db8efe22c2b64c883de6bf40a1cfa /plugin_meminfo.c
parent135e41deff385062b531a3fc11a9534edd7d29ee (diff)
downloadlcd4linux-25221f8a2f8be7d5a1d6c51af09d33872e9f3a5a.tar.gz
[lcd4linux @ 2004-01-21 10:48:17 by reinelt]
hash_age function added
Diffstat (limited to 'plugin_meminfo.c')
-rw-r--r--plugin_meminfo.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/plugin_meminfo.c b/plugin_meminfo.c
index ec8e611..b455f71 100644
--- a/plugin_meminfo.c
+++ b/plugin_meminfo.c
@@ -1,4 +1,4 @@
-/* $Id: plugin_meminfo.c,v 1.2 2004/01/16 07:26:25 reinelt Exp $
+/* $Id: plugin_meminfo.c,v 1.3 2004/01/21 10:48:17 reinelt Exp $
*
* plugin for /proc/meminfo parsing
*
@@ -23,6 +23,9 @@
*
*
* $Log: plugin_meminfo.c,v $
+ * Revision 1.3 2004/01/21 10:48:17 reinelt
+ * hash_age function added
+ *
* Revision 1.2 2004/01/16 07:26:25 reinelt
* moved various /proc parsing to own functions
* made some progress with /proc/stat parsing
@@ -49,7 +52,6 @@
#include <string.h>
#include <ctype.h>
#include <errno.h>
-#include <time.h>
#include "debug.h"
#include "plugin.h"
@@ -57,18 +59,18 @@
#include "hash.h"
-static HASH MemInfo = { 0, 0, NULL };
+static HASH MemInfo = { 0, };
static int parse_meminfo (void)
{
- static time_t now=0;
- FILE *stream;
+ int age;
int line;
+ FILE *stream;
- // reread every second only
- if (time(NULL)==now) return 0;
- time(&now);
+ // reread every 100 msec only
+ age=hash_age(&MemInfo, NULL, NULL);
+ if (age>0 && age<=100) return 0;
stream=fopen("/proc/meminfo", "r");
if (stream==NULL) {