Performance PAPI反问题

Performance PAPI反问题,performance,intel,papi,Performance,Intel,Papi,我编写了以下代码来获取三级缓存未命中信息 #include <stdlib.h> #include <stdio.h> #include <math.h> #include <papi.h> int main( int argc, char *argv[] ) { int i; long long counters[3]; counters[0] = counters[1] = counters[2] = 0; int PAPI

我编写了以下代码来获取三级缓存未命中信息

#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <papi.h>

int main( int argc, char *argv[] ) {
  int i;

  long long counters[3];
  counters[0] = counters[1] = counters[2] = 0;
  int PAPI_events[] = {
    PAPI_TOT_CYC,
    PAPI_L3_TCM,
    PAPI_L3_DCA };

  PAPI_library_init(PAPI_VER_CURRENT);

  i = PAPI_start_counters(PAPI_events, 3);

  printf("Measuring instruction count for this printf\n");

  PAPI_read_counters(counters, 3);

  printf("%lld L3 cache misses %lld L3 cache accesses in %lld cycles"
   counters[1], counters[2], counters[0] );

  return 0;
}
我用papi_avail-a检查了可用的计数器,这些计数器似乎得到了支持。CPU信息如下所示

Available events and hardware information.
--------------------------------------------------------------------------------
PAPI Version             : 5.1.1.0
Vendor string and code   : GenuineIntel (1)
Model string and code    : Intel(R) Xeon(R) CPU E7- 4830  @ 2.13GHz (47)
CPU Revision             : 2.000000
CPUID Info               : Family: 6  Model: 47  Stepping: 2
CPU Max Megahertz        : 2128
CPU Min Megahertz        : 2128
Hdw Threads per core     : 1
Cores per Socket         : 8
NUMA Nodes               : 4
CPUs per Node            : 8
Total CPUs               : 32
Running in a VM          : no
Number Hardware Counters : 7
Max Multiplex Counters   : 64
uname输出

2.6.32-431.17.1.el6.x86_64 #1 SMP Fri Apr 11 17:27:00 EDT 2014 x86_64 x86_64 x86_64 GNU/Linux

您是否从root用户运行该程序?为什么要在这么现代的CPU上使用这么旧的内核?我没有机器的根访问权限。不幸的是,这是系统中存在的版本。chamibuddhika,L3事件可能需要root,因为我相信这些事件在“uncore”PMU中。-没有root用户,您无法访问非核心计数器;尝试L1和L2事件。
2.6.32-431.17.1.el6.x86_64 #1 SMP Fri Apr 11 17:27:00 EDT 2014 x86_64 x86_64 x86_64 GNU/Linux