Reputation: 63
How can I view or dump cpu cache contents for x86-based architectures? Each time there is a cache flush, how can I see what/where has been flushed?
Upvotes: 3
Views: 885
Reputation: 8847
There are options, but they are non-trivial to implement.
The idea is that you need to dump cache without corrupting its state. Easier said than done, though in principle it's simple enough: write out all contents from the address which triggered the last L3 cache change, and then moving through the entirety of the L3 cache width till you have read all values, without touching values outside. You could then work your way up from there to higher level caches. I don't really see much mention in that paper of how they go about this, but there seems to be an implication that they work top-down through the caches rather than bottom-up, as I've suggested. Again, the critical part of all this is not to corrupt any of the caches.
Nonetheless it greatly reduces app performance, by a factor of 100-1000. One aspect which that paper touches on is hardware compression, because of the volume of data.
Upvotes: 2
Reputation: 247899
you can't, really. The CPU cache is designed to be transparent to the code running on the CPU. It has the effect of speeding up execution of your code, but the CPU manages everything about the cache: what to keep in it, what to evict from it, when to read from it, everything. It is not designed to be accessible to the programmer (although Intel/AMD may provide debugging tools which can inspect special debug registers to query information such as this)
Upvotes: 2