{
char buf[1024], word[1024];
int free = 0, buffered = 0, cache = 0, active = 0, inactive = 0,
- swapfree = 0, anon = 0, slab = 0, tables = 0;
+ swapfree = 0, anon = 0, slab = 0, tables = 0, swaptotal = 0;
FILE *file = fopen(MEMFILE, "r");
if (file == NULL) {
slab = dec_to_int(buf, 0);
} else if (!strcmp(word, "PageTables:")) {
tables = dec_to_int(buf, 0);
+ } else if (!strcmp(word, "SwapTotal:")) {
+ swaptotal = dec_to_int(buf, 0);
}
}
fclose(file);
- sprintf(data, "%f:%f:%f:%f:%f:%f:%f:%f:%f",
+ sprintf(data, "%f:%f:%f:%f:%f:%f:%f:%f:%f:%f",
free / 1024.0,
buffered / 1024.0,
cache / 1024.0,
swapfree / 1024.0,
anon / 1024.0,
slab / 1024.0,
- tables / 1024.0);
+ tables / 1024.0,
+ (swaptotal - swapfree) / 1024.0);
return 0;
}