問題描述
性能計數器和 IMC 計數器不匹配 (Performance Counters and IMC Counter Not Matching)
我有一個 Intel(R) Core(TM) i7‑4720HQ CPU @ 2.60GHz
(Haswell
)處理器。在相對空閒的情況下,我運行了以下 Perf
命令,它們的輸出如下所示,下面。計數器是 offcore_response.all_data_rd.l3_miss.any_response
和 mem_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 計數器 reread 它 1
秒後。差異約為 30,000,000
(EDITED)。如果 乘 乘以 10
(估計 10
秒),結果值將約為 300
百萬 (已編輯),即 100
次 上述性能計數器(EDITED)的值。它無處接近 3
百萬!我缺少什麼?
PS:差異要小很多(但仍然很大),當系統有更多負載時。
、UNC_IMC_DRAM_DATA_WRITES
和 UNC_IMC_DRAM_IO_REQUESTS
。似乎 classified 作為 IO
的請求將 被 READ
或 WRITE
。換句話說,在描述一秒的時間間隔內,幾乎(因為不准確報告了在上述文檔中) 2.01
GB of 2.42
GB READ
和 WRITE
請求 belong 到 IO
。根據this的解釋,上面的三個列似乎一致彼此。 問題是仍然存在IMC
和 PMC
值之間存在 LARGE 差距!
情況相同當我在 runlevel 1
中啟動時。調度器上的進程是其中一個 swapper
, kworker
和 遷移
。磁盤 IO 幾乎是 85
KB/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: And this is for the situation with resolution 800x600
and the same refresh rate (i.e., 60
): As can be seen, changing screen resolution reduced read and IO traffic considerably (more than 100x
!).