Dervin Thunk
Dervin Thunk

Reputation: 20140

How do I measure cache performance in multithreaded applications?

I need something like cache hits/misses on a per thread basis. How do I obtain that information? Cachegrind doesn't seem to work, based on the fact that my sequential program gives a count of X instructions executed, and of Y for my parallel program, all OK, except for the fact that X=Y.

I assume Cachegrind is not for threads? Any other tools I could use?

Upvotes: 2

Views: 899

Answers (1)

gby
gby

Reputation: 15218

You can use perf to get the information you want from the hardware performance counters.

try:

$ perf stat -e cache-misses,cache-references /bin/ls /tmp/
...

Performance counter stats for '/bin/ls /tmp/':

             3,534 cache-misses              #   16.605 % of all cache refs    
            21,283 cache-references                                            

       0.001649284 seconds time elapsed

Upvotes: 2

Related Questions