counting L1 cache misses with PAPI_read_counters gives unexpected results
问题 I am trying to use PAPI library to count cache misses. cache hit performance counter is not available on my hardware, that's why I am trying to determine cache hits with no cache misses. I am trying few things. First version of my code is this: int numEvents = 2; long long values[2]; int events[2] = {PAPI_L1_DCM, PAPI_L2_TCM}; if (PAPI_start_counters(events, numEvents) != PAPI_OK ) // !=PAPI_OK printf("PAPI error: %d\n", 1); for(int i=0; i < arr_size; i++) { array[i].value = 1; } _mm_mfence()