update_load_average();
- if ((NEED(INFO_MEM) || NEED(INFO_BUFFERS)) &&
+ if ((NEED(INFO_MEM) || NEED(INFO_BUFFERS) || NEED(INFO_TOP)) &&
current_update_time - last_meminfo_update > 6.9) {
update_meminfo();
- if (no_buffers)
+ if (no_buffers) {
info.mem -= info.bufmem;
+ }
last_meminfo_update = current_update_time;
}
sscanf(buf, "%*s %lu", &info.cached);
}
}
-
+
info.mem = info.memmax - info.mem;
info.swap = info.swapmax - info.swap;
info.bufmem = info.cached + info.buffers;
+ /*if (no_buffers) {
+ info.mem -= info.bufmem;
+ }*/
+
info.mask |= (1 << INFO_MEM) | (1 << INFO_BUFFERS);
}
}
}
+// stole from common.c
+#define NEED(a) ((need_mask & (1 << a)) && ((info.mask & (1 << a)) == 0))
+
/* ****************************************************************** */
/* Get a sorted list of the top cpu hogs and top mem hogs. */
/* Results are stored in the cpu,mem arrays in decreasing order[0-9]. */
update_process_table(); /* update the table with process list */
calc_cpu_each(total); /* and then the percentage for each task */
process_cleanup(); /* cleanup list from exited processes */
- update_meminfo();
+
cur_proc = first_process;
while (cur_proc !=NULL) {