Sun Studio 12: Performance Analyzer

ProcedureProfiling the Kernel

  1. Collect the experiment by typing:

    % er_kernel -p on
  2. Run whatever load you want in a separate shell.

  3. When the load completes, terminate the er_kernel utility by typing Ctrl-C.

  4. Load the resulting experiment, named by default, into the Performance Analyzer or the er_print utility.

    Kernel clock profiling produces one performance metric, labeled KCPU Cycles. In the Performance Analyzer, it is shown for kernel functions in the Functions Tab, for callers and callees in the Caller-Callee Tab, and for instructions in the Disassembly Tab. The Source Tab does not show data, because kernel modules, as shipped, do not usually contain file and line symbol table information (stabs).

    You can replace the -p on argument to the er_kernel utility with -p high for high-resolution profiling or -p low for low-resolution profiling. If you expect the run of the load to take 2 to 20 minutes, the default clock profiling is appropriate. If you expect the run to take less than 2 minutes, use -p high; if you expect the run to take longer than 20 minutes, use -p low.

    You can add a -t duration argument, which will cause the er_kernel utility to terminate itself according to the time specified by duration.

    The -t duration can be specified as a single number, with an optional m or s suffix, to indicate the time in minutes or seconds at which the experiment should be terminated. By default, the duration is in seconds. The duration can also be specified as two such numbers separated by a hyphen, which causes data collection to pause until the first time elapses, and at that time data collection begins. When the second time is reached, data collection terminates. If the second number is a zero, data will be collected after the initial pause until the end of the program's run. Even if the experiment is terminated, the target process is allowed to run to completion.

    You can add the -v argument if you want more information about the run printed to the screen. The -n argument lets you see a preview of the experiment that would be recorded, without actually recording anything.

    By default, the experiment generated by the er_kernel utility is named; the number is incremented for successive runs.