性能計數器和 IMC 計數器不匹配 (Performance Counters and IMC Counter Not Matching)


問題描述

性能計數器和 IMC 計數器不匹配 (Performance Counters and IMC Counter Not Matching)

我有一個 Intel(R) Core(TM) i7‑4720HQ CPU @ 2.60GHzHaswell)處理器。在相對空閒的情況下,我運行了以下 Perf 命令,它們的輸出如下所示,下面。計數器是 offcore_response.all_data_rd.l3_miss.any_responsemem_load_uops_retired.l3_miss

sudo perf stat ‑a ‑e offcore_response.all_data_rd.l3_miss.any_response,mem_load_uops_retired.l3_miss sleep 10

 Performance counter stats for 'system wide':

     3,713,037      offcore_response.all_data_rd.l3_miss.any_response                                   

     2,909,573      mem_load_uops_retired.l3_miss


  10.016644133 seconds time elapsed

這兩個值似乎一致,因為後者排除 預取請求和那些針對DRAM的請求。但它們確實匹配 IMC 中的讀取計數器。此計數器稱為 UNC_IMC_DRAM_DATA_READS 並記錄在 這裡。我在 read 計數器 reread1 秒後。差異約為 30,000,000 (EDITED)。如果 乘以 10(估計 10 秒),結果值將約為 300 百萬 (已編輯),即 100 上述性能計數器(EDITED)的值。它無處接近 3 百萬!我缺少什麼


PS:差異要小很多(但仍然很大),當系統有更多負載時。

問題也在這裡提出:https://community.intel.com/t5/Software‑Tuning‑Performance/Performance‑Counters‑and ‑IMC‑Counter‑Not‑Matching/mp/1288832

UNC_IMC_DRAM_DATA_WRITESUNC_IMC_DRAM_IO_REQUESTS。似乎 classified 作為 IO 的請求將 READWRITE。換句話說,在描述一秒的時間間隔內,幾乎(因為不准確報告了在上述文檔中) 2.01GB of 2.42GB READWRITE 請求 belongIO。根據this的解釋,上面的三個列似乎一致彼此。

問題是仍然存在IMCPMC 值之間存在 LARGE 差距!

情況相同當我在 runlevel 1 中啟動時。調度器上的進程其中一個 swapper, kworker遷移磁盤 IO 幾乎是 85KB/s。我想知道什麼會導致如此(相對)巨大數量的IO。是否有可能檢測(例如,使用counter工具)?


更新 2:

我認為 IO 列存在錯誤。它總是[1.99,2.01]範圍內,不管系統中的負載量如何!


更新 3:

runlevel 1 中,uops_retired 的 平均 出現次數1 秒間隔 中的 .all 事件為 15,000,000。在同一期間,相關IMC計數器記錄的讀取請求數約為30,000,000。換句話說,假設所有內存訪問都是由cpu指令直接引起的,對於每個退休的微操作,存在兩個內存訪問。這似乎 不可能,特別是關於存在 多個 級緩存的事實。因此,在空閒場景中,read訪問可能是由IO引起的。


參考解法

方法 1:

Actually, it was mostly caused by the GPU device. This was the reason for exclusion from performance counters. Here is the relevant output for a sample execution of PCM on a relatively idle system with resolution 3840x2160 and refresh rate 60 using xrandr: Relevant PCM Output for High‑Resolution Case And this is for the situation with resolution 800x600 and the same refresh rate (i.e., 60): Relevant PCM Output for Low‑Resolution Case As can be seen, changing screen resolution reduced read and IO traffic considerably (more than 100x!).

(by TheAhmadTheAhmad)

參考文件

  1. Performance Counters and IMC Counter Not Matching (CC BY‑SA 2.5/3.0/4.0)

#perf #linux-kernel #memory-access #performancecounter #intel-pmu






相關問題

使用 perf 或其他方式獲取 C 程序的運行時間(或其他統計信息) (Getting running time (or other stats) for C Program using perf or otherwise)

使用 perf_events/oprofile 在 Linux 上分析 JIT 的輸出? (Profiling output of JIT on Linux with perf_events/oprofile?)

如何提出高緩存未命中率示例? (How to come up with a high cache miss rate example?)

perf 關於嵌套函數的最佳結果 (perf top result about nested functions)

Haswell 微架構在 perf 中沒有 Stalled-cycles-backend (Haswell microarchitecture don't have Stalled-cycles-backend in perf)

perf 如何使用 offcore 事件? (How does perf use the offcore events?)

外部化 react 和 react-dom 依賴項是否會增加反應應用程序的加載時間 (Does externalising react and react-dom dependencies give a gain in load time of a react app)

使用 PERF_EVENT_IOC_PERIOD 在運行時更改採樣週期 (Usage of PERF_EVENT_IOC_PERIOD to change sampling period during runtime)

理解 perf stat 輸出中的數字 (Make sense of numbers in perf stat output)

perf_event_open 權限被拒絕,除了使用 sudo 或更改 perf_event_paranoid 文件之外,還有其他方法嗎? (Permission denied on perf_event_open, is there another way than to use sudo or changing the perf_event_paranoid file?)

有選擇地為特定參數記錄內核 Ftrace 點 (Logging the kernel Ftrace point selectively for particular arguments)

性能計數器和 IMC 計數器不匹配 (Performance Counters and IMC Counter Not Matching)







留言討論