beautypg.com

Tips and best practices for using hpcpi, Tips, Using event sets – HP XC System 3.x Software User Manual

Page 55

background image

Tips and Best Practices for Using HPCPI

This section contains tips and best practices for using HPCPI.

Tips

To profile an application, you start by monitoring CPU cycles. After collecting and flushing the
HPCPI data, you can run the hpcpiprof command without specifying an image name to view
system activity, such as kernel and library activity. Next, run the hpcpiprof command with
your image name (hpcpiprof image_name) to determine which procedures are consuming
the most CPU cycles.

Use the hpcpilist command (hpcpilist procedure_name image_name) to view
per-instruction event counts and to determine which areas within a procedure are consuming
the most CPU cycles.

Look for hot spots. A hot spot is an image, procedure, or area of code with either very high or
very low event counts, depending on the event. When analyzing CPU cycles, a hot spot is an
area of code with a high event count. When analyzing other event counts or metrics such as
instructions per cycle, a hot spot can be an area of code with low event counts or metrics.

When examining the output from hpcpilist, note that instructions are bundled and a delay
can occur when recording the instruction pointer. When you encounter an instruction with a
high event count, HP recommends that you consider all instructions near that instruction as
possible sources of the event. For more information, see

“HPCPI Product Limitations” (page 115)

.

The following listing shows a typical command sequence:

% hpcpid
% myApp arg1 arg2 (run your application)
% hpcpictl flush
% hpcpiprof
% hpcpiprof myApp
% hpcpilist routine2 myApp

Using Event Sets

You can also use event sets to monitor a large number of events and run the analysis tools multiple
times with the same data, but display different event statistics each time.

For example, the event set HelpMeEvents monitors a large number of events. You can collect
data with the HelpMeEvents event set. Initially, you view data for CPU cycles only, as shown
in the following example:

% hpcpid -events HelpMeEvents
% myApp arg1 arg2 (run your application)
% hpcpictl flush
% hpcpiprof -event CPU_CYCLES myApp
% hpcpilist -event CPU_CYCLES routine2 myApp

To view statistics for all stalls on an Itanium system, select BACK_END_BUBBLE.ALL events. For
example:

% hpcpiprof -event BACK_END_BUBBLE.ALL myApp
% hpcpilist -event BACK_END_BUBBLE.ALL routine2 myApp

Stopping the Daemon After You Finish Collecting Data (hpcpictl quit)

Only one instance of the HPCPI daemon (hpcpid) can run on a system. Because hpcpid runs
as a daemon (it detaches from your session), the hpcpid process does not terminate when you
end your user session. After you finish collecting data, stop the daemon (hpcpictl quit) as
a courtesy to other users on the system.

Tips and Best Practices for Using HPCPI

55