Sun Studio 12: Performance Analyzer

ProcedureTo Collect Data From a Running Process That is Not Under the Control of dbx:

  1. Determine the program’s process ID (PID).

    If you started the program from the command line and put it in the background, its PID will be printed to standard output by the shell. Otherwise you can determine the program’s PID by typing the following.

    % ps -ef | grep program-name
  2. Attach to the process.

    From dbx, type the following.

    (dbx) attach program-name pid

    If dbx is not already running, type the following.

    % dbx program-name pid

    Attaching to a running process pauses the process.

    See the manual, Sun Studio 12: Debugging a Program With dbx, for more information about attaching to a process.

  3. Start data collection.

    From dbx, use the collector command to set up the data collection parameters and the cont command to resume execution of the process.

  4. Detach from the process.

    When you have finished collecting data, pause the program and then detach the process from dbx.

    From dbx, type the following.

    (dbx) detach