본문 바로가기
보관용

[sh] mem_check.sh

by 크크다스 2014. 10. 22.
반응형

= 설명

ps -eo user,pid,ppid,rss,size,vsize,pmem,pcpu,time,comm --sort -rss | head -n 11

-------------------------------------------------------------------------------

USER       PID  PPID   RSS    SZ    VSZ %MEM %CPU     TIME COMMAND
firstpw   6762  6761 35504 33988  41356  0.4  0.1 00:01:27 bash
firstpw  13727     1 14392  8364  35252  0.1  0.0 00:00:05 gvim
firstpw  12667     1 12584  5724  32572  0.1  0.1 00:02:10 gvim
firstpw  13779     1  9888  3552  30400  0.1  0.0 00:00:01 gvim
firstpw  31653     1  9452  3776  30624  0.1  0.0 00:00:09 gvim
firstpw  18269     1  9296  3688  30524  0.1  0.0 00:00:00 gvim
firstpw  13734     1  8704  3628  30464  0.1  0.0 00:00:01 gvim
firstpw  24057     1  7960  3532  30368  0.0  0.0 00:00:00 gvim
root      3103  7389  3760   704  12020  0.0  0.0 00:00:01 sshd
root     17055  7389  3760   704  12020  0.0  0.0 00:00:01 sshd

VmSize:    41356 kB
VmRSS:     35504 kB
VmData:    33900 kB
Threads:        1

Tgid : Thread Group ID <Process ID> : 이값이 같은면 같은 프로세스의 다른 Thread이다. <참고> top -H -p <Tgid>

Pid: Thread ID

VmSize: VSZ

VmRSS: RSS

VmData: SZ


= Code

#!/bin/sh

CNT=1
while [ $CNT -le 100 ]; do
        date
        echo ----------------------------------------------------------------------------------
        ps
        echo ----------------------------------------------------------------------------------
        df -k
        echo ----------------------------------------------------------------------------------
        free
        echo ----------------------------------------------------------------------------------
        cat /proc/meminfo
        echo ----------------------------------------------------------------------------------
        egrep "^Tgid|^VmSize|^VmRSS|^VmData" /proc/*/status
        echo ===================================================================================
        sleep 10

  CNT=`expr $CNT + 1`


done

반응형

'보관용' 카테고리의 다른 글

[에디터] 1.에디트 플러스 2.아크로 3.크림슨  (0) 2014.10.22
[ps] Thread 분석  (0) 2014.10.22
[Script_sh] 기본 내용들  (0) 2014.10.22
[Process] Thread ID  (0) 2014.10.22
[Roaming] Cisco 설명  (0) 2014.10.21