[Sysfence-commit] sysfence getstats.c,1.8,1.9
Status: Alpha
Brought to you by:
emes
|
From: mkoperto <mko...@us...> - 2004-05-20 14:36:26
|
Update of /cvsroot/sysfence/sysfence In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22913/sysfence Modified Files: getstats.c Log Message: + stat_init (...) Index: getstats.c =================================================================== RCS file: /cvsroot/sysfence/sysfence/getstats.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- getstats.c 18 Apr 2004 17:25:36 -0000 1.8 +++ getstats.c 20 May 2004 14:36:12 -0000 1.9 @@ -20,19 +20,9 @@ #include <stdlib.h> #include <unistd.h> #include <fcntl.h> -#include <strings.h> +#include <string.h> #include <sys/vfs.h> -statval stat [STA_LAST] = { - [STA_LA1] = { "la1", DOUBLE, {0} }, - [STA_LA5] = { "la5", DOUBLE, {0} }, - [STA_LA15] = { "la15", DOUBLE, {0} }, - [STA_MFREE] = { "memfree", SIZE, {0} }, - [STA_MUSED] = { "memused", SIZE, {0} }, - [STA_SFREE] = { "swapfree", SIZE, {0} }, - [STA_SUSED] = { "swapused", SIZE, {0} } -}; - const char *lafile = "/proc/loadavg"; int lafha; const char *memfile = "/proc/meminfo"; @@ -41,6 +31,18 @@ char fbuf[ BUFSIZE ]; +void stat_init (statval *stat) +{ + strcpy (stat[STA_LA1].label, "la1"); stat[STA_LA1].type = DOUBLE; stat[STA_LA1].val.dbl = 0.0; + strcpy (stat[STA_LA5].label, "la5"); stat[STA_LA5].type = DOUBLE; stat[STA_LA5].val.dbl = 0.0; + strcpy (stat[STA_LA15].label, "la15"); stat[STA_LA15].type = DOUBLE; stat[STA_LA15].val.dbl = 0.0; + + strcpy (stat[STA_MFREE].label, "memfree"); stat[STA_MFREE].type = SIZE; stat[STA_MFREE].val.siz = 0; + strcpy (stat[STA_MUSED].label, "memused"); stat[STA_MUSED].type = SIZE; stat[STA_MUSED].val.siz = 0; + strcpy (stat[STA_SFREE].label, "swapfree"); stat[STA_SFREE].type = SIZE; stat[STA_SFREE].val.siz = 0; + strcpy (stat[STA_SUSED].label, "swapused"); stat[STA_SUSED].type = SIZE; stat[STA_SUSED].val.siz = 0; +} + void fetch_la () { char *one, *two, *three; |