Add runtime control for `profiling.sampling`
まだ誰も着手していません。
- 主要言語
- Python
- スター
- 77.2k
- フォーク
- 35.9k
- PR マージ指標
- PR 指標を取得中
説明
Feature or enhancement
Proposal:
The idea is to add an optional control channel (socket? named pipe?), so another process can start, stop etc. profiling without killing/restarting the profiler completely. Right now, the only option is to interact with it via TUI mode or just stop it via Ctrl-C.
While working on https://github.com/psf/pyperf/pull/230 I ran into the following problem: some parts (eg: warming up) of benchmarking should not be profiled, as they do not add any value. My only option was sending SIGINT signal.
Generally, the current flow is nice for headful sessions but it could be improved for (especially long-running) headless sessions.
perf record --control does it in a similar way:
--control=fifo:ctl-fifo[,ack-fifo], --control=fd:ctl-fd[,ack-fd]
ctl-fifo / ack-fifo are opened and used as ctl-fd / ack-fd as
follows. Listen on ctl-fd descriptor for command to control
measurement.
Available commands:
• enable : enable events
• disable : disable events
• enable name : enable event name
• disable name : disable event name
• snapshot : AUX area tracing snapshot).
• stop : stop perf record
• ping : ping
• 'evlist [-v|-g|-F] : display all events
-F Show just the sample frequency used for each event.
-v Show all fields.
-g Show event group information.
Specifically:
- We could start with just
enableanddisableinitially.snapshotnext but it'd be lovely to dump without loosing accumulated data. Or maybe evenset_rate. - Possible transport layers could be Unix sockets (works great on Linux) or named pipe. One option might be portable, another not?
- Possble new arguments like
--control unix:/tmp/tachyon-ctl.sockor--control fifo:/tmp/tachyon-ctl, similar to what perf record --control does.
It could be also ommited from the documentation initially, so we don't limit ourselves too early.
Has this already been discussed elsewhere?
No response given
Links to previous discussion of this feature:
No response
Linked PRs
- gh-149958
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず、既存の profiling.sampling フローと、現在 TUI モードおよび SIGINT がどのように profiling を制御しているかを追跡します。提案されている有効化/無効化の制御フローを、Unix ソケットまたは named pipe のオプションと、提案されている --control 引数を含めて、perf record --control と比較します。完了とは、profiler を再起動せずにヘッドレス profiling をサポートする、定義済みのランタイム制御インターフェースがあることを意味します。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- performance, tooling
- issue の種類
- 機能追加
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 活発さ
- 停滞
- 明瞭さ
- 説明が足りない
- 初心者へのやさしさ
- 20/100