Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Comprehensive methods of viewing memory usage on Solaris [closed]

Tags:

On Linux, the "top" command shows a detailed but high level overview of your memory usage, showing:

Total Memory, Used Memory, Free Memory, Buffer Usage, Cache Usage, Swap size and Swap Usage.

My question is, what commands are available to show these memory usage figures in a clear and simple way? Bonus points if they're present in the "Core" install of Solaris. 'sar' doesn't count :)

like image 499
user40626 Avatar asked Nov 25 '08 13:11

user40626


People also ask

How do I see how much memory I have on Solaris?

On Solaris, you can use the command prtconf to determine how much physical memory the computer has. This command (located in /usr/sbin) displays the total amount of memory for the computer in megabytes. 1. Log in as any user.

How can I see all my memory usage?

Press Ctrl + Shift + Esc to launch Task Manager. Or, right-click the Taskbar and select Task Manager. Select the Performance tab and click Memory in the left panel. The Memory window lets you see your current RAM usage, check RAM speed, and view other memory hardware specifications.

How do I check memory usage in Unix?

meminfo. To get some quick memory information on a Linux system, you can also use the meminfo command. Looking at the meminfo file, we can see how much memory is installed as well as how much is free.

How does Solaris manage memory?

Solaris uses a virtual memory model that is made up from the total amount of physical memory installed on the system and the amount of swap space that has been defined. For example, if we had 4 GB of physical memory and created a swap area of 10 GB, this would provide us with 14 GB of virtual memory.


1 Answers

Here are the basics. I'm not sure that any of these count as "clear and simple" though.

ps(1)

For process-level view:

$ ps -opid,vsz,rss,osz,args   PID  VSZ  RSS   SZ COMMAND  1831 1776 1008  222 ps -opid,vsz,rss,osz,args  1782 3464 2504  433 -bash $ 

vsz/VSZ: total virtual process size (kb)

rss/RSS: resident set size (kb, may be inaccurate(!), see man)

osz/SZ: total size in memory (pages)

To compute byte size from pages:

$ sz_pages=$(ps -o osz -p $pid | grep -v SZ ) $ sz_bytes=$(( $sz_pages * $(pagesize) )) $ sz_mbytes=$(( $sz_bytes / ( 1024 * 1024 ) )) $ echo "$pid OSZ=$sz_mbytes MB" 

vmstat(1M)

$ vmstat 5 5   kthr      memory            page            disk          faults      cpu  r b w   swap  free  re  mf pi po fr de sr rm s3 -- --   in   sy   cs us sy id  0 0 0 535832 219880  1   2  0  0  0  0  0 -0  0  0  0  402   19   97  0  1 99  0 0 0 514376 203648  1   4  0  0  0  0  0  0  0  0  0  402   19   96  0  1 99 ^C 

prstat(1M)

   PID USERNAME  SIZE   RSS STATE  PRI NICE      TIME  CPU PROCESS/NLWP          1852 martin   4840K 3600K cpu0    59    0   0:00:00 0.3% prstat/1   1780 martin   9384K 2920K sleep   59    0   0:00:00 0.0% sshd/1   ... 

swap(1)

"Long listing" and "summary" modes:

$ swap -l swapfile             dev  swaplo blocks   free /dev/zvol/dsk/rpool/swap 256,1      16 1048560 1048560 $ swap -s  total: 42352k bytes allocated + 20192k reserved = 62544k used, 607672k available $ 

top(1)

An older version (3.51) is available on the Solaris companion CD from Sun, with the disclaimer that this is "Community (not Sun) supported". More recent binary packages available from sunfreeware.com or blastwave.org.

load averages:  0.02,  0.00,  0.00;                      up 2+12:31:38                                                                                            08:53:58 31 processes: 30 sleeping, 1 on cpu CPU states: 98.0% idle,  0.0% user,  2.0% kernel,  0.0% iowait,  0.0% swap Memory: 1024M phys mem, 197M free mem, 512M total swap, 512M free swap     PID USERNAME LWP PRI NICE  SIZE   RES STATE    TIME    CPU COMMAND   1898 martin     1  54    0 3336K 1808K cpu      0:00  0.96% top      7 root      11  59    0   10M 7912K sleep    0:09  0.02% svc.startd 

sar(1M)

And just what's wrong with sar? :)

like image 115
Martin Carpenter Avatar answered Sep 30 '22 20:09

Martin Carpenter