Patent ID: 7124254

Claim:
A method for monitoring prefetches due to speculative accesses in a computer system comprising: providing a processor for processing data; providing a cache memory, said cache memory capable of being accessed by said processor; providing an off-chip memory system, said off-chip memory system capable of being accessed by said processor; providing for speculative accesses by said processor to transfer data from said off-chip memory system to said cache memory system; modifying said processor such that said processor is capable of determining and labeling accesses as speculative and said processor is capable of indicating to said cache memory whether an access is speculative or non-speculative; providing said processor with a programmable prefetch counter that can be set, said prefetch counter for counting the number of prefetches, said prefetch counter providing said processor with the ability to trap on the occurrence of a predetermined state of said prefetch counter; providing a bit per tag called an S-bit, said S-bit indicating whether a cache line was accessed speculatively, wherein; a speculative insert of a cache line causes the S-bit of the cache line to be set, thereby changing the state of the cache line to the speculative state, further wherein; a speculative update of a cache line results in the setting of the S-bit of the updated cache line, thereby changing the state of the cache line to the speculative state, further wherein; a speculative miss of a cache line results in no change, further wherein; a non-speculative insert of a cache line results in the S-bit of the inserted cache line being cleared and the state of the cache line to be changed to the non-speculative state, further wherein; a non-speculative update of a cache line results in incrementing the prefetch count of said programmable prefetch counter if the updated cache line S-bit is set and the clearing of the S-bit of the cache line to the non-speculative state, further wherein; a non-speculative miss of a cache line results in no change.