logo

English

이곳의 프로그래밍관련 정보와 소스는 마음대로 활용하셔도 좋습니다. 다만 쓰시기 전에 통보 정도는 해주시는 것이 예의 일것 같습니다. 질문이나 오류 수정은 siseong@gmail.com 으로 주세요. 감사합니다.

Solaris에서 pmap을 이용하여 백그라운드 프로세스 메모리 크기 구하기

by digipine posted Oct 29, 2017
?

Shortcut

PrevPrev Article

NextNext Article

Larger Font Smaller Font Up Down Go comment Print
?

Shortcut

PrevPrev Article

NextNext Article

Larger Font Smaller Font Up Down Go comment Print

Solaris에서 pmap을 이용하여 백그라운드 프로세스 메모리 크기 알아내는 방법입니다.
1.        메모리 사이즈를 알기 원하는 백그라운드 프로세스의 PID를 알아 냅니다.

% ps -ef |grep V815    (where V815 is the SID of the Oracle Database)

  oracle 12252     1  0 18:28:09 ?        0:00 ora_arc0_V815
  oracle 12250     1  0 18:28:09 ?        0:00 ora_snp0_V815
  oracle 12248     1  0 18:28:09 ?        0:00 ora_reco_V815
  oracle 12244     1  0 18:28:09 ?        2:49 ora_ckpt_V815
  oracle 12242     1  0 18:28:09 ?        0:00 ora_lgwr_V815
  oracle 12238     1  0 18:28:08 ?        0:00 ora_pmon_V815
  oracle 12246     1  0 18:28:09 ?        0:00 ora_smon_V815  <<<======
  oracle 12240     1  0 18:28:09 ?        0:00 ora_dbw0_V815
jhunter 12694 12619  0 07:51:00 pts/3    0:00 grep V815


2.        pmap 명령을 실행 하면서 알아낸 PID를 매개변수로 이용 합니다. (위의 예에서 smon을 대상으로 메모리를 알아 내려고 한다고 가정 하겠습니다.)

% /usr/proc/bin/pmap 12246  (12246 is the PID for the SMON process)


  12246:  ora_smon_V815
  00010000  22800K read/exec         /app/oracle/product/8.1.5/bin/oracle
  01662000    448K read/write/exec   /app/oracle/product/8.1.5/bin/oracle
  016D2000    112K read/write/exec     [ heap ]
  *******************************************************************************
  80000000 127672K read/write/exec/shared  [ shmid=0x193 ] **This is the size of the SGA
  *******************************************************************************
  EE140000     40K read/write/shared dev:32,96 ino:570352
  EE150000    120K read/write/shared dev:32,96 ino:570354
  EE180000   1040K read/write/shared dev:32,96 ino:570353
  EE2A0000     16K read/exec         /usr/platform/sun4u/lib/libc_psr.so.1
  EE2B0000     16K read/exec         /usr/lib/libmp.so.2
  EE2C2000      8K read/write/exec   /usr/lib/libmp.so.2
  EE2D0000     88K read/exec         /usr/lib/libm.so.1
  EE2F4000      8K read/write/exec   /usr/lib/libm.so.1
  EE300000    592K read/exec         /usr/lib/libc.so.1
  EE3A2000     32K read/write/exec   /usr/lib/libc.so.1
  EE3AA000      8K read/write/exec     [ anon ]
  EE3C0000      8K read/exec         /usr/lib/libkstat.so.1
  EE3D0000      8K read/write/exec   /usr/lib/libkstat.so.1
  EE3E0000     24K read/exec         /usr/lib/libposix4.so.1
  EE3F4000      8K read/write/exec   /usr/lib/libposix4.so.1
  EE400000  18472K read/exec         /app/oracle/product/8.1.5/lib/libjox8.so
  EF618000     80K read/write/exec   /app/oracle/product/8.1.5/lib/libjox8.so
  EF62C000      8K read/write/exec     [ anon ]
  EF640000     24K read/exec         /usr/lib/libaio.so.1
  EF654000     16K read/write/exec   /usr/lib/libaio.so.1
  EF660000      8K read/exec         /usr/lib/libsched.so.1
  EF670000      8K read/write/exec   /usr/lib/libsched.so.1
  EF680000    448K read/exec         /usr/lib/libnsl.so.1
  EF6FE000     40K read/write/exec   /usr/lib/libnsl.so.1
  EF708000     24K read/write/exec     [ anon ]
  EF720000      8K read/write/exec     [ anon ]
  EF730000      8K read/write/exec/shared   [ anon ]
  EF740000     32K read/exec         /usr/lib/libsocket.so.1
  EF756000      8K read/write/exec   /usr/lib/libsocket.so.1
  EF758000      8K read/write/exec     [ anon ]
  EF760000     32K read/exec         /app/oracle/product/8.1.5/lib/libdsbtsh8.so
  EF776000      8K read/write/exec   /app/oracle/product/8.1.5/lib/libdsbtsh8.so
  EF778000      8K read/write/exec     [ anon ]
  EF780000      8K read/exec         /app/oracle/product/8.1.5/lib/libskgxp8.so
  EF790000      8K read/write/exec   /app/oracle/product/8.1.5/lib/libskgxp8.so
  EF7A0000      8K read/exec         /usr/lib/libdl.so.1
  EF7B0000      8K read/write/exec     [ anon ]
  EF7C0000    120K read/exec         /usr/lib/ld.so.1
  EF7EC000      8K read/write/exec   /usr/lib/ld.so.1
  EFFFA000     24K read/write/exec     [ stack ]
   total   172472K


3.        세번째 할 일은 total size인 172472K에서 위에서 “shmid=”로 나타나는 값을 뺍니다. 즉 172472K – 127672K 한 값인 44800K가 SMON의 Process의 대략적인 메모리 사용량이 되는 것입니다.

 
TAG •

List of Articles
No. Subject Author Date Views
23 [C/C++] Random UUID String 생성 코드 digipine 2021.10.21 1302
22 소켓 통신을 이용한 HTTP 서버 개발 강의록 file digipine 2020.08.01 1482
21 C++ Atomic 클래스에 대해서 file 엉뚱도마뱀 2017.12.13 2139
20 C++ 컴파일 오류(error): variable 'std::istringstream sstream' has initializer but incomplete type digipine 2017.11.02 21077
19 fopen 파일 열기 모드 옵션 정리 digipine 2017.11.02 3894
18 make -j 옵션으로 컴파일 속도 최적화 하기 digipine 2017.11.01 2759
17 [Linux] Pthread 사용법, Thread 동기화 총정리 digipine 2017.11.01 294048
16 [linux] zlib build 방법 digipine 2017.11.01 1483
15 Linux C 언어로 Shell 명령어 실행하기 digipine 2017.11.01 22587
14 Introduce to Singly-linked List file digipine 2017.11.01 1288
13 [shared lib] so 동적 라이브러리 만들기와 사용법 - 리눅스 digipine 2017.11.01 6434
12 Unix C/C++ Input and Output Function Reference digipine 2017.11.01 88072
11 wchar_t에 대하여 digipine 2017.11.01 7343
10 C 에서 Overloading 구현 digipine 2017.11.01 1790
9 C를 이용한 객체지향 프로그래밍 digipine 2017.11.01 568
8 Callback in C++ 와 Delegate 차이점 digipine 2017.11.01 2525
» Solaris에서 pmap을 이용하여 백그라운드 프로세스 메모리 크기 구하기 digipine 2017.10.29 28598
6 Solaris 10에 개발 Tool (gcc,vim,gdb) 설치 digipine 2017.10.29 1257
5 brute-force 알고리즘을 이용한 패턴 위치 찾기 digipine 2017.10.29 1501
4 MD5 파일 변조 검사 관련 소스 (리눅스/Windows) digipine 2017.10.29 2613
Board Pagination Prev 1 2 Next
/ 2