Total Physical Memory
-
>prtdiag -v | grep Memory
-
Memory size: 8192 Megabytes
-
>prtconf | grep Memory
-
Memory size: 8192 Megabytes
Total Physical Memory
-
>vmstat 5 10
-
r b w swap free re mf pi po fr de sr vc vc vc vc in sy cs us sy id
-
0 0 0 14841224 772880 23 147 19 6 6 0 1 1 0 2 2 3775 2990 3820 2 2 96
-
1 0 0 20482808 4992304 3 3 0 0 0 0 0 1 0 0 0 527 474 482 13 0 87
-
0 0 0 20483192 5000272 1 5 0 3 3 0 0 0 0 0 1 583 645 606 13 1 86
-
0 0 0 20485848 5033400 0 0 0 0 0 0 0 0 0 0 0 528 463 492 13 1 86
-
0 0 0 20485848 5033344 0 0 0 0 0 0 0 0 0 0 1 514 469 475 13 0 87
-
0 0 0 20485848 5033288 0 0 0 0 0 0 0 0 0 0 2 513 450 476 13 0 87
-
0 0 0 20485848 5033288 0 0 0 0 0 0 0 1 0 0 0 516 468 476 13 0 87
-
0 0 0 20485848 5033240 0 0 0 0 0 0 0 0 0 0 0 510 451 467 13 0 87
-
0 0 0 20485848 5033184 0 0 0 0 0 0 0 0 0 0 0 518 468 475 13 0 87
-
0 0 0 20485848 5033128 0 0 0 0 0 0 0 0 0 0 0 523 456 474 13 1 86
Find Overall CPU Usages
* Use multiple processor stat tool ‘mpstat’
* Columns to note
– ‘usr’: percent user time
– ‘sys’: percent system time
– ‘idl’: percent idle time
* Example
-
# Generate 2 processor reports with 5 second interval
-
mpstat 5 2
-
CPU minf mjf xcal intr ithr csw icsw migr smtx srw syscl usr sys wt idl
-
0 14 0 42 35 18 48 0 1 8 0 139 1 0 0 99
-
1 7 0 27 87 55 65 0 1 8 0 92 0 1 0 99
Find CPU Usage by Processes
* Use process stat tool ‘prstat’
* Similar to Linux ‘top’ command
* Examples
-
# Sort by cpu usage (default)
-
prstat
-
# Sort by memory usage
-
prstat -s rss
-
# Sort by virtual memory usage
-
prstat -s size
-
# Sort by process execution time
-
prstat -s time
-
# Find top 5 processes
-
prstat -n 5
-
# Also print process numbers each user is using
-
prstat -a
-
# Follow a particular process id
-
prstat -p pid
-
# Follow threads of a particular process id
-
prstat -L -p pid
Find Paging Activities
* Use system activity report tool ‘sar’
* Examples
-
# Find top 3 paging activities with 5 second interval
-
sar -g 5 3
-
18:57:12 pgout/s ppgout/s pgfree/s pgscan/s %ufs_ipf
-
18:57:17 0.00 0.00 0.00 0.00 0.00
-
18:57:22 0.00 0.00 0.00 0.00 0.00
-
18:57:27 0.00 0.00 0.00 0.00 0.00
-
Average 0.00 0.00 0.00 0.00 0.00
-
# Total memory
-
/usr/sbin/prtconf | grep Memory | awk -F”:” ‘{print $2}’
-
Memory size: 8192 Megabytes
-
# Find free memory and swap space based on 3 reads with 5 second read intervals
-
sar -r 5 3
-
18:56:24 freemem freeswap
-
18:56:29 175049 28289968
-
18:56:34 175031 28289843
-
18:56:39 175026 28289952
-
Average 175036 28289921
Process Memory Usage
-
>ps -A -o pmem -o pcpu -o args
-
>ps -e -o “rss(k) vsz(k) pmem pid comm” | qrep -v COMMAND | sort -rn | awk ‘{print $1 “\t” $2 “\t” $3 “\t” $4 “\t” $5;}’
Sample Sessions
* Follow a particular process id in 5 second intervals and send result to server.out file
-
bash-3.00$ prstat -L -p 16401 5 > server.out &
-
[1] 16530
-
bash-3.00$ tail -f server.out
-
PID USERNAME SIZE RSS STATE PRI NICE TIME CPU PROCESS/LWPID
-
16401 oracle 5270M 4125M sleep 59 0 0:00:00 0.0% oracle/1
-
Total: 1 processes, 1 lwps, load averages: 0.03, 0.04, 0.04
-
PID USERNAME SIZE RSS STATE PRI NICE TIME CPU PROCESS/LWPID
-
16401 oracle 5270M 4125M sleep 59 0 0:00:00 0.0% oracle/1
-
Total: 1 processes, 1 lwps, load averages: 0.03, 0.04, 0.04
-
PID USERNAME SIZE RSS STATE PRI NICE TIME CPU PROCESS/LWPID
-
16401 oracle 5270M 4125M sleep 59 0 0:00:00 0.0% oracle/1
-
Total: 1 processes, 1 lwps, load averages: 0.03, 0.04, 0.04
-
PID USERNAME SIZE RSS STATE PRI NICE TIME CPU PROCESS/LWPID
-
16401 oracle 5270M 4125M sleep 59 0 0:00:00 0.0% oracle/1
-
Total: 1 processes, 1 lwps, load averages: 0.03, 0.04, 0.04
-
^C
-
bash-3.00$ jobs
-
[1]+ Running prstat -L -p 16401 5 >server.out &
-
bash-3.00$ fg %1
-
prstat -L -p 16401 5 >server.out
-
^C
-
bash-3.00$
Recent Comments