A method for determining the latency for a particular level of memory within a
hierarchical memory system is disclosed. A performance monitor counter is allocated
to count the number of loads (load counter) and for counting the number of cycles
(cycle counter). The method begins with a processor determining which load to select
for measurement. In response to the determination, the cycle counter value is stored
in a rewind register. The processor issues the load and begins counting cycles.
In response to the load completing, the level of memory for the load is determined.
If the load was executed from the desired memory level, the load counter is incremented.
Otherwise, the cycle counter is rewound to its previous value.