Performance Tools
The following tools can help you locate the code sections that
you should optimize. Always remember Amdahl's Law:
if 1/Kth of the program is not affected by an improvement, the
best speedup you can hope for is K.
- time
- The unix/linux/shell time command is very useful as a crude
first pass in that only user time can be improved by normal means.
Real (wall clock) and system (OS processor time spent on
behalf of the user) times also are reported.
- perf
- Linux profiling with performance counters. Really OS-level, but can
be used for individual programs.
- gprof
- The GNU standard tool for detailed performance analysis.
Best for determining which functions to optimize within a large program.
Two other little things I'll demo:
-
The gprof2dot tool
can make a nice graph of the gprof output...
-
Well, actually, that tool doesn't make a graph at all, but it reformats
the data as dot input to the GraphViz
tools.
- Intel VTune
- Intel's performance tuning software that uses the hardware
performance registers. Available for both Windows and Linux, but
only an evaluation period is free.
- AMD uProf
- AMD's original answer to Intel's VTune was CodeAnalyst, but now there's
"MICRO-Prof", free for Windows and Linux.
- PAPI
- PAPI (Performance Application Programming Interface)
provides a free and consistent interface and tools for use of
performance counter hardware, primarily for a Linux environment.
- Valgrind
- A very nice simulation tool that tracks program behaviour
using instruction-level simulation of unmodified executables
using a tagged-memory system to tell you about references to
uninitialized data, malloc/free activity, etc.
We'll be adding to this list later (for GPU stuff)....
GPU and Multi-Core Computing