mirror of
https://github.com/tmux-plugins/tmux-cpu.git
synced 2026-09-10 07:16:16 -04:00
Adds MacOS-specfic ps aux command.
Potentially closes https://github.com/tmux-plugins/tmux-cpu/issues/89
This commit is contained in:
parent
98d787191b
commit
88fbb1f21f
|
|
@ -28,6 +28,11 @@ print_cpu_percentage() {
|
|||
usage="$(cached_eval WMIC cpu get LoadPercentage | grep -Eo '^[0-9]+')"
|
||||
# shellcheck disable=SC2059
|
||||
printf "$cpu_percentage_format" "$usage"
|
||||
else
|
||||
if is_osx; then
|
||||
load=$(cached_eval ps aux | awk '{print $3}' | tail -n+2 | awk '{s+=$1} END {print s}')
|
||||
cpus=$(cpus_number)
|
||||
echo "$load $cpus" | awk -v format="$cpu_percentage_format" '{printf format, $1/$2}'
|
||||
else
|
||||
load=$(cached_eval ps -aux | awk '{print $3}' | tail -n+2 | awk '{s+=$1} END {print s}')
|
||||
cpus=$(cpus_number)
|
||||
|
|
|
|||
Loading…
Reference in a new issue