日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

i5 1240p使用perf避坑指南

發布時間:2024/3/13 编程问答 34 豆豆
生活随笔 收集整理的這篇文章主要介紹了 i5 1240p使用perf避坑指南 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

新入手了一臺小米迷你主機,CPU是英特爾的十二代i5 1240p,intel i5 1240p微架構屬于alder lake,有4個大核,8個小核,每個大核有兩個線程,因此,該CPU多線程能力為12核16線程。最近在研究性能剖析相關的知識,沒想到遇到了不少坑,記于此。

Perf on WSL(cycles:u not supported)

首先嘗試了在windows wsl中使用perf

$ sudo apt install linux-tools-generic

安裝的可執行程序位于/usr/lib/linux-tools/\<kernel version>/perf

$ perf stat ls Performance counter stats for 'ls':0.76 msec task-clock:u # 0.706 CPUs utilized0 context-switches:u # 0.000 /sec0 cpu-migrations:u # 0.000 /sec113 page-faults:u # 149.431 K/sec<not supported> cycles:u<not supported> instructions:u<not supported> branches:u<not supported> branch-misses:u0.001070439 seconds time elapsed0.001058000 seconds user0.000000000 seconds sys

查看pmu驅動,結果是這樣的

$ dmesg | grep PMU$ dmesg | grep PMU [ 0.094674] Performance Events: unsupported p6 CPU model 154 no PMU driver, software events only. $ lscpu Architecture: x86_64 CPU op-mode(s): 32-bit, 64-bit Byte Order: Little Endian Address sizes: 39 bits physical, 48 bits virtual CPU(s): 16 On-line CPU(s) list: 0-15 Thread(s) per core: 2 Core(s) per socket: 8 Socket(s): 1 Vendor ID: GenuineIntel CPU family: 6 Model: 154 Model name: 12th Gen Intel(R) Core(TM) i5-1240P Stepping: 3 CPU MHz: 2112.007 BogoMIPS: 4224.01 Virtualization: VT-x Hypervisor vendor: Microsoft Virtualization type: full L1d cache: 384 KiB L1i cache: 256 KiB L2 cache: 10 MiB L3 cache: 12 MiB Vulnerability Itlb multihit: Not affected Vulnerability L1tf: Not affected Vulnerability Mds: Not affected Vulnerability Meltdown: Not affected Vulnerability Mmio stale data: Not affected Vulnerability Retbleed: Mitigation; Enhanced IBRS Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl and seccomp Vulnerability Spectre v1: Mitigation; usercopy/swapgs barriers and __user pointer sanitization Vulnerability Spectre v2: Mitigation; Enhanced IBRS, IBPB conditional, RSB filling, PBRSB-eIBRS SW sequence Vulnerability Srbds: Not affected Vulnerability Tsx async abort: Not affected Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc rep_good nopl xtopology tsc_reliable nonstop_tsc cpuid pni pclmulqdq vmx ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch invpcid_single ssbd ibrs ibpb stibp ibrs_enhanced tpr_shadow vnmi ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid rdseed adx smap clflushopt clwbsha_ni xsaveopt xsavec xgetbv1 xsaves avx_vnni umip waitpkg gfni vaes vpclmulqdq rdpidmovdiri movdir64b fsrm serialize flush_l1d arch_capabilities

Flags中沒有看到arch_perfmon,也就是說Hardware Performance Monitor沒有使能

Perf On Hyper-V

再試一下通過Hyper-V行不行,我已經使能了Hyper-V,然后通過微軟這篇官方[1]文檔使能pmu

$ # Enable IPT Set-VMProcessor MyVMName -Perfmon @("ipt", "pmu")

再啟動Hyper-V虛擬機,直接報錯找不到系統監視器,啟動失敗

小米迷你主機安裝Ubuntu

一開始安裝的20.04,發現wifi驅動沒有適配,為了省事,直接安裝22.04。裝完之后,pmu能正常使用了。

Performance counter stats for 'ls':0.78 msec task-clock # 0.548 CPUs utilized 0 context-switches # 0.000 /sec 0 cpu-migrations # 0.000 /sec 91 page-faults # 116.387 K/sec 1,448,050 cpu_core/cycles/ # 1.852 G/sec <not counted> cpu_atom/cycles/ (0.00%)1,749,783 cpu_core/instructions/ # 2.238 G/sec <not counted> cpu_atom/instructions/ (0.00%)325,300 cpu_core/branches/ # 416.052 M/sec <not counted> cpu_atom/branches/ (0.00%)9,590 cpu_core/branch-misses/ # 12.265 M/sec <not counted> cpu_atom/branch-misses/ (0.00%)0.001426852 seconds time elapsed0.001447000 seconds user0.000000000 seconds sys

推薦一個燒錄鏡像工具,Rufus,功能簡單清晰

參考文獻

[1]: https://learn.microsoft.com/zh-cn/windows-server/virtualization/hyper-v/manage/performance-monitoring-hardware

總結

以上是生活随笔為你收集整理的i5 1240p使用perf避坑指南的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。