title: Measure L1 data cache miss with perf and papi
body: <p>What is the difference between <code>PAPI_L1_LDM</code> in papi and <code>L1-dcache-load-misses</code> in perf?</p>
  
  <p>I've used the same setting, like <a href="https://stackoverflow.com/questions/39709328/why-does-perf-and-papi-give-different-values-for-l3-cache-references-and-misses">this post here</a>.</p>
  
  <p>So, as a result I get for papi:</p>
  
  <pre><code>PAPI_L1_DCM: 515 &lt;- L1 data cache miss (probably L1D_READ_MISSES_ALL + L1D_READ_MISSES_RETRIED?)
  PAPI_L1_ICM: 300 &lt;- L1 Instruction cache miss
  PAPI_L1_LDM: 441 &lt;- L1 Load data miss
  PAPI_L1_TCM: 815 &lt;- L1 Total cache miss
  </code></pre>
  
  <p>Unfortunately <code>PAPI_L1_DCA</code> is not supported at this machine.</p>
  
  <p>And for perf (only in the user-space, since papi measures also only user-space and no kernel space):
  call: <code>perf stat -B -e L1-dcache-load-misses:u,cache-misses:u ./perf</code></p>
  
  <pre><code>    16,539      L1-dcache-load-misses
         128      cache-misses:u  
  </code></pre>
  
  <p>16,539 seems to be more reasonable for <code>N=1000000</code>. What is the difference between a load-data-miss (PAPI_L1_LDM in papi) and a data cache miss (PAPI_L1_DCM in papi) and why do these numbers differ in papi and perf? Is the <code>cache-misses:u</code> in perf related to the L2 cache-misses?</p>
  
  <p>edit: Hardware (Xeon E5-2600 v3 family, Haswell-EP 12 cores)</p>