--- projects/libstatgrab/examples/vm_stats.c 2003/11/07 18:43:56 1.3 +++ projects/libstatgrab/examples/vm_stats.c 2003/11/23 13:51:10 1.4 @@ -24,10 +24,10 @@ #include int main(int argc, char **argv){ - + extern char *optarg; - extern int optind; - int c; + extern int optind; + int c; int delay = 1; mem_stat_t *mem_stats; @@ -36,13 +36,16 @@ int main(int argc, char **argv){ long long total, free; while ((c = getopt(argc, argv, "d:")) != -1){ - switch (c){ - case 'd': - delay = atoi(optarg); - break; + switch (c){ + case 'd': + delay = atoi(optarg); + break; } } + /* Initialise statgrab */ + statgrab_init(); + if( ((mem_stats=get_memory_stats()) != NULL) && (swap_stats=get_swap_stats()) != NULL){ printf("Total memory in bytes : %lld\n", mem_stats->total); printf("Used memory in bytes : %lld\n", mem_stats->used); @@ -61,6 +64,3 @@ int main(int argc, char **argv){ } exit(0); } - - -