PS를 통한 리소스 점유 순위별 프로세스 Sort

System Story/CentOS 5,6 2013.11.10 18:16
1. CPU 점유순으로 소트

 

[root@TEST01 ~]# ps -eo user,pid,ppid,rss,size,vsize,pmem,pcpu,time,comm --sort -pcpu | head -10
USER PID PPID RSS SZ VSZ %MEM %CPU TIME COMMAND
cloud 9873 1 9031888 13420612 13530848 26.9 0.0 00:00:00 java
cloud 9873 1 9031888 13420612 13530848 26.9 0.0 00:00:08 java
cloud 9873 1 9031888 13420612 13530848 26.9 0.7 00:15:19 java
cloud 9873 1 9031888 13420612 13530848 26.9 0.7 00:15:20 java
cloud 9873 1 9031888 13420612 13530848 26.9 0.7 00:15:20 java
cloud 9873 1 9031888 13420612 13530848 26.9 0.7 00:15:18 java
cloud 9873 1 9031888 13420612 13530848 26.9 0.7 00:15:20 java
cloud 9873 1 9031888 13420612 13530848 26.9 0.7 00:15:21 java
cloud 9873 1 9031888 13420612 13530848 26.9 0.7 00:15:22 java
[root@TEST01 ~]#  

 

 

2. 물리 메모리 점유율 기준으로 소트

 

[root@TEST01 ~]#

[root@TEST01 ~]# ps -eo user,pid,ppid,rss,size,vsize,pmem,pcpu,time,comm --sort -rss | head -n 10 | awk '{print $1"\t"$2"\t"$3"\t"$4"\t"$5"\t"$6"\t"$7"\t"$8"\t"$9"\t"$10"\t"}'
USER PID PPID RSS SZ VSZ %MEM %CPU TIME COMMAND
root 1543 1 32792 31028 38936 6.4 0.0 00:00:00 iscsiuio
mysql 3627 3577 22860 129784 188808 4.4 0.0 00:00:39 mysqld
root 2424 1 17948 15372 261028 3.5 0.0 00:00:11 yum-updatesd
root 1907 1 12460 10868 16556 2.4 0.0 00:00:04 mdmpd
root 2146 1 8008 14568 158552 1.5 0.0 00:00:11 snmpd
68 2037 1 3968 2372 30912 0.7 0.0 00:00:27 hald
root 1445 1 3708 692 22132 0.7 0.0 00:00:00 multipathd
root 4205 2178 3336 812 90156 0.6 0.0 00:00:00 sshd
root 1550 1 3048 856 5096 0.5 0.0 00:00:00 iscsid
[root@TEST01 ~]#
[root@TEST01 ~]#

 

 

3. swap 점유순 소트

 

[root@TEST01 ~]#
[root@TEST01 ~]# ps -eo user,pid,ppid,rss,size,vsize,pmem,pcpu,time,comm --sort -size | head -n 10
USER PID PPID RSS SZ VSZ %MEM %CPU TIME COMMAND
mysql 3627 3577 22860 129784 188808 4.4 0.0 00:00:39 mysqld
root 1543 1 32792 31028 38936 6.4 0.0 00:00:00 iscsiuio
root 2424 1 17948 15372 261028 3.5 0.0 00:00:11 yum-updatesd
root 2146 1 8008 14568 158552 1.5 0.0 00:00:11 snmpd
root 1907 1 12460 10868 16556 2.4 0.0 00:00:04 mdmpd
root 1753 1 776 10548 27344 0.1 0.0 00:00:00 auditd
root 1755 1753 740 10528 16284 0.1 0.0 00:00:00 audispd
root 2160 1 2824 2464 143776 0.5 0.0 00:00:01 snmptrapd
68 2037 1 3968 2372 30912 0.7 0.0 00:00:27 hald
[root@TEST01 ~]#
[root@TEST01 ~]#
[root@TEST01 ~]#  

 

 

4. Thread 단위 CPU 점유량 확인

 

[root@TEST01 ~]#
[root@TEST01 ~]# ps -mo user,lwp,pcpu,rss,comm -C java
USER       LWP %CPU   RSS COMMAND
tomcat       - 48.8 110388 java
tomcat    4563  0.0     - -
tomcat    4565 24.8     - -
tomcat    4566  0.0     - -
tomcat    4567  0.0     - -
tomcat    4568  0.0     - -
tomcat    4569  0.0     - -
tomcat    4570 12.5     - -
tomcat    4571 15.5     - -
tomcat    4572  0.0     - -
tomcat    4573  0.0     - -
tomcat    4578  0.0     - -
tomcat    4579  0.0     - -
tomcat    4580  0.0     - -
tomcat    4581  0.0     - -
tomcat    4582  0.0     - -
tomcat    4583  0.0     - -
tomcat    4584  0.0     - -
tomcat    4585  0.0     - -
tomcat    4586  0.0     - -

 

... 중략

 

 

 

 

Trackbacks 0 : Comments 0

Write a comment