diff options
author | reinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f> | 2004-01-21 10:48:17 +0000 |
---|---|---|
committer | reinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f> | 2004-01-21 10:48:17 +0000 |
commit | 16a678004a5aa6afafddc55bda1d05bfb0e8db22 (patch) | |
tree | 69c46372045db8efe22c2b64c883de6bf40a1cfa /plugin_meminfo.c | |
parent | 83df846028ed3a272242276c1d94f86a6c7af2a7 (diff) | |
download | lcd4linux-16a678004a5aa6afafddc55bda1d05bfb0e8db22.tar.gz |
[lcd4linux @ 2004-01-21 10:48:17 by reinelt]
hash_age function added
git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@329 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
Diffstat (limited to 'plugin_meminfo.c')
-rw-r--r-- | plugin_meminfo.c | 18 |
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) { |