Perf
perf ("Perf Events"[1]あるいは"perf tools"。元々は"Performance Counters for Linux"やPCLと呼ばれていた[2])は、Linuxカー�…
perf ("Perf Events"[1]あるいは"perf tools"。元々は"Performance Counters for Linux"やPCLと呼ばれていた[2])は、Linuxカーネル2.6.31以降で使用可能な、Linuxの性能解析ツールである[3]。
'perf'というユーザースペースの操作ユーティリティーは、Gitのようなサブコマンドを持つインターフェースを採用している。このユーティリティーは、システム全体(カーネル及びユーザーコードの両方)、シングルCPU、あるいは数スレッドの統計プロファイリングが可能である。
また、perfはハードウェアパフォーマンスカウンタ、トレースポイント、ソフトウェアパフォーマンスカウンタ(例: hrtimer)、ダイナミックプローブ(例: kprobesやuprobes)をサポートしている[4]。
2012年、IBMは(OProfileとともに)perfを、Linuxで使われる最も一般的な二つのパフォーマンスカウンタプロファイリングツールのうちの一つであると認めた[5]。
サブコマンド
perfは以下のようなサブコマンドとともに使用する。
stat: 一つのプログラムやある時間でのシステムのトータルイベントカウントを測るtop: topライクな最も使用された関数の動的表示record: 一つのプログラムのサンプリングレートを測り保存する[6]report: perf recordによって生成されたファイルを分析(perf recordはフラットやグラフプロファイリングが生成可能)[6]annotate: ソースまたはアセンブリを注解するsched: スケジューラー動作とレイテンシのトレース・測定[7]list: 利用可能なイベントを一覧する
実装
このユーティリティとカーネル間のインターフェースは一つのシステムコールのみからなり、ファイルディスクリプタとmmapされたメモリ領域を通して完了する[8]。
oprofileやLTTngとは違い、サービスデーモンは不要であり、大部分の機能はカーネルに統合されている。perfユーティリティは定期的にmmapされたバッファーからディスクへと生データをダンプする。
R. Vitillo(LBNL)は、「perfは低オーバーヘッドのプロファイリングツールである」と述べている[8]。
2010年時点で、ハードウェアカウンターのサポートをするアーキテクチャは以下の通りである。x86、PowerPC64、UltraSPARC (III及びIV)、ARM(v5、v6、v7、Cortex-A8及び-A9)、Alpha EV56、SH[4]。
新しいインテルCPUにおけるLast Branch Recordsとbranch tracingの実装の使用はパッチを適用するで利用できる[8]。
perfはRHEL6[9]、Debian Squeeze[10]やその他のポピュラーなLinuxディストリビューションで対応されている。
批評
perfのドキュメントはあまり詳しくなく(2012年時点)、たとえば、大部分のイベントやそれらのエイリアスがドキュメント化されていない。また、perf toolsは、本当のwall-clock時間に基づいたプロファイリングを行えない[11]。
Linuxカーネル 2.6.37から3.8.8までおよびRHEL6カーネル 2.6.32のPerfサブシステムは、ローカルユーザーからroot特権へと昇格可能なことが実証されたセキュリティ脆弱性が含まれる(CVE-2013-2094)[12][13]。この問題は、event_idの検証コードパスにおいて、間違った型(64ビットの代わりに32ビットint)を使用したことが原因であった[14]。
関連項目
出典
- ^ Vince Weaver, The Unofficial Linux Perf Events Web-Page
- ^ Vince Weaver. “Linux perf event Features and Overhead”. 2013 FastPath Workshop. 2013年10月1日閲覧。
- ^ Jake Edge, Perfcounters added to the mainline, LWN July 1, 2009, "perfcounters being included into the mainline during the recently completed 2.6.31 merge window"
- ^ a b Arnaldo Carvalho de Melo, The New Linux ’perf’ tools, presentation from Linux Kongress, September, 2010
- ^ A. Zanella, R. Arnold. Evaluate performance for Linux on POWER. Analyze performance using Linux tools, 12 Jun 2012 // IBM DeveloperWorks Technical library
- ^ a b Urs Fässler perf file format, CERN OpenLab, 2011
- ^ Ingo Molnar, 'perf sched': Utility to capture, measure and analyze scheduler latencies and behavior, 17 Sep 2009
- ^ a b c Roberto A. Vitillo (LBNL). PERFORMANCE TOOLS DEVELOPMENTS, 16 June 2011, presentation from "Future computing in particle physics" conference
- ^ 6.4. Performance Counters for Linux (PCL) Tools and perf // RHEL Developer Guide
- ^ http://packages.debian.org/squeeze/linux-tools-2.6.32
- ^ http://rhaas.blogspot.ru/2012/06/perf-good-bad-ugly.html
- ^ Michael Larabel (2013年5月15日). “New Linux Kernel Vulnerability Exploited”. Phoronix. 2013年7月18日閲覧。
- ^ corbet (2013年5月15日). “Local root vulnerability in the kernel”. LWN. 2013年7月18日閲覧。
- ^ Joe Damato (2013年5月20日). “A closer look at a recent privilege escalation bug in Linux (CVE-2013-2094)”. 2013年7月18日閲覧。
外部リンク
- perf's wiki on kernel.org
- Arnaldo Carvalho de Melo, The New Linux ’perf’ tools, presentation from Linux Kongress, September, 2010
- Linux kernel profiling with perf tutorial
- Hardware PMU support charts - check perf_event column
Content Disclaimer
Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.
- The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
- There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
- It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
- Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
- Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.