mirror of
https://github.com/tmux-plugins/tmux-cpu.git
synced 2026-09-10 07:16:16 -04:00
Merge pull request #7 from Wayneoween/master
use correct value if running on FreeBSD
This commit is contained in:
commit
dd190b1cc9
|
|
@ -10,8 +10,10 @@ print_cpu_percentage() {
|
|||
printf "%5.1f%%" $usage
|
||||
elif [ -e "/proc/stat" ]; then
|
||||
grep 'cpu ' /proc/stat | awk '{usage=($2+$4)*100/($2+$4+$5)} END {printf("%5.1f%", usage)}'
|
||||
elif [ is_osx ]; then
|
||||
elif is_osx; then
|
||||
iostat -w 1 -c 2 -n 1 | tail -1 | awk '{usage=100-$6} END {printf("%d%%",usage)}';
|
||||
elif is_freebsd; then
|
||||
iostat -w 1 -c 2 -n 1 | tail -1 | awk '{usage=100-$10} END {printf("%d%%",usage)}';
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,6 +13,10 @@ is_osx() {
|
|||
[ $(uname) == "Darwin" ]
|
||||
}
|
||||
|
||||
is_freebsd() {
|
||||
[ $(uname) == "FreeBSD" ]
|
||||
}
|
||||
|
||||
is_cygwin() {
|
||||
command -v WMIC > /dev/null
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue