perf常用命令(perf top perf record perf stat)
perf ?top
通過-e指定關注的事件,比如查看造成cache miss最多的函數排行
perf top -e cache-misses
perf?top?-e task-clock?
perf top -G // 得到調用關系圖
perf top-e cache-misses?-G // 得到調用關系圖
perf top -e cycles // 指定性能事件
perf top -p 23015,32476 //查看這兩個進程的cpu cycles使用情況
perf top -s comm,pid,symbol // 顯示調用symbol的進程名和進程號
perf top --comms nginx,top // 僅顯示屬于指定進程的符號
perf top --symbols kfree // 僅顯示指定的符號
?
perf stat
perf stat -e task-clock -e context-switches -p ?進程號
perf stat -e stalled-cycles-frontend -p ?進程號
perf ?stat -r ?50 ls?
Perf可以幫你統計N次結果的數值波動情況:
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 命令可以列出所有能夠觸發 perf 采樣點的事件。
Hardware Event 是由 PMU 硬件產生的事件,比如 cache 命中,當您需要了解程序對硬件特性的使用情況時,便需要對這些事件進行采樣;
Software Event 是內核軟件產生的事件,比如進程切換,tick 數等 ;
Tracepoint event 是內核中的靜態 tracepoint 所觸發的事件,這些 tracepoint 用來判斷程序運行期間內核的行為細節,比如 slab 分配器的分配次數等。
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]
? .............??
?
總結
以上是生活随笔為你收集整理的perf常用命令(perf top perf record perf stat)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 讯时新闻系统再探
- 下一篇: html怎么让两个div重叠,如何将一个