Yoganand
Yoganand

Reputation: 13

All process running currently on Solaris machine and Physical memory usage

I am looking for all the process running on my Solaris 11 box which ps -eaf would help me.

But how do I get info on "Physical memory used by each process that are currently running on the server"

For example: If I have 5 process running @3PM then output should look like:

memory_usage Pid PPid Pname

Upvotes: 0

Views: 977

Answers (1)

peterh
peterh

Reputation: 19235

The prstat command is your friend.

It is similar to top on Linux, only better. If you like top more then you can also use that on Solaris.

Anyway, here's an example using prstat:

$ prstat -c -n 99999,99999 -s rss 5 1

The above command is suitable for non-interactive use and lists all processes on the system during the last 5 second interval. Processes will be sorted by their RSS (memory usage) so that the process which consumes the most memory is listed first.

Here's what it looks like on my system:

$ prstat -c -n 99999,99999 -s rss 5 1
Please wait...
   PID USERNAME  SIZE   RSS STATE   PRI NICE      TIME  CPU PROCESS/NLWP
 10972 root       22M   20M sleep    59    0   0:00:08 0.0% svc.startd/12
 10981 root       19M   17M sleep    59    0   0:00:21 0.0% svc.configd/30
 13235 root       18M   11M sleep    59    0   0:00:06 0.0% fmd/12
 23126 johnny     12M 8072K sleep    59    0   0:00:00 0.0% sshd/1
  7133 root     8844K 7712K cpu1     59    0   0:00:00 0.0% prstat/1
 23129 johnny     12M 7696K sleep    59    0   0:00:00 0.0% sshd/1
 11864 root       11M 5572K sleep    59    0   0:00:00 0.0% rad/4
 11906 root       11M 5536K sleep    59    0   0:00:00 0.0% rad/4
 12166 netadm   7056K 4852K sleep    59    0   0:00:06 0.0% nwamd/6
 13267 root     7584K 4120K sleep    59    0   0:00:00 0.0% sshd/1
 12760 root       10M 3704K sleep    59    0   0:00:14 0.0% nscd/34
 23125 root     9508K 3556K sleep    59    0   0:00:00 0.0% sshd/1
 23128 root     9508K 3548K sleep    59    0   0:00:00 0.0% sshd/1
 11982 netadm   5476K 3528K sleep    59    0   0:00:06 0.0% ipmgmtd/7
 13173 root     5480K 3436K sleep    59    0   0:00:00 0.0% inetd/3
 23131 johnny   4520K 3184K sleep    59    0   0:00:00 0.0% bash/1
 23170 root     4516K 3160K sleep    49    0   0:00:00 0.0% bash/1
 11624 netcfg   3812K 2568K sleep    59    0   0:00:06 0.0% netcfgd/5
 13165 root     4292K 2300K sleep    59    0   0:00:00 0.0% in.ndpd/1
 23169 johnny   3532K 2276K sleep    59    0   0:00:00 0.0% su/1
 23130 johnny     12M 2268K sleep    59    0   0:00:00 0.0% sshd/1
 13176 root     3624K 2184K sleep    59    0   0:00:00 0.0% automountd/5
 11666 root     4044K 2124K sleep    59    0   0:00:00 0.0% svc.periodicd/4
 10232 root     3080K 2072K sleep    59    0   0:00:01 0.0% init/1
 13565 root     7084K 2004K sleep    59    0   0:00:15 0.0% sendmail/1
 13054 daemon   3496K 1880K sleep    59    0   0:00:00 0.0% rpcbind/1
 13322 root     4136K 1816K sleep    59    0   0:00:00 0.0% syslogd/11
 13622 root     3360K 1808K sleep    59    0   0:00:00 0.0% smtp-notify/3
 13495 smmsp    7080K 1692K sleep    59    0   0:00:01 0.0% sendmail/1
 12428 root     2856K 1628K sleep    59    0   0:00:00 0.0% zoneproxy-clien/2
 13297 root     2500K 1500K sleep    59    0   0:00:00 0.0% ttymon/1
 11718 root     2684K 1412K sleep    59    0   0:00:00 0.0% pfexecd/3
 13174 root     3296K 1404K sleep    59    0   0:00:00 0.0% automountd/2
 12812 root     2252K 1232K sleep    59    0   0:00:00 0.0% cron/1
 12016 root     3204K 1200K sleep    59    0   0:00:00 0.0% dbus-daemon/1
 11715 daemon   3212K 1168K sleep    59    0   0:00:00 0.0% kcfd/1
 12036 root     2980K 1132K sleep    59    0   0:00:11 0.0% in.mpathd/1
 11972 daemon   2404K  840K sleep    59    0   0:00:01 0.0% utmpd/1
  6879 root        0K    0K sleep    60    -   0:00:00 0.0% zsched/1
Total: 39 processes, 169 lwps, load averages: 0.08, 0.09, 0.11

Yeah, not a lot going on this system. :-)

Upvotes: 1

Related Questions