如何在Java程序中获取Intel CPU上的CPU性能统计数据?

时间:2016-01-10 19:08:27

标签: java c++ cpu intel performancecounter

有一些名为Intel Performance Counter Monitor的东西,可以为您提供事件的统计数据,例如;

 EXEC  : instructions per nominal CPU cycle
 IPC   : instructions per CPU cycle
 FREQ  : relation to nominal CPU frequency='unhalted clock ticks'/'invariant timer ticks' (includes Intel Turbo Boost)
 AFREQ : relation to nominal CPU frequency while in active state (not in power-saving C state)='unhalted clock ticks'/'invariant timer ticks while in C0-state'  (includes Intel Turbo Boost)
 L3MISS: L3 cache misses 
 L2MISS: L2 cache misses (including other core's L2 cache *hits*) 
 L3HIT : L3 cache hit ratio (0.00-1.00)
 L2HIT : L2 cache hit ratio (0.00-1.00)
 L3MPI : number of L3 cache misses per instruction
 L2MPI : number of L2 cache misses per instruction
 READ  : bytes read from memory controller (in GBytes)
 WRITE : bytes written to memory controller (in GBytes)
 IO    : bytes read/written due to IO requests to memory controller (in GBytes); this may be an over estimate due to same-cache-line partial requests
 TEMP  : Temperature reading in 1 degree Celsius relative to the TjMax temperature (thermal headroom): 0 corresponds to the max temperature
 energy: Energy in Joules


 Core (SKT) | EXEC | IPC  | FREQ  | AFREQ | L3MISS | L2MISS | L3HIT | L2HIT | L3MPI | L2MPI | TEMP

   0    0     0.10   0.52   0.19    0.74    1502 K   3612 K    0.58    0.53    0.00    0.01     43
   1    0     0.19   0.67   0.28    0.80    1548 K   3090 K    0.50    0.69    0.00    0.00     46
   2    0     0.06   0.48   0.13    0.73    1060 K   1768 K    0.40    0.57    0.01    0.01     46
   3    0     0.07   0.55   0.12    0.72    1142 K   1489 K    0.23    0.47    0.01    0.01     42
   4    0     0.06   0.54   0.10    0.75     894 K   2102 K    0.57    0.50    0.00    0.01     43
   5    0     0.04   0.49   0.09    0.73     669 K   1377 K    0.51    0.57    0.00    0.01     46
   6    0     0.03   0.43   0.08    0.73     888 K   1543 K    0.42    0.30    0.01    0.01     46
   7    0     0.24   0.80   0.29    0.90    1285 K   2132 K    0.40    0.78    0.00    0.00     42
---------------------------------------------------------------------------------------------------------------
 SKT    0     0.10   0.61   0.16    0.78    8992 K     17 M    0.47    0.61    0.00    0.01     42
---------------------------------------------------------------------------------------------------------------
 TOTAL  *     0.10   0.61   0.16    0.78    8992 K     17 M    0.47    0.61    0.00    0.01     N/A

 Instructions retired: 2702 M ; Active cycles: 4420 M ; Time (TSC): 3411 Mticks ; C0 (active,non-halted) core residency: 20.75 %

 C1 core residency: 21.34 %; C3 core residency: 11.65 %; C6 core residency: 46.26 %; C7 core residency: 0.00 %;
 C2 package residency: 0.00 %; C3 package residency: 0.00 %; C6 package residency: 0.00 %; C7 package residency: 0.00 %;

 PHYSICAL CORE IPC                 : 1.22 => corresponds to 30.57 % utilization for cores in active state
 Instructions per nominal CPU cycle: 0.20 => corresponds to 4.95 % core utilization over time interval
---------------------------------------------------------------------------------------------------------------

          |  READ |  WRITE |    IO  | CPU energy |
---------------------------------------------------------------------------------------------------------------
 SKT   0     2.03     0.94     1.31      18.18     
---------------------------------------------------------------------------------------------------------------

现在,该软件还可以选择从程序内部调用。如果在该程序中调用某些函数,它会为您提供这些函数的统计信息,如示例中所示。我的问题是所有的软件,库和代码部分都是用C ++编写的。当我在互联网上搜索时,一些人聚在一起,开了一个开源项目作为Java Performance Counter Monitor。但是,该项目最后一次更新于2011 - 2012年,甚至该网站都是在Sun下构建的,并不确定它是否可以在Java 8下运行。

所以我的问题是有任何性能分析程序或关于如何在我的Java程序中使用IPCM的任何建议吗?

0 个答案:

没有答案