tags:

views:

170

answers:

2

I'm trying to use Shark to check for L2 cache misses, but it won't work. All of the other Shark sampling modes work fine.

A: 

Not all CPUs support L2 cache miss profiling (it depends on what performance registers the CPU has).

Also note that you only get a sample every N cache misses, so if your code is not doing much (i.e. not accessing uncached memory) then you may not see any samples.

Paul R
What cpus have l2 cache miss profiling? How can I check CPU's ability of measuring it?
osgx
@osgx: I guess you could just try collecting some samples on whatever CPU you have and see whether it works. What Mac and CPU do you have ?
Paul R
I guess all modern intel cpus (capable of running mac os x 10.5) support cache miss perf events.
osgx
A: 

... a little late, but chances are, some reason, Shark didn't detect which CPU you are using and assumes you don't have the appropriate hardware performance counters.

  1. Config->Edit
  2. flip the View dropdown from Simple to Advanced
  3. flip the CPU dropdown from "Current (Unknown)" to your CPU
  4. Enable the performance counters of interest. E.g., L2_line_in .

Check out the Intel architecture manuals (#3 I think) for what perf counter does what -- unfortunately, there are often no direct L1/L2/LLC miss counters so you'll need some combination of other counters or use another as an estimate.

leo