Closed garymm closed 6 years ago
Can you describe your pc configuration? How many cores do you have on your cpu?
Can you also give me the output of iostat - c 1 2?
$ iostat -c 1 2
Linux 4.9.0-5-amd64 (<hostname>) 01/10/2018 _x86_64_ (12 CPU)
avg-cpu: %user %nice %system %iowait %steal %idle
0.64 0.10 0.43 0.03 0.00 98.81
avg-cpu: %user %nice %system %iowait %steal %idle
0.42 0.00 1.08 0.08 0.00 98.42
As the output shows, the machine has 12 CPU cores.
Ok I reproduce the issue I will try to work on it
OK so I reproduce your behavior with
$ iostat -c 1 2 | grep -v % | head -n 1 | awk '{usage=100-$NF} END {printf("%5.1f%%", usage)}' | sed 's/,/./'
but this is not the command used in cpu_percentage.sh
iostat -c 1 2 | tail -n 2 | head -n 1 | awk '{usage=100-$NF} END {printf("%5.1f%%", usage)}' | sed 's/,/./'
Are you sure to have the latest version of tmux-cpu ?
Not sure exactly how to check what version I have, but I did run <prefix> + I
and git status:
$ cd .tmux/plugins/tmux-cpu
$ git status
On branch master
Your branch is up to date with 'origin/master'.
The command in cpu_percentage.sh that I see both locally and in github is the same:
iostat -c 1 2 | tail -n 2 | head -n 1 | awk '{usage=100-$NF} END {printf("%5.1f%%", usage)}' | sed 's/,/./'
And it always returns 100%%
Note the command we're looking at is under the is_linux_iostat
branch.
Do you have better result with
$ iostat -c 1 2 | sed '/^\s*$/d' | tail -n 1 | awk '{usage=100-$NF} END {printf("%5.1f%%", usage)}' | sed 's/,/./'
? Can you also give me your iostat version? Thanks
Do you have better result with
Yes, that seems to work.
Can you also give me your iostat version?
See first comment (11.6.0)
@ricelid I have update master accordingly. Thanks for the report
The script fails to parse the iostat output and always returns 100%:
I'm running Linux, Debian 4.9.65
I'm working around this for the moment by just using the sar command from the script.