Cache miss counts using PAPI

Open discussion of PAPI.

Cache miss counts using PAPI

Postby nf14 » Tue Feb 23, 2010 1:02 pm

I am trying to measure L1 cache miss for a code segment using papi_start and stop. I her my ave two issues:

1. After the execution of the program segment, i counted the values by calling read.


do domething()

after read();


after stop()

the after stop() values are slightly higher that after read() values. What might be the reason here? I am not performing any other task in between.

2. If someone else is also running some other code (and not using papi), will it effect the cache miss count? Will PAPI only count misses for my code segment or all cache misses happened during that time interval?

Posts: 4
Joined: Sun Feb 14, 2010 2:36 am

Re: Cache miss counts using PAPI

Postby Dan Terpstra » Tue Feb 23, 2010 1:42 pm

1. PAPI code is still code that continues to affect the caches. It's natural to see a small increase in cache misses when PAPI code is executing. PAPI_read leaves the counters on, so cache misses can still occur. You shouldn't need to do another read in the after_stop call, because PAPI does an implicit read when it stops the counters. The values from PAPI_stop and after_stop should be the same.
2. Yes, if other code is executing, whether or not it is using PAPI, it can affect the cache footprint for your application and causes changes in the measured cache miss value. the counter values themselves are saved between context switches, but that doesn't prevent one application from polluting the cache of another.
Dan Terpstra

Re: Cache miss counts using PAPI

Postby Dan Terpstra » Tue Feb 23, 2010 1:47 pm

2. I should clarify: PAPI will only count L1 cache misses for your code, but the number of cache misses can be affected by what other code is doing. If you are measuring code in process A and get task-switched out while process B does something data intensive that completely flushes L1 cache, the cache will need to be reloaded for process A when it is switched back in, causing a significant increase in misses.
Dan Terpstra

Return to General discussion (read-only)

Who is online

Users browsing this forum: No registered users and 2 guests