Closed daenney closed 8 years ago
Going through the different steps:
16:56:57 ~ $ iostat -c 2 [0/0]
disk0 disk2 cpu load average
KB/t tps MB/s KB/t tps MB/s us sy id 1m 5m 15m
40.06 7 0.27 166.84 0 0.00 5 3 93 1.65 1.52 1.40
0.00 0 0.00 0.00 0 0.00 6 5 89 1.65 1.52 1.40
16:59:27 ~ $ iostat -c 2 | tail -n 1
0.00 0 0.00 0.00 0 0.00 5 5 90 1.51 1.49 1.39
16:59:38 ~ $ iostat -c 2 | tail -n 1 | tr -s ' ' ';'
;0.00;0;0.00;0.00;0;0.00;5;5;90;1.47;1.49;1.39
16:59:46 ~ $ iostat -c 2 | tail -n 1 | tr -s ' ' ';' | cut -d ';' -f 7
0.00
17:00:08 ~ $ iostat -c 2 | tail -n 1 | tr -s ' ' ';' | cut -d ';' -f 7 | awk '{usage=100-$1} END {printf("%5.1f%%", usage)}'
100.0%
It looks like the cut should be -f 10
to get CPU idle
@daenney it's because you have 2 disk and mine have one:
| => iostat -c 2
disk0 cpu load average
KB/t tps MB/s us sy id 1m 5m 15m
30.39 14 0.42 14 8 77 2.23 4.23 5.12
0.00 0 0.00 4 2 93 2.37 4.23 5.12
I will try to fix this.
@daenney could you give me the output of:
iostat -c 2 disk0
09:23:28 ~ $ iostat -c 2 disk0
disk0 cpu load average
KB/t tps MB/s us sy id 1m 5m 15m
40.10 7 0.27 5 3 93 1.22 1.23 1.41
13.00 4 0.05 9 4 87 1.22 1.23 1.41
Additional disks in OS X will start showing up for any mounted DMG, USB drive and so on.
OK, so this should be the fix.
iostat -c 2 disk0 | tail -n 1 | tr -s ' ' ';' | cut -d ';' -f 7 | awk '{usage=100-$1} END {printf("%5.1f%%", usage)}'
If it gave the right ouput, could you update your PR please.
Done :smile:.
@daenney Thanks!
The problem appears to be in
This always returns
100%
in my case even though looking at the activity monitor there's nothing eating this much CPU, I'm not even consuming a whole core.