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

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

perf常用命令(perf top perf record perf stat)

發(fā)布時(shí)間:2024/3/13 编程问答 68 豆豆
生活随笔 收集整理的這篇文章主要介紹了 perf常用命令(perf top perf record perf stat) 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

perf ?top

通過-e指定關(guān)注的事件,比如查看造成cache miss最多的函數(shù)排行

perf top -e cache-misses

perf?top?-e task-clock?

perf top -G // 得到調(diào)用關(guān)系圖

perf top-e cache-misses?-G // 得到調(diào)用關(guān)系圖

perf top -e cycles // 指定性能事件

perf top -p 23015,32476 //查看這兩個(gè)進(jìn)程的cpu cycles使用情況

perf top -s comm,pid,symbol // 顯示調(diào)用symbol的進(jìn)程名和進(jìn)程號(hào)

perf top --comms nginx,top // 僅顯示屬于指定進(jìn)程的符號(hào)

perf top --symbols kfree // 僅顯示指定的符號(hào)

?

perf stat

perf stat -e task-clock -e context-switches -p ?進(jìn)程號(hào)
perf stat -e stalled-cycles-frontend -p ?進(jìn)程號(hào)

perf ?stat -r ?50 ls?

Perf可以幫你統(tǒng)計(jì)N次結(jié)果的數(shù)值波動(dòng)情況:

perf stat --repeat 5 -e kmem:mm_page_pcpu_drain -e ?kmem:mm_page_alloc -e kmem:mm_pagevec_free -e kmem:mm_page_free_direct ./t2 ?10

?

perf record -a? ???

perf report

?

perf record –e cpu-clock ?./t1

perf report

?

Perf list,perf 事件

使用 perf list 命令可以列出所有能夠觸發(fā) perf 采樣點(diǎn)的事件。

Hardware Event 是由 PMU 硬件產(chǎn)生的事件,比如 cache 命中,當(dāng)您需要了解程序?qū)τ布匦缘氖褂们闆r時(shí),便需要對(duì)這些事件進(jìn)行采樣;

Software Event 是內(nèi)核軟件產(chǎn)生的事件,比如進(jìn)程切換,tick 數(shù)等 ;

Tracepoint event 是內(nèi)核中的靜態(tài) tracepoint 所觸發(fā)的事件,這些 tracepoint 用來判斷程序運(yùn)行期間內(nèi)核的行為細(xì)節(jié),比如 slab 分配器的分配次數(shù)等。

List of pre-defined events (to be used in -e):
? cpu-cycles OR cycles ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? [Hardware event]
? instructions ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? [Hardware event]
? cache-references ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? [Hardware event]
? cache-misses ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?[Hardware event]
? branch-instructions OR branches ? ? ? ? ? ? ? ? ? ?[Hardware event]
? branch-misses ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? [Hardware event]
? bus-cycles ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? [Hardware event]
? stalled-cycles-frontend OR idle-cycles-frontend ? ?[Hardware event]
? stalled-cycles-backend OR idle-cycles-backend ? ? ?[Hardware event]
? ref-cycles ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? [Hardware event]

? cpu-clock ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? [Software event]
? task-clock ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? [Software event]
? page-faults OR faults ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?[Software event]
? context-switches OR cs ? ? ? ? ? ? ? ? ? ? ?[Software event]
? cpu-migrations OR migrations ? ? ? ? ? ? ? ? ? ? ? [Software event]
? minor-faults ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? [Software event]
? major-faults ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? [Software event]
? alignment-faults ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? [Software event]
? emulation-faults ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? [Software event]

? L1-dcache-loads ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?[Hardware cache event]
? L1-dcache-load-misses ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?[Hardware cache event]
? L1-dcache-stores ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? [Hardware cache event]
? L1-dcache-store-misses ? ? ? ? ? ? ? ? ? ? ? ? ? ? [Hardware cache event]
? L1-dcache-prefetches ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? [Hardware cache event]
? L1-dcache-prefetch-misses ? ? ? ? ? ? ? ? ? ? ? ? ?[Hardware cache event]
? L1-icache-loads ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?[Hardware cache event]
? L1-icache-load-misses ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?[Hardware cache event]
? L1-icache-prefetches ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? [Hardware cache event]
? L1-icache-prefetch-misses ? ? ? ? ? ? ? ? ? ? ? ? ?[Hardware cache event]
? LLC-loads ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?[Hardware cache event]
? LLC-load-misses ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?[Hardware cache event]
? LLC-stores ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? [Hardware cache event]
? LLC-store-misses ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? [Hardware cache event]
? LLC-prefetches ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? [Hardware cache event]
? LLC-prefetch-misses ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?[Hardware cache event]
? dTLB-loads ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? [Hardware cache event]
? dTLB-load-misses ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? [Hardware cache event]
? dTLB-stores ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?[Hardware cache event]
? dTLB-store-misses ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?[Hardware cache event]
? dTLB-prefetches ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?[Hardware cache event]
? dTLB-prefetch-misses ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? [Hardware cache event]

? iTLB-loads ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? [Hardware cache event]
? iTLB-load-misses ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? [Hardware cache event]
? branch-loads ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? [Hardware cache event]
? branch-load-misses ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? [Hardware cache event]
? node-loads ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? [Hardware cache event]
? node-load-misses ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? [Hardware cache event]
? node-stores ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?[Hardware cache event]
? node-store-misses ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?[Hardware cache event]
? node-prefetches ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?[Hardware cache event]
? node-prefetch-misses ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? [Hardware cache event]

? mem:<addr>[:access] ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?[Hardware breakpoint]

? sunrpc:rpc_call_status ? ? ? ? ? ? ? ? ? ? ? ? ? ? [Tracepoint event]
? sunrpc:rpc_bind_status ? ? ? ? ? ? ? ? ? ? ? ? ? ? [Tracepoint event]
? sunrpc:rpc_connect_status ? ? ? ? ? ? ? ? ? ? ? ? ?[Tracepoint event]
? sunrpc:rpc_task_begin ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?[Tracepoint event]
? sunrpc:rpc_task_run_action ? ? ? ? ? ? ? ? ? ? ? ? [Tracepoint event]

? .............??

?

總結(jié)

以上是生活随笔為你收集整理的perf常用命令(perf top perf record perf stat)的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。