1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
|
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 <gregoa@debian.org>
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;
|