Section 3.1. Tools for Process Analysis


3.1. Tools for Process Analysis

Since there are so many tools for process analysis, it can be helpful to group them into general categories.

  • Overall status tools. The prstat command immediately provides a by-process indication of CPU and memory consumption. prstat can also fetch microstate accounting details and by-thread details. The original command for listing process status is ps, the output of which can be customized.

  • Control tools. Various commands, such as pkill, pstop, prun and preap, control the state of a process. These commands can be used to repair application issues, especially runaway processes.

  • Introspection tools. Numerous commands, such as pstack, pmap, pfiles, and pargs inspect process details. pmap and pfiles examine the memory and file resources of a process; pstack can view the stack backtrace of a process and its threads, providing a glimpse of which functions are currently running.

  • Lock activity examination tools. Excessive lock activity and contention can be identified with the plockstat command and DTrace.

  • Tracing tools. Tracing system calls and function calls provides the best insight into process behavior. Solaris provides tools including TRuss, apptrace, and dtrace to trace processes.

Table 3.1 summarizes and cross-references the tools covered in this section.

Table 3.1. Tools for Process Analysis

Tool

Description

Reference

prstat

For viewing overall process status

3.2

ps

To print process status and information

3.3

ptree

To print a process ancestry tree

3.4

pgrep; pkill

To match a process name; to send a signal

3.4

pstop; prun

To freeze a process; to continue a process

3.4

pwait

To wait for a process to finish

3.4

preap

To reap zombies

3.4

pstack

For inspecting stack backtraces

3.5

pmap

For viewing memory segment details

3.5

pfiles

For listing file descriptor details

3.5

ptime

For timing a command

3.5

psig

To list signal handlers

3.5

pldd

To list dynamic libraries

3.5

pflags; pcred

To list tracing flags; to list process credentials

3.5

pargs; pwdx

To list arguments, env; to list working directory

3.5

plockstat

For observing lock activity

3.6

TRuss

For tracing system calls and signals, and tracing function calls with primitive details

3.7

apptrace

For tracing library calls with processed details

3.7

dtrace

For safely tracing any process activity, with minimal effect on the process and system

3.7


Many of these tools read statistics from the /proc file system, procfs. See Section 2.10 in Solaris Internals, which discusses procfs from introduction to implementation. Also refer to /usr/include/sys/procfs.h and the proc(4) man page.




Solaris Performance and Tools(c) Dtrace and Mdb Techniques for Solaris 10 and Opensolaris
Solaris Performance and Tools: DTrace and MDB Techniques for Solaris 10 and OpenSolaris
ISBN: 0131568191
EAN: 2147483647
Year: 2007
Pages: 180

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net