dotfiles/dot_config/tmux/plugins/executable_cpu_perc

12 lines
277 B
Bash

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