From bba945b3b967f1095388bf030196dba46d6a110f Mon Sep 17 00:00:00 2001 From: Nikita Zlobin Date: Mon, 30 Nov 2020 13:00:21 +0500 Subject: [PATCH] Enhanced example for memory usage executor, sync for all docs It seems, html help already had one free instance with -s option for persistance, though still used inner non-persistant chain for humanized output. --- doc/tint2.1 | 7 ++++--- doc/tint2.html | 5 +++-- doc/tint2.md | 7 ++++--- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/doc/tint2.1 b/doc/tint2.1 index 040c2be..c985bca 100644 --- a/doc/tint2.1 +++ b/doc/tint2.1 @@ -831,10 +831,11 @@ execp_markup = 1 .PP .RS .nf +# "stdbuf -oL" noticed to give better performance than fflush() from awk code execp = new -execp_command = free | awk '/^\-/ { printf "Mem: '$(free \-h | awk '/^Mem:/ { print $2 }')' %.0f%%\\n", 100*$3/($3+$4); fflush(stdout) }' -execp_interval = 5 -execp_continuous = 0 +execp_command = free -b -s1 | stdbuf -oL awk '/^Mem:/ { printf "Mem: %.1fGi %.0f%%\n", $2 / (2^30), 100 * ($2 - $7) / $2 }' +execp_interval = 1 +execp_continuous = 1 .fi .RE .SS Network load diff --git a/doc/tint2.html b/doc/tint2.html index 033dc77..7266ab0 100644 --- a/doc/tint2.html +++ b/doc/tint2.html @@ -372,8 +372,9 @@ execp_continuous = 1 execp_interval = 1 execp_markup = 1 -
Memory usage
execp = new
-execp_command = free -s 2 | awk '/^-/ { printf "Mem: '$(free -h | awk '/^Mem:/ { print $2 }')' %.0f%\n", 100*$3/($3+$4); fflush(stdout) }'
+
Memory usage
# "stdbuf -oL" noticed to give better performance than fflush() from awk code
+execp = new
+execp_command = free -b -s1 | stdbuf -oL awk '/^Mem:/ { printf "Mem: %.1fGi %.0f%%\n", $2 / (2^30), 100 * ($2 - $7) / $2 }'
 execp_interval = 1
 execp_continuous = 1
 
diff --git a/doc/tint2.md b/doc/tint2.md index 313f815..5b6b1b9 100644 --- a/doc/tint2.md +++ b/doc/tint2.md @@ -694,10 +694,11 @@ execp_markup = 1 ##### Memory usage ``` +# "stdbuf -oL" noticed to give better performance than fflush() from awk code execp = new -execp_command = free | awk '/^-/ { printf "Mem: '$(free -h | awk '/^Mem:/ { print $2 }')' %.0f%%\n", 100*$3/($3+$4); fflush(stdout) }' -execp_interval = 5 -execp_continuous = 0 +execp_command = free -b -s1 | stdbuf -oL awk '/^Mem:/ { printf "Mem: %.1fGi %.0f%%\n", $2 / (2^30), 100 * ($2 - $7) / $2 }' +execp_interval = 1 +execp_continuous = 1 ``` ##### Network load