Sunday, May 6, 2012

java native memory info from jrockit vm



java native memory information:

Jrockit has nice command line tool to print jvm native memory information.

jrcmd 1234 print_memoryusage

Total mapped 3943472KB (reserved=2437436KB)
- Java heap 1572864KB (reserved=786432KB)
- GC tables 52620KB
- Thread stacks 35540KB (#threads=94)
- Compiled code 1048576KB (used=23184KB)
- Internal 1672KB
- OS 131024KB
- Other 863608KB
- Classblocks 12800KB (malloced=12534KB #33976)
- Java class data 223744KB (malloced=222859KB #156871 in 33976 classes)
- Native memory tracking 1024KB (malloced=166KB #10)

To display map ..

jrcmd 1234 print_memusage display_map=true

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
OS *java r x 0x0000000000400000.( 76KB)
OS *java rw 0x0000000000612000.( 4KB)
rw 0x000000001989d000.( 188052KB)
THREAD Stack 4160 rwx 0x0000000040041000 ( 8KB)
THREAD Stack 4160 0x0000000040043000 ( 12KB)
THREAD Stack 4160 rwx 0x0000000040046000.( 252KB)
THREAD Stack 4159 rwx 0x00000000402a9000 ( 8KB)
THREAD Stack 4159 0x00000000402ab000 ( 12KB)
THREAD Stack 4159 rwx 0x00000000402ae000 ( 252KB)
THREAD Stack 4162 rwx 0x00000000402ed000 ( 8KB)
THREAD Stack 4162 0x00000000402ef000 ( 12KB)
THREAD Stack 4162 rwx 0x00000000402f2000.( 252KB)
THREAD Stack 4200 rwx 0x0000000040634000 ( 8KB)
..
..

INT Poll r 0x000000007fffe000 ( 4KB)
INT Membar rw 0x000000007ffff000.( 4KB)
MSP Classblocks (1/2) rw 0x000000009f380000 ( 12288KB)
MSP Classblocks (2/2) rw 0x000000009ff80000 ( 512KB)
HEAP Java heap rw 0x00000000a0000000 ( 786432KB)
HEAP Java heap reserved 0x00000000d0000000.( 786432KB)
OS *ld-2.5.so r x 0x00000038e6800000.( 112KB)
OS *ld-2.5.so r 0x00000038e6a1b000 ( 4KB)
OS *ld-2.5.so rw 0x00000038e6a1c000.( 4KB)
OS *libc-2.5.so r x 0x00000038e6c00000 ( 1336KB)
OS *libc-2.5.so 0x00000038e6d4e000 ( 2044KB)
..
OS **libnsl-2.5.so rw 0x00000038eaa16000.( 8KB)
OS *libresolv-2.5.so r x 0x00000038ec400000 ( 68KB)
OS *libresolv-2.5.so 0x00000038ec411000 ( 2048KB)
OS *libresolv-2.5.so r 0x00000038ec611000 ( 4KB)
OS *libresolv-2.5.so rw 0x00000038ec612000 ( 4KB)
OS **libresolv-2.5.so rw 0x00000038ec613000.( 8KB)
MSP Native memory tracking (1/1) rw 0x00002aaaaaaad000 ( 1024KB)
OS *4098 rw 0x00002aaaaabad000.( 32KB)
OS *libnss_files-2.5.so r x 0x00002aaaaabbb000 ( 40KB)
OS *libnss_files-2.5.so 0x00002aaaaabc5000 ( 2044KB)
OS *libnss_files-2.5.so r 0x00002aaaaadc4000 ( 4KB)
OS *libnss_files-2.5.so rw 0x00002aaaaadc5000 ( 4KB)
OS *libjfr.so r x 0x00002aaaaadc6000 ( 48KB)
OS *libjfr.so 0x00002aaaaadd2000 ( 2048KB)
OS *libjfr.so rw 0x00002aaaaafd2000 ( 4KB)
OS **libjfr.so rw 0x00002aaaaafd3000 ( 12KB)
GC Object bits (committed) rw 0x00002aaaaafd6000 ( 12292KB)
GC Object bits (reserved) 0x00002aaaabbd7000 ( 12288KB)
GC Object bits (committed) rw 0x00002aaaac7d7000 ( 12292KB)
GC Object bits (reserved) 0x00002aaaad3d8000 ( 12288KB)
GC Card table rw 0x00002aaaadfd8000 ( 3072KB)
GC Modified Union Set (committed) rw 0x00002aaaae2d8000 ( 196KB)
GC Modified Union Set (reserved) 0x00002aaaae309000 ( 192KB)
MSP Java class data (59/59) rw 0x00002aaaae339000 ( 512KB)
CODE Compiled code rwx 0x00002aaaae3b9000 ( 64KB)
CODE Compiled code rwx 0x00002aaaae3c9000 ( 128KB)
CODE Reserved for code 0x00002aaaae3e9000 ( 64KB)
CODE Compiled code rwx 0x00002aaaae3f9000 ( 128KB)
..
...
MSP Java class data (47/59) rw 0x00002aaaf55a8000 ( 768KB)
rw 0x00002aaaf5668000 ( 10248KB)
MSP Java class data (46/59) rw 0x00002aaaf606a000 ( 1280KB)
rw 0x00002aaaf61aa000 ( 10248KB)
MSP Java class data (45/59) rw 0x00002aaaf6bac000 ( 256KB)

rw 0x00002b033a11e000 ( 8KB)
OS *libjvm.so r x 0x00002b033a120000 ( 3096KB)
OS *libjvm.so 0x00002b033a426000 ( 2044KB)
OS *libjvm.so rw 0x00002b033a625000 ( 188KB)
OS **libjvm.so rw 0x00002b033a654000 ( 684KB)
OS *libosal.so r x 0x00002b033a6ff000 ( 124KB)
OS *libosal.so 0x00002b033a71e000 ( 2044KB)
OS *libosal.so rw 0x00002b033a91d000 ( 8KB)
OS **libosal.so rw 0x00002b033a91f000 ( 4KB)
OS *libutil.so r x 0x00002b033a920000 ( 52KB)
OS *libutil.so 0x00002b033a92d000 ( 2044KB)
OS *libutil.so rw 0x00002b033ab2c000.( 4KB)
OS *[stack] rwx 0x00007fffe9bbc000 ( 80KB)
rw 0x00007fffe9bd0000.( 32KB)
OS *[vdso] 0xffffffffff600000 ( 8192KB)

Enable malloc tracing at command line:

java -tracemalloc -cp .. HelloWorld

Then you can see more detailed malloc trace info using following commands

jrcmd 1234 -print_memusage level=1
jrcmd 1234 -print_memusage level=2
jrcmd 1234 -print_memusage level=3












SQL tracing..


Enable trace:
SQL> ALTER SESSION SET sql_trace=TRUE;

Disable trace:
SQL> ALTER SESSION SET sql_trace=FALSE;


Example: Sort by elapsed time.

tkprof trcfile txt.out sort=prsela

More information check this link..
http://www.oracle-base.com/articles/10g/SQLTrace10046TrcsessAndTkprof10g.php