Title: Add runtime control for `profiling.sampling` · Issue #145411 · python/cpython · GitHub
Open Graph Title: Add runtime control for `profiling.sampling` · Issue #145411 · python/cpython
X Title: Add runtime control for `profiling.sampling` · Issue #145411 · python/cpython
Description: 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...
Open Graph Description: 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 comp...
X Description: 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 comp...
Opengraph URL: https://github.com/python/cpython/issues/145411
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Add runtime control for `profiling.sampling`","articleBody":"# Feature or enhancement\n\n### Proposal:\n\nThe 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.\n\nWhile 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](https://github.com/psf/pyperf/pull/230/changes#diff-28457f773c4dfe0a6128b86f6489077926b7abe4707da7985e01c0981d50ce3aR237).\n\nGenerally, the current flow is nice for headful sessions but it could be improved for (especially long-running) headless sessions.\n\n[perf record --control](https://man7.org/linux/man-pages/man1/perf-record.1.html) does it in a similar way:\n\n```\n --control=fifo:ctl-fifo[,ack-fifo], --control=fd:ctl-fd[,ack-fd]\n ctl-fifo / ack-fifo are opened and used as ctl-fd / ack-fd as\n follows. Listen on ctl-fd descriptor for command to control\n measurement.\n\n Available commands:\n\n • enable : enable events\n • disable : disable events\n • enable name : enable event name\n • disable name : disable event name\n • snapshot : AUX area tracing snapshot).\n • stop : stop perf record\n • ping : ping\n • 'evlist [-v|-g|-F] : display all events\n -F Show just the sample frequency used for each event.\n -v Show all fields.\n -g Show event group information.\n```\n\nSpecifically:\n\n- We could start with just `enable` and `disable` initially. `snapshot` next but it'd be lovely to dump without loosing accumulated data. Or maybe even `set_rate`.\n- Possible transport layers could be Unix sockets (works great on Linux) or named pipe. One option might be portable, another not?\n- Possble new arguments like `--control unix:/tmp/tachyon-ctl.sock` or `--control fifo:/tmp/tachyon-ctl`, similar to what [perf record --control](https://man7.org/linux/man-pages/man1/perf-record.1.html) does.\n\nIt could be also ommited from the documentation initially, so we don't limit ourselves too early.\n\n### Has this already been discussed elsewhere?\n\nNo response given\n\n### Links to previous discussion of this feature:\n\n_No response_\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-149958\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/maurycy","@type":"Person","name":"maurycy"},"datePublished":"2026-03-02T09:51:16.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/145411/cpython/issues/145411"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:ffcfe0f9-4948-63a6-7301-071689818f18 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E446:F7EDB:BD02CA:FF6FDA:6A51653D |
| html-safe-nonce | 53087eeda5bfcdf9ec8d2f9b65a27e91677b3bd5987619546798f878fc154171 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNDQ2OkY3RURCOkJEMDJDQTpGRjZGREE6NkE1MTY1M0QiLCJ2aXNpdG9yX2lkIjoiNTc4MzQ2NTAxMjUyMjczOTAwNSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 042fbb955589978911a18d3f1b32fa500b0950872fbf743f62b32778116a3dab |
| hovercard-subject-tag | issue:4010315279 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/145411/issue_layout |
| twitter:image | https://opengraph.githubassets.com/a5fa3ca6292033cd44e75cf683f63b38bfbce6f22e401f088b3433fe707ed2f9/python/cpython/issues/145411 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/a5fa3ca6292033cd44e75cf683f63b38bfbce6f22e401f088b3433fe707ed2f9/python/cpython/issues/145411 |
| og:image:alt | 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 comp... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | maurycy |
| hostname | github.com |
| expected-hostname | github.com |
| None | b9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 2eeb434949a926fad21064b4d395a54759f7a0b2 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width