dotfiles/dot_config/tmux/plugins/executable_cpu_perc

12 lines
277 B
Plaintext
Raw Normal View History

2021-06-16 17:14:48 -04:00
#!/bin/bash
2021-06-17 17:21:38 -04:00
this_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
source "$this_dir/common"
2021-06-16 17:14:48 -04:00
get_cpu(){
grep 'cpu ' /proc/stat | \
awk '{a=($2+$4)}; {t=($2+$4+$5)} END {printf("%s %s", a, t)}'
}
2021-06-17 17:21:38 -04:00
cached_eval "cpu_perc" $(get_cpu) | fmt_percent