Search code examples
c++memory-managementcpu-cache

How to find most frequently used areas of memory?


I'm looking to profile a large C++ application and determine which pieces of data (or memory regions) are fetched the most. Basically, I want to be able to do something like the processor's MFU cache algorithm for determining what to store in L2/L3 caches. There is surprisingly little to no information online on anybody that has tried to accomplish this.

Edit: Changed MRU to MFU

Edit 2: To clarify, I need the addresses, or the data structures that are pointed to at the addresses.


Solution

  • You can use Pin tool to log all memory accesses and calculate cache hit/miss.