1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-12-24 11:55:43 +00:00

fixed small prob with memory stuff being wrong

git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky@391 7f574dfc-610e-0410-a909-a81674777703
This commit is contained in:
Brenden Matthews 2005-11-11 05:28:20 +00:00
parent fbddeac24e
commit f827842abf
3 changed files with 12 additions and 4 deletions

View File

@ -230,11 +230,12 @@ void update_stuff()
update_load_average(); 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) { current_update_time - last_meminfo_update > 6.9) {
update_meminfo(); update_meminfo();
if (no_buffers) if (no_buffers) {
info.mem -= info.bufmem; info.mem -= info.bufmem;
}
last_meminfo_update = current_update_time; last_meminfo_update = current_update_time;
} }

View File

@ -122,12 +122,16 @@ void update_meminfo()
sscanf(buf, "%*s %lu", &info.cached); sscanf(buf, "%*s %lu", &info.cached);
} }
} }
info.mem = info.memmax - info.mem; info.mem = info.memmax - info.mem;
info.swap = info.swapmax - info.swap; info.swap = info.swapmax - info.swap;
info.bufmem = info.cached + info.buffers; info.bufmem = info.cached + info.buffers;
/*if (no_buffers) {
info.mem -= info.bufmem;
}*/
info.mask |= (1 << INFO_MEM) | (1 << INFO_BUFFERS); info.mask |= (1 << INFO_MEM) | (1 << INFO_BUFFERS);
} }

View File

@ -495,6 +495,9 @@ void sp_acopy(struct sorted_process *sp_head, struct process ** ar, int max_size
} }
} }
// 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. */ /* 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]. */ /* Results are stored in the cpu,mem arrays in decreasing order[0-9]. */
@ -513,7 +516,7 @@ inline void process_find_top(struct process **cpu, struct process **mem)
update_process_table(); /* update the table with process list */ update_process_table(); /* update the table with process list */
calc_cpu_each(total); /* and then the percentage for each task */ calc_cpu_each(total); /* and then the percentage for each task */
process_cleanup(); /* cleanup list from exited processes */ process_cleanup(); /* cleanup list from exited processes */
update_meminfo();
cur_proc = first_process; cur_proc = first_process;
while (cur_proc !=NULL) { while (cur_proc !=NULL) {