ljs
ljs

Reputation: 37847

Determining C code's processor cache efficiency

I'd like to determine how efficiently given C code utilises processor cache, and if possible, determine what data is present in the cache and what is stored in main memory (though that is more of a nice-to-have) - is there software out there that can do this?

I know this may not fit into the remit of stack overflow, though of course it is highly related to programming as I intend to use it as a tool to test code I am writing. If there is a more appropriate place, please let me know/mods move this question.

Additionally, I'd (much) prefer the software to be for mac os x/unix.

Thanks!

Upvotes: 1

Views: 308

Answers (1)

Paul R
Paul R

Reputation: 213220

There are various profilers which can capture profiles based on cache misses as an alternative to regular time interval based sampling. This will give you an idea as to where in your program you are not using cache effectively. On Mac OS X check out Shark (free - part of the CHUD tools package). On Linux try Zoom (commercial, but there's a free 30 day evaluation license).

Upvotes: 3

Related Questions