tmux-plugins / tmux-cpu

Plug and play cpu percentage and icon indicator for Tmux.
MIT License
426 stars 65 forks source link

Incorrect CPU usage if more disk installed #13

Closed kcwu closed 8 years ago

kcwu commented 8 years ago

I'm using FreeBSD and have more than one disk installed. My iostat output is

      tty            ada0             ada1             ada2             cpu
 tin  tout  KB/t tps  MB/s   KB/t tps  MB/s   KB/t tps  MB/s  us ni sy in id
   0  1692  5.00   5  0.02   0.00   0  0.00   0.00   0  0.00  26  0  2  1 71

Following is correct command to get cpu usage. I guess the command of other platforms may need to fix as well.

iostat -c 2 | tail -n 1  | awk '{usage=100-$NF} END {printf("%5.1f%%", usage)}'
ctjhoa commented 8 years ago

@kcwu Thanks for the report.