Description: Improvements for mb-applet-system-monitor's RAM display (#551305) mb-applet-system-monitor's memory part is not really useful; its assumptions about /proc/meminfo don't fit neither on my desktop machine nor on my openmoko (where I'm using it), and the calculations are also debatable. Author: gregor herrmann Last-Update: 2009-10-17 --- a/applets/mb-applet-system-monitor.c +++ b/applets/mb-applet-system-monitor.c @@ -55,9 +55,6 @@ /* memory data */ u_int64_t mem_used; u_int64_t mem_max; - u_int64_t swap_used; - u_int64_t swap_max; - unsigned int swap_percent; /* swap used, in percent */ unsigned int mem_percent; /* memory used, in percent */ } msd; @@ -132,7 +129,6 @@ cache_total, cache_free, cache_used, uneeded = 0; u_int64_t my_mem_used, my_mem_max; - u_int64_t my_swap_max; static int mem_delay = 0; FILE *mem; @@ -158,22 +154,25 @@ fscanf (mem, "%*s %Ld %*s", &mfree); fscanf (mem, "%*s %Ld %*s", &buffers); fscanf (mem, "%*s %Ld %*s", &cached); - fscanf (mem, "%*s %Ld %*s", &shared); - fscanf (mem, "%*s %Ld %*s", &used); + + fscanf (mem, "%*s %Ld %*s", &uneeded); + fscanf (mem, "%*s %Ld %*s", &uneeded); fscanf (mem, "%*s %Ld %*s", &uneeded); fscanf (mem, "%*s %Ld %*s", &uneeded); fscanf (mem, "%*s %Ld %*s", &uneeded); fscanf (mem, "%*s %Ld %*s", &uneeded); fscanf (mem, "%*s %Ld %*s", &uneeded); + fscanf (mem, "%*s %Ld %*s", &uneeded); + fscanf (mem, "%*s %Ld %*s", &uneeded); + fscanf (mem, "%*s %Ld %*s", &cache_total); fscanf (mem, "%*s %Ld %*s", &cache_free); total = total * 1024; mfree = mfree * 1024; + used = total - mfree; buffers = buffers * 1024; cached = cached * 1024; - used = used * 1024; - shared = shared * 1024; cache_total = cache_total * 1024; cache_used = cache_total - (cache_free * 1024); } @@ -192,8 +191,7 @@ mem_delay = 25; /* calculate it */ - my_mem_max = total; - my_swap_max = cache_total; + my_mem_max = cache_total + total; my_mem_used = cache_used + used - cached - buffers; msd.mem_used = my_mem_used; msd.mem_max = my_mem_max;