Title: expose API for writing perf map files · Issue #103295 · python/cpython · GitHub
Open Graph Title: expose API for writing perf map files · Issue #103295 · python/cpython
X Title: expose API for writing perf map files · Issue #103295 · python/cpython
Description: #96123 added support for CPython to write /tmp/perf-
Open Graph Description: #96123 added support for CPython to write /tmp/perf-
X Description: #96123 added support for CPython to write /tmp/perf-<pid>.map files, associating instruction address ranges with a human-readable frame name for the Linux perf profiler. Two external Python J...
Opengraph URL: https://github.com/python/cpython/issues/103295
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"expose API for writing perf map files","articleBody":"https://github.com/python/cpython/pull/96123 added support for CPython to write `/tmp/perf-\u003cpid\u003e.map` files, associating instruction address ranges with a human-readable frame name for the Linux `perf` profiler.\r\n\r\nTwo external Python JIT compilers, [Cinder](https://github.com/facebookincubator/cinder/blob/cinder/3.10/Jit/perf_jitdump.cpp#L177-L185) and [Pyston](https://github.com/pyston/pyston/blob/dee48edd457518cf3d2cb93648f9cffe8aad6bce/Python/aot_ceval_jit.c#L5782-L5796), both also independently write to perf map files.\r\n\r\nSince perf map files are one-per-process, multiple separate libraries trying to write perf map entries independently can lead to file corruption from simultaneous writes.\r\n\r\nIt's unlikely for both Cinder and Pyston JITs to be used in the same process, but it's quite reasonable to use one of these JITs along with CPython's native perf trampoline support.\r\n\r\nIn order for this to be safe, CPython should expose a thread-safe API for writing perf map entries that all these clients can use.\r\n\r\n(We've backported the 3.12 perf trampolines feature to Cinder 3.10 and experimented with using it, and we've seen this write corruption problem occur in practice; it's not just a theoretical risk we identified.)\r\n\r\ncc @pablogsal , @kmod \n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-103546\n* gh-104811\n* gh-104823\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/carljm","@type":"Person","name":"carljm"},"datePublished":"2023-04-05T23:07:38.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":18},"url":"https://github.com/103295/cpython/issues/103295"}
| 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:49f828f1-5529-aff0-d872-914891a35132 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | CE06:2728FC:10B28E0:1654ECD:69699224 |
| html-safe-nonce | 6dac6aa499078da8e61a11b6b94d640b0a660788b671e0d758282d5dd6f54bb8 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDRTA2OjI3MjhGQzoxMEIyOEUwOjE2NTRFQ0Q6Njk2OTkyMjQiLCJ2aXNpdG9yX2lkIjoiMTA2ODU1OTQwNTI5Njg5MTI0IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 686f2f552a40a82a894bbafb9c3a4194a0e4ee34ba6e91e3a16e1bcf933bfc79 |
| hovercard-subject-tag | issue:1656418265 |
| 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/103295/issue_layout |
| twitter:image | https://opengraph.githubassets.com/11a74aa805ed37dd476f119cf4d8fc50397225f85c1cae9db5726f7990eb0cb6/python/cpython/issues/103295 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/11a74aa805ed37dd476f119cf4d8fc50397225f85c1cae9db5726f7990eb0cb6/python/cpython/issues/103295 |
| og:image:alt | #96123 added support for CPython to write /tmp/perf- |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | carljm |
| hostname | github.com |
| expected-hostname | github.com |
| None | 3542e147982176a7ebaa23dfb559c8af16f721c03ec560c68c56b64a0f35e751 |
| 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 | af80af7cc9e3de9c336f18b208a600950a3c187c |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width