March 2024
M T W T F S S
 123
45678910
11121314151617
18192021222324
25262728293031

Categories

March 2024
M T W T F S S
 123
45678910
11121314151617
18192021222324
25262728293031

Solaris command: prstat

Total Physical Memory

  1. >prtdiag -v | grep Memory
  2. Memory size: 8192 Megabytes
  3. >prtconf | grep Memory
  4. Memory size: 8192 Megabytes

Total Physical Memory

  1. >vmstat 5 10
  2. r b w swap free re mf pi po fr de sr vc vc vc vc in sy cs us sy id
  3. 0 0 0 14841224 772880 23 147 19 6 6 0 1 1 0 2 2 3775 2990 3820 2 2 96
  4. 1 0 0 20482808 4992304 3 3 0 0 0 0 0 1 0 0 0 527 474 482 13 0 87
  5. 0 0 0 20483192 5000272 1 5 0 3 3 0 0 0 0 0 1 583 645 606 13 1 86
  6. 0 0 0 20485848 5033400 0 0 0 0 0 0 0 0 0 0 0 528 463 492 13 1 86
  7. 0 0 0 20485848 5033344 0 0 0 0 0 0 0 0 0 0 1 514 469 475 13 0 87
  8. 0 0 0 20485848 5033288 0 0 0 0 0 0 0 0 0 0 2 513 450 476 13 0 87
  9. 0 0 0 20485848 5033288 0 0 0 0 0 0 0 1 0 0 0 516 468 476 13 0 87
  10. 0 0 0 20485848 5033240 0 0 0 0 0 0 0 0 0 0 0 510 451 467 13 0 87
  11. 0 0 0 20485848 5033184 0 0 0 0 0 0 0 0 0 0 0 518 468 475 13 0 87
  12. 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

  1. # Generate 2 processor reports with 5 second interval
  2. mpstat 5 2
  3. CPU minf mjf xcal intr ithr csw icsw migr smtx srw syscl usr sys wt idl
  4. 0 14 0 42 35 18 48 0 1 8 0 139 1 0 0 99
  5. 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

  1. # Sort by cpu usage (default)
  2. prstat
  3. # Sort by memory usage
  4. prstat -s rss
  5. # Sort by virtual memory usage
  6. prstat -s size
  7. # Sort by process execution time
  8. prstat -s time
  9. # Find top 5 processes
  10. prstat -n 5
  11. # Also print process numbers each user is using
  12. prstat -a
  13. # Follow a particular process id
  14. prstat -p pid
  15. # Follow threads of a particular process id
  16. prstat -L -p pid

Find Paging Activities

* Use system activity report tool ‘sar’
* Examples

  1. # Find top 3 paging activities with 5 second interval
  2. sar -g 5 3
  3. 18:57:12 pgout/s ppgout/s pgfree/s pgscan/s %ufs_ipf
  4. 18:57:17 0.00 0.00 0.00 0.00 0.00
  5. 18:57:22 0.00 0.00 0.00 0.00 0.00
  6. 18:57:27 0.00 0.00 0.00 0.00 0.00
  7. Average 0.00 0.00 0.00 0.00 0.00
  8. # Total memory
  9. /usr/sbin/prtconf | grep Memory | awk -F”:” ‘{print $2}’
  10. Memory size: 8192 Megabytes
  11. # Find free memory and swap space based on 3 reads with 5 second read intervals
  12. sar -r 5 3
  13. 18:56:24 freemem freeswap
  14. 18:56:29 175049 28289968
  15. 18:56:34 175031 28289843
  16. 18:56:39 175026 28289952
  17. Average 175036 28289921

Process Memory Usage

  1. >ps -A -o pmem -o pcpu -o args
  2. >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

  1. bash-3.00$ prstat -L -p 16401 5 > server.out &
  2. [1] 16530
  3. bash-3.00$ tail -f server.out
  4. PID USERNAME SIZE RSS STATE PRI NICE TIME CPU PROCESS/LWPID
  5. 16401 oracle 5270M 4125M sleep 59 0 0:00:00 0.0% oracle/1
  6. Total: 1 processes, 1 lwps, load averages: 0.03, 0.04, 0.04
  7. PID USERNAME SIZE RSS STATE PRI NICE TIME CPU PROCESS/LWPID
  8. 16401 oracle 5270M 4125M sleep 59 0 0:00:00 0.0% oracle/1
  9. Total: 1 processes, 1 lwps, load averages: 0.03, 0.04, 0.04
  10. PID USERNAME SIZE RSS STATE PRI NICE TIME CPU PROCESS/LWPID
  11. 16401 oracle 5270M 4125M sleep 59 0 0:00:00 0.0% oracle/1
  12. Total: 1 processes, 1 lwps, load averages: 0.03, 0.04, 0.04
  13. PID USERNAME SIZE RSS STATE PRI NICE TIME CPU PROCESS/LWPID
  14. 16401 oracle 5270M 4125M sleep 59 0 0:00:00 0.0% oracle/1
  15. Total: 1 processes, 1 lwps, load averages: 0.03, 0.04, 0.04
  16. ^C
  17. bash-3.00$ jobs
  18. [1]+ Running prstat -L -p 16401 5 >server.out &
  19. bash-3.00$ fg %1
  20. prstat -L -p 16401 5 >server.out
  21. ^C
  22. bash-3.00$

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>