I personally use the Time Stamp Counter via an assembly wrapper that executes the instruction rdtsc. I then get an unsigned 64 bit integer containing the number of internal clock cycles that have passed since the processor was powered up. The difference between two read-outs is the number of code cycles required to execute the piece of code inbetween. Access to the instructions for cache hit readouts may be implemented in the same manner.
I find it difficult to understand what conclusions to draw from reading the cache counters without having a time frame to relate to. This time frame should not be too long or a task switch or interrupt might affect the value.
According to Microsoft the rdtsc instruyction may not be accurate if down-throttling functionality is enabled on the processor (to lower energy consumption) which should be kept in mind (or switched off!).
No comments:
Post a Comment