An extremely useful set of tools, based on information held in/proc, can be found in/usr/proc/bin (as of Solaris 8, these tools are located in/bin, with symlinks in/usr/proc/bin pointing to the new location). They include the following:
pcred— Prints the credentials (effective, real, and saved user IDs, or UIDs, and group IDs, or GIDs) of each process.
pfiles— Reports fstat (2) and fcntl (2) information for all open files in each process.
pflags— Prints the /proc tracing flags, pending and held signals, and other /proc status information for each lwp in each process.
pldd— Lists the dynamic libraries linked into each process, including shared objects explicitly attached by dlopen (3X).
pmap— Prints the address space map of each process.
psig— Lists the signal actions of each process.
pstack— Prints a hex+symbolic stack trace for each lwp in each process.
pstop/prun— Stops or starts each process.
ptime— Times a command, like the time (1) command but uses microstate accounting for reproducible precision.
ptree— Prints the process trees containing the specified process IDs (PIDs) or users, with child processes indented from their respective parent processes. An argument of all digits is taken to be a process ID; otherwise, it is assumed to be a user login name. Default is all processes.
pwait— Waits for all of the specified processes to terminate.
pwdx— Prints the current working directory of each process.
Network traffic can be monitored with bothnetstat andstatit, although both tools focus on the number of packets sent and received. An undocumentednetstat option,-k, reports the number of packets received and sent by each network interface (ipackets and opackets), along with an almost overwhelming quantity of other kernel data. As of Solaris 2.6,netstat -k also reports the number of bytes received and sent (rbytes andobytes).The combination of packet count and byte statistics count allows theaverage packet size to be calculated for both incoming and outgoingpackets. A new utility,kstat, introducedin Solaris 8, presents the same information in a more flexible manner,allowing statistics to be selectively extracted. An example of howkstat can be used is given on page 293.
A sophisticated tool referred to asmemtool(developed by Richard McDougall) is also not officially supported butprovides extremely useful information about memory usage for allprocesses on the system.memtool is available on the book website. A script based on this tool,procmem, is also included on the book website and is described on page 286.
Another useful tool istruss, which displays all system calls made by a running process. With the-c option,truss summarizes system call statistics for a monitored process. The statistics are reported when you interrupttruss with Control-C. Note, though, that truss can be intrusive on heavily loaded systems.
聯(lián)系客服