solaris系统用ps命令查看进程占用的CPU、内存等情况
用PS命令的-o选项来实现,这些选项有:user ruser group rgroup uid ruid gid rgid pid ppid pgid sid taskid ctid
pri opri pcpu pmem vsz rss osz nice class time etime stime zone zoneid
f s c lwp nlwp psr tty addr wchan fname comm args projid project pset
例: ps -efo user,pid,ppid,pcpu,pmem,comm
例:# ps -efo uid,pid,ppid,pcpu,pmem,vsz,rss,osz,etime,stime,comm | grep php
48 939 938 0.1 0.2 22696 11304 2837 04:36 14:55:58 /usr/local/webserver/php/bin/php-cgi
48 952 938 2.0 0.2 22712 11336 2839 04:36 14:55:58 /usr/local/webserver/php/bin/php-cgi
48 945 938 2.9 0.2 22720 11808 2840 04:36 14:55:58 /usr/local/webserver/php/bin/php-cgi
48 938 1 0.0 0.1 18368 7840 2296 04:36 14:55:58 /usr/local/webserver/php/bin/php-cgi
各选项的含义:
he following names are recognized in the POSIX locale:
user The effective user ID of the process. This will be the textual user ID, if it can be
obtained and the field width permits, or a decimal representation otherwise.
ruser The real user ID of the process. This will be the textual user ID, if it can be
obtained and the field width permits, or a decimal representation otherwise.
group The effective group ID of the process. This will be the textual group ID, if it can be
obtained and the field width permits, or a decimal representation otherwise.
rgroup The real group ID of the process. This will be the textual group ID, if it can be
obtained and the field width permits, or a decimal representation otherwise.
pid The decimal value of the process ID.
ppid The decimal value of the parent process ID.
pgid The decimal value of the process group ID.
pcpu The ratio of CPU time used recently to CPU time available in the same period, expressed
as a percentage. The meaning of ``recently'' in this context is unspecified. The CPU time
available is determined in an unspecified manner.
vsz The total size of the process in virtual memory, in kilobytes.
nice The decimal value of the system scheduling priority of the process. See nice(1).
etime In the POSIX locale, the elapsed time since
the process was started, in the form:
[[dd-]hh:]mm:ss
where
dd is the number of days
hh is the number of hours
mm is the number of minutes
ss is the number of seconds
The dd field will be a decimal integer. The hh, mm and ss fields will be two-digit
decimal integers padded on the left with zeros.
time In the POSIX locale, the cumulative CPU time of the process in the form:
[dd-]hh:mm:ss
The dd, hh, mm, and ss fields will be as described in the etime specifier.
tty The name of the controlling terminal of the process (if any) in the same format used by
the who(1) command.
comm The name of the command being executed (argv[0] value) as a string.
args The command with all its arguments as a string. The implementation may truncate this
value to the field width; it is implementation-dependent whether any further
truncation occurs. It is unspecified whether the string represented is a version of the
argument list as it was passed to the command when it started, or is a version of the
arguments as they may have been modified by the application. Applications cannot depend
on being able to modify their argument list and having that modification be reflected in
the output of ps. The Solaris implementation limits the string to 80 bytes; the string is the version of the argument list as it was passed to the command when it started.
The following names are recognized in the Solaris implemen-
tation:
f Flags (hexadecimal and additive) associated with the process.
s The state of the process.
c Processor utilization for scheduling (obsolete).
uid The effective user ID number of the process as a decimal integer.
ruid The real user ID number of the process as a decimal integer.
gid The effective group ID number of the process as a decimal integer.
SunOS 5.10 Last change: 5 Jun 2006 10
User Commands ps(1)
rgid The real group ID number of the process as a decimal integer.
projid The project ID number of the process as a decimal integer.
project The project ID of the process as a textual value if that value can be obtained; other-
wise, as a decimal integer.
zoneid The zone ID number of the process as a decimal integer.
zone The zone ID of the process as a textual value if that value can be obtained; other-
wise, as a decimal integer.
sid The process ID of the session leader.
taskid The task ID of the process.
class The scheduling class of the process.
pri The priority of the process. Higher numbers mean higher priority.
opri The obsolete priority of the process. Lower numbers mean higher priority.
lwp The decimal value of the lwp ID. Requesting this formatting option causes one line to be
printed for each lwp in the process.
nlwp The number of lwps in the process.
psr The number of the processor to which the
process or lwp is bound.
pset The ID of the processor set to which the
process or lwp is bound.
addr The memory address of the process.
osz The total size of the process in virtual memory, in pages.
wchan The address of an event for which the process is sleeping (if -, the process is run-
ning).
stime The starting time or date of the process, printed with no blanks.
rss The resident set size of the process, in kilobytes. The rss value reported by ps is
an estimate provided by proc(4) that may underestimate the actual resident set size.
Users who wish to get more accurate usage information for capacity planning should use
pmap(1) -x instead.
pmem The ratio of the process's resident set size to the physical memory on the machine,
expressed as a percentage.
fname The first 8 bytes of the base name of the process's executable file.