티스토리 뷰

카테고리 없음

Linux CPU 사용량

nalbam 2017. 5. 26. 10:50

cpu 전체값 = (user모드 + nice user 모드 + system 모드 + idle 상태)

user 모드 사용율 = (user모드 / cpu 전체값) * 100

user 모드 사용율 = (user 모드 * 100) / cpu 전체값


[ec2-user@toast-019 ~]$ grep 'cpu ' /proc/stat

cpu  1291418 1501 335382 927676464 130888 0 16998 42896 0 0


[ec2-user@toast-019 ~]$ grep 'cpu ' /proc/stat | awk '{usage=($2+$4)*100/($2+$4+$5)} END {print usage}'

0.175057


[ec2-user@toast-019 ~]$ top -b -n 1 | grep ^Cpu

Cpu(s):  0.1%us,  0.0%sy,  0.0%ni, 99.8%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st

댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
«   2024/04   »
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30
글 보관함