fixed small prob with memory stuff being wrong
authorBrenden Matthews <brenden1@rty.ca>
Fri, 11 Nov 2005 05:28:20 +0000 (05:28 +0000)
committerBrenden Matthews <brenden1@rty.ca>
Fri, 11 Nov 2005 05:28:20 +0000 (05:28 +0000)
git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky@391 7f574dfc-610e-0410-a909-a81674777703

src/common.c
src/linux.c
src/top.c

index 1012b47..a7d9114 100644 (file)
@@ -230,11 +230,12 @@ void update_stuff()
                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;
        }
 
index fb2fc70..fb57fe7 100644 (file)
@@ -122,12 +122,16 @@ void update_meminfo()
                        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);
 }
 
index 7899671..47db8b4 100644 (file)
--- a/src/top.c
+++ b/src/top.c
@@ -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.            */
 /* 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 */
        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) {