bholanath
bholanath

Reputation: 1753

L2 cache lines miss count

I want to calculate total no of L2 cache miss while I am running one particular program A. Is there any way to find cache miss in L2 cache ?

I got to know, Core i7 CPU's performance counter event types "L2_LINES_OUT " is available to Counts L2 cache lines evicted, but don't know how to use it ?

I am using linux and Intel i7 IvyBridge machine.

Any pointer or link will be highly appreciated .

Upvotes: 4

Views: 1037

Answers (3)

user2184572
user2184572

Reputation: 1

Search PAPI, it is a tool that you can use to read the PMU before and after the code segment you want to collect the L2 cache misses.

Upvotes: 0

Leeor
Leeor

Reputation: 19706

According to this summary, you can use the l2_rqsts subevents:

0x01: (name=demand_data_rd_hit) Demand Data Read requests that hit L2 cache
0x03: (name=all_demand_data_rd) Demand Data Read requests
0x04: (name=rfo_hit) RFO requests that hit L2 cache
0x08: (name=rfo_miss) RFO requests that miss L2 cache
0x0c: (name=all_rfo) RFO requests to L2 cache
0x10: (name=code_rd_hit) L2 cache hits when fetching instructions, code reads.
0x20: (name=code_rd_miss) L2 cache misses when fetching instructions
0x30: (name=all_code_rd) L2 code requests
0x40: (name=pf_hit) Requests from the L2 hardware prefetchers that hit L2 cache
0x80: (name=pf_miss) Requests from the L2 hardware prefetchers that miss L2 cache
0xc0: (name=all_pf) Requests from L2 hardware prefetchers 

You can just use - (all_demand_data_rd - demand_data_rd_hit) to count the demand misses

Upvotes: 2

Baldrick
Baldrick

Reputation: 11840

The IBM documentation here might be helpful.

It describes various expressions for many different metrics on Ivybridge. The one you want appears to be

 *Instruction fetch from L2 cache miss rate*
 100.0 * X_L2_RQSTS_IFETCH_MISS / X_L2_RQSTS_IFETCHES

Upvotes: 1

Related Questions