The tprof command

The typical program execution is a variable combination of application code, library subroutines, and kernel services. Frequently, programs that have not been tuned expend most of their CPU cycles in certain statements or subroutines.

You can determine which particular statements or subroutines to examine with the tprof command.

The tprof command is a versatile profiler that provides a detailed profile of CPU usage by every process ID and name. It further profiles at the application level, routine level, and even to the source statement level and provides both a global view and a detailed view. In addition, the tprof command can profile kernel extensions, stripped executable programs, and stripped libraries. It does subroutine-level profiling for most executable programs on which the stripnm command produces a symbols table. The tprof command can profile any program produced by any of the following compilers:
  • C
  • C++
  • FORTRAN
  • Java™
The tprof command only profiles CPU activity. It does not profile other system resources, such as memory or disks.
The tprof command can profile Java programs using Java Persistence API (JPA) (-x java -Xrunjpa) to collect Java Just-in-Time (JIT) source line numbers and instructions, if the following parameters are added to -Xrunjpa:
  • source=1; if IBM® Java Runtime Environment (JRE) 1.5.0 is installed, this parameter enables JIT source line collecting.
  • instructions=1; enables JIT instructions collecting.