Saturday, May 4, 2019

c++ - Debugging the CPU Caches

I'm currently trying to optimize my software for better CPU cache usage. There are some posts on SO which suggest that it's sometimes hard to guess what the CPU cache is doing and why there are some performance drops in certain cases. For example:





So in order to get a clue where the cache misses happen, I can run perf to get a count of cache misses and where they occur as well as valgrind --tool=cachegrind to simulate the caches (at least an L1 and a last-level cache).



It's really nice to know where cache misses happen, but I'd like to know why they happen (for example cache trashing etc.). Is there a way to explicitly pause the program and see whats inside the caches (maybe with the program running in valgrind and vgdb attached)?

No comments:

Post a Comment

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...