Commit graph

16 commits

Author SHA1 Message Date
Carlos R. Mafra bd0d7d1f67 wmmemload: Use MemAvailable from kernel > v3.14 to display memory usage
After the introduction of MemAvailable in the kernel v3.14 one can
estimate how much RAM memory is being "used" by how much it is left
before the system starts swapping.

That is the reason why I want to monitor memory usage, to know
how close the system is to swapping. Therefore I propose to
use MemAvailable to compute the percentage of "used" memory.
Theoretically, after this patch a 100% memory usage is a more
accurate description of "yeah, we need to swap from now on".

See https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=34e431b0ae398fc54ea69ff85ec700722c9da773
2019-01-12 22:05:06 +00:00
Carlos R. Mafra 774e4f769f wmmemload: call usleep() directly in main loop
The reason is the same as in the analogous patch for wmwifi
in commit 1e34ea7f980; it improves considerably the efficiency.

Keeping the 'interval' unchanged (set to 1 sec), with this change
the number of wakeups as measured by powertop goes from around 14 wakeups/sec
to around 2 wakeup/sec.
2019-01-12 21:22:15 +00:00
Doug Torrance 673a7d931f Remove .xvpics directories (gimp thumbnails). 2016-12-27 20:51:47 +00:00
Doug Torrance f094d448e2 wmmemload: Use sysctl for swap usage information in FreeBSD.
Use sysctl instead of kvm_getswapinfo() to read the swap usage information
in FreeBSD.  This removes the need for a dependency on libkvm and for a
setgid binary.

Based on the Debian patch [1].

[1] https://sources.debian.net/src/wmmemload/0.1.7-2/debian/patches/sysctl_swap.patch/
2015-04-07 08:52:22 +01:00
Doug Torrance 52b638616c wmmemload: Read memory correctly with Linux kernel version >= 3.14.
Beginning with Linux kernel version 3.14, a new MemAvailable line appears
in /proc/meminfo[1]. This caused wmmemload to look for Cached and Buffers one
line off of their correct location.  The problem was reported in [2].

[1] https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=34e431b0ae398fc54ea69ff85ec700722c9da773
[2] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=749216
2014-10-10 10:09:53 +01:00
Doug Torrance ea2cf286ef wmmemload: Consistent formatting.
Format the source so as to minimize warnings from checkpatch.pl in the
Window Maker source tree.
2014-10-10 10:09:53 +01:00
Doug Torrance 917d454f0d wmmemload: Add suggested parentheses.
Avoid the following compiler warning:
mem_linux.c: In function ‘mem_init’:
mem_linux.c:52:40: warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]
    if (version == 2 && patchlevel >= 5 && sublevel >= 1 || \
                                        ^
2014-10-10 10:09:53 +01:00
Doug Torrance b938743e0f wmmemload: Be consistent in signedness of percentages.
Avoid multiple compiler warnings such as the following:
main.c: In function ‘update’:
main.c:157:4: warning: pointer targets in passing argument 1 of ‘mem_getusage’ differ in signedness [-Wpointer-sign]
    mem_getusage(&mem_usage, &swap_usage, &mem_opts);
    ^
In file included from main.c:29:0:
mem.h:16:6: note: expected ‘int *’ but argument is of type ‘unsigned int *’
 void mem_getusage(int *per_mem, int *per_swap, const struct mem_options *opts);
      ^
2014-10-10 10:09:53 +01:00
Doug Torrance 580fb497e3 wmmemload: Remove unused variable.
Avoid the following compiler warning:
dockapp.c: In function ‘dockapp_open_window’:
dockapp.c:51:16: warning: variable ‘stat’ set but not used [-Wunused-but-set-variable]
     Status     stat;
                ^
2014-10-10 10:09:53 +01:00
Doug Torrance a473280ab9 wmmemload: Use sysctl to get memory usage in FreeBSD.
Previously, kvm_read was used to get the memory usage in FreeBSD.  However,
this has been deprecated in favor of sysctl.  This patch implements this
change.

Some work had previously been done in this direction, as could be seen in
the file src/mem_freebsd_sysctl.c.  Since this file is no longer needed, it
has been removed.

Additionally, some formatting has been done on the remaining older code for
a more consistent style.
2014-10-10 10:09:52 +01:00
Doug Torrance ba72863015 wmmemload: Fix FTBFS on the Hurd.
The following patch, by Svante Signell <svante.signell@gmail.com>, adds Hurd
support to wmmemload.

For more information, see:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=764356
2014-10-07 21:45:40 +01:00
Doug Torrance 612921ae43 Remove trailing whitespace. 2014-10-05 19:18:49 +01:00
Doug Torrance 32ce80ea45 wmmemload: Fix version check for kernel 3.0.
Based on the patch from Debian by Guillermo Indalecio Fernandez
<guillermobox@gmail.com>:
http://sources.debian.net/src/wmmemload/0.1.6-8/debian/patches/04-kernel30.patch/
2014-10-04 08:13:16 +01:00
Doug Torrance 892f62e139 wmmemload: Fix autotools warnings.
In particular, drop the arguments to AM_INIT_AUTOMAKE and merge CPPFLAGS into
AM_CPPFLAGS.
2014-10-04 08:13:15 +01:00
Doug Torrance b49510e3c0 wmmemload: Remove autotools-generated files. 2014-10-04 08:13:15 +01:00
Doug Torrance a15c2e2029 wmmemload: Add version 0.1.6 to repository.
Obtained from:
http://ftp.de.debian.org/debian/pool/main/w/wmmemload/wmmemload_0.1.6.orig.tar.gz
2014-10-04 08:13:15 +01:00