On a system, where mawk is the default awk instead of gawk (for example, Raspbian Stretch), the following will fail to give any output until all the samples are produced. For default settings, this will cause a delay of 60x10 seconds between CPU usage updates.
|
vmstat -n "$refresh_interval" "$samples_count" \ |
|
| stdbuf -o0 awk 'NR>2 {print 100-$(NF-2)}' |
I propose two solutions:
- Replace
awk with /usr/bin/gawk everywhere in the code and list gawk as a dependency.
- Adapt the code so that
stdbuf and mawk can produce streaming output.
On a system, where
mawkis the defaultawkinstead ofgawk(for example, Raspbian Stretch), the following will fail to give any output until all the samples are produced. For default settings, this will cause a delay of 60x10 seconds between CPU usage updates.tmux-plugin-sysstat/scripts/cpu_collect.sh
Lines 30 to 31 in 29e150f
I propose two solutions:
awkwith/usr/bin/gawkeverywhere in the code and listgawkas a dependency.stdbufandmawkcan produce streaming output.