[Pkg-wmaker-commits] [wmmon] 08/38: wmmon: Add -b flag, etc

Doug Torrance dtorrance-guest at moszumanska.debian.org
Sat Aug 12 22:43:06 UTC 2017


This is an automated email from the git hooks/post-receive script.

dtorrance-guest pushed a commit to branch upstream
in repository wmmon.

commit 057b1c6c9a3857c196fbfd91b95bf4633bb8a900
Author: B. Kelly (wbk) <coydog at devio.us>
Date:   Sun Apr 1 23:25:30 2012 -0500

    wmmon: Add -b flag, etc
    
    Added -b flag to include buffers and cache in total memory usage.
    Added global show_buffers, -b parsing code, associated logic in
    update_stat_mem(), and usage information.
    
    wmmon.1
      Added -b documentation.
---
 wmmon/wmmon.1 |  6 ++++++
 wmmon/wmmon.c | 13 +++++++++++--
 2 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/wmmon/wmmon.1 b/wmmon/wmmon.1
index 39a5e04..dfae000 100644
--- a/wmmon/wmmon.1
+++ b/wmmon/wmmon.1
@@ -80,6 +80,12 @@ Start in disk I/O mode, which displays instantaneous disk usage and
 average disk load.
 
 .TP
+.BR \-b
+Include buffers and cache in memory usage calculations. The trend in
+recent years has been to not include this in memory load monitors, but it
+can be useful information.
+
+.TP
 .BR \-s
 Start in system information mode, which displays memory usage, swap usage,
 and uptime.
diff --git a/wmmon/wmmon.c b/wmmon/wmmon.c
index 254437e..77d1ac0 100644
--- a/wmmon/wmmon.c
+++ b/wmmon/wmmon.c
@@ -137,6 +137,8 @@
 int	stat_current = 0; /* now global */
 int	mode_cycling = 1; /* Allow mode-cycling */
 int	cpu_avg_max  = 0; /* CPU stress meter with average and max for SMP */
+int show_buffers = 0; /* wbk adding per Gentoo -b enhancement. */
+
 FILE	*fp_meminfo;
 FILE	*fp_stat;
 FILE	*fp_loadavg;
@@ -183,6 +185,9 @@ int main(int argc, char *argv[]) {
 			case 'i' :
 				stat_current = 1;
 				break;
+			case 'b' :
+				show_buffers = 1;
+				break;
 			case 's' :
 				stat_current = 2;
 				break;
@@ -457,7 +462,7 @@ void wmmon_routine(int argc, char **argv) {
 			j = j * 0.32;
 			if (j > 32) j = 32;
 			copyXPMArea(32, 64, j, 12, 28+64, 4);
-			/*---------------------           ------------------*/
+			/*--------------------- swap?     ------------------*/
 			j = stat_device[3].rt_idle;
 			if (j != 0) {
 				j = (stat_device[3].rt_stat * 100) / j;
@@ -724,7 +729,10 @@ void update_stat_mem(stat_dev *st, stat_dev *st2) {
 	 * calculate it from MemTotal - MemFree
 	 */
 	st->rt_stat = st->rt_idle - free;
-	st->rt_stat -= buffers+cached;
+
+	/* wbk -b flag (from Gentoo patchkit) */
+	if (!show_buffers)
+		st->rt_stat -= buffers+cached;
 	/* As with the amount of memory used, it's not recorded any more, so
 	 * we have to calculate it ourselves.
 	 */
@@ -1059,6 +1067,7 @@ void usage(char *name) {
 	printf("                       default if there is more than %d processors\n", MAX_CPU);
 	printf("  -i                   start in Disk I/O mode\n");
 	printf("  -s                   start in System Info mode\n");
+	printf("  -b                   include buffers and cache in memory usage\n");
 	printf("  -h                   display this help and exit\n");
 	printf("  -v                   output version information and exit\n");
 }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-wmaker/wmmon.git



More information about the Pkg-wmaker-commits mailing list