mirror of
https://github.com/tmux-plugins/tmux-cpu.git
synced 2026-09-10 07:16:16 -04:00
fix: freebsd compatibility
This commit is contained in:
parent
bcb110d754
commit
8cf4f2a477
|
|
@ -17,7 +17,7 @@ print_cpu_percentage() {
|
|||
elif is_osx; then
|
||||
cached_eval iostat -c 2 disk0 | sed '/^\s*$/d' | tail -n 1 | awk -v format="$cpu_percentage_format" '{usage=100-$6} END {printf(format, usage)}' | sed 's/,/./'
|
||||
elif is_freebsd || is_openbsd; then
|
||||
cached_eval iostat -c 2 | sed '/^\s*$/d' | tail -n 1 | awk -v format="$cpu_percentage_format" '{usage=100-$NF} END {printf(format, usage)}' | sed 's/,/./'
|
||||
cached_eval iostat -c 2 | sed '/^[[:space:]]*$/d' | tail -n 1 | awk -v format="$cpu_percentage_format" '{usage=100-$NF} END {printf(format, usage)}' | sed 's/,/./'
|
||||
else
|
||||
echo "Unknown iostat version please create an issue"
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -17,6 +17,8 @@ print_ram_percentage() {
|
|||
|
||||
if command_exists "free"; then
|
||||
cached_eval free | awk -v format="$ram_percentage_format" '$1 ~ /Mem/ {printf(format, 100*$3/$2)}'
|
||||
elif command_exists "freecolor"; then # freebsd: install freecolor first: $ pkg install freecolor
|
||||
cached_eval freecolor -m -o | awk -v format="$ram_percentage_format" '$1 ~ /Mem/ {printf(format, 100*$3/$2)}'
|
||||
elif command_exists "vm_stat"; then
|
||||
# page size of 4096 bytes
|
||||
stats="$(cached_eval vm_stat)"
|
||||
|
|
|
|||
Loading…
Reference in a new issue