Alpha Hardware Monitors
The Alphas have limited hardware support for performance monitoring.
The hardware has two counters that are software configurable to count
various events. They range from cache misses to branch mispredicts to
frozen pipelines. An exact list is in the man page for pfm.
These performance counters will count the occurance of events
either in kernel routines or user-level routines, and every 4096
events, an interrupt is triggered and information is recorded.
(Actually what is recorded is the PC at the time of the 4096th event.)
This information is stored in kmon.out or umon.out,
and can be read by prof.
There are a few caveats:
- When this interrupt is generated to record data, the counters
keep counting, so the performance of the interrrupt routine is
measured also.
- Two counters are supported, but the format of the
mon.out file only supports recording of one of the counters.
Presumably, if both counters are recorded, the data will be mixed
together in the mon.out file. The solution is only to
measure one thing at a time.
- The prof program reports output in execution times,
which doesn't make much sense if the input events are cache misses.
So it appears that prof assumes that the events recorded are
some multiple of clock cycles.
The good news is that it is easy to take profile date. See the man
pages on an Alpha for uprofile (the user level profiler),
kprofile (the kernel profiler), and pfm (a
description of the statistics that can be gathered.