HP Compilers for HP Integrity Servers (September 2011)

to instruction-level events. Global measurements report total values for critical
performance elements such as cache and TLB misses, branch mispredictions, pipeline
stalls, instructions executed, and so on. Global measurements are a quick way to
find performance problems. Sampled measurements report the same performance
metrics as global, but they are sampled during application runtime and correlated
to program locations. Precise measurements provide exact function call counts,
function coverage, call graph and basic block arc counts. HP Caliper operates
during application runtime and does not require the application be built with any
enabling compiler options. (For more information, see the references listed in
Additional Information” (page 33))
HP-UX gprof shows the hot procedures in the application and which hot paths call
those procedures. Using this information, the developer can decide which procedures
or sections of the application could most benefit from tuning, either with compiler
options and pragmas or algorithmic improvement. The -G compiler option is used
to instrument an application for gprof.
HP Caliper includes two modes of operation (cgprof and scgprof) that perform the
same measurements and reporting as gprof, but without the need to compile the source
code specially for measurement.
Include header files
Legacy C applications frequently do not include header files for system libraries such as
libc and libm. For example, <stdio.h> should be included in any file that calls printf,
but it frequently is not. The default argument and return types in C allow calls to many
C library functions with no explicit prior prototype or declaration, and these calls usually
work fine in the traditional 32-bit data model where the default int type and pointer
types are the same size. Default types do not work for calling most libm functions. Some
codes include their own declaration instead of the header file for a libm function. This
is allowed, but will inhibit optimization (including inlining) of the call.
HP has included in its HP-UX system header files a variety of pragmas that allow the HP
compiler to statically bind and optimize calls to library functions. The compiler binds
library calls at compile-time where it is safe to do so, as identified by a #pragma
BUILTIN or #pragma BUILTIN_MILLI in the system header. Calls to these functions
can be optimized by the compiler; the compiler can inline the function, substitute a call
to a faster routine, or apply more aggressive optimizations around the call. The system
header files also include pragmas that declare system library routines external so that
calls to shared system libraries may be optimized. These transformations provide
significant performance gains in some applications.
Scheduling for the processor
Different members of the Intel Itanium processor family can have different resource
constraints, instruction latencies, and other scheduling criteria. HP compilers allow the
developer to optimize the application for a specific member of the processor family, or
24 HP compilers for HP Integrity servers