Title: gh-154060: Fix the `Profile Stats` offsets in the profiling binary format docs and a missing flag by maurycy · Pull Request #157871 · python/cpython · GitHub
Open Graph Title: gh-154060: Fix the `Profile Stats` offsets in the profiling binary format docs and a missing flag by maurycy · Pull Request #157871 · python/cpython
X Title: gh-154060: Fix the `Profile Stats` offsets in the profiling binary format docs and a missing flag by maurycy · Pull Request #157871 · python/cpython
Description: The file layout diagram in: https://github.com/python/cpython/blob/a64b7ecba4db5480504a1a83ae6e80c81472fe16/InternalDocs/profiling_binary_format.md#file-layout says that the Profile Stats section is 32 bytes and starts at file_size - 64, while it's 56 bytes and starts at file_size - 88 (56 + 32 = 88). cpython/Modules/_remote_debugging/binary_io.h Lines 122 to 123 in a64b7ec static_assert(PROFILE_STATS_SIZE == 56, "PROFILE_STATS_SIZE must remain 56"); cpython/Modules/_remote_debugging/binary_io.h Lines 91 to 92 in a64b7ec static_assert(FILE_FOOTER_SIZE == 32, "FILE_FOOTER_SIZE must remain 32"); The test: cpython/Lib/test/test_profiling/test_sampling_profiler/test_binary_format.py Lines 1655 to 1660 in a64b7ec with open(bin_path, "rb") as file: data = file.read() stats = data[-88:-32] footer = bytearray(data[-32:]) old_stats = stats[:16] + b"TACHSTAT" + struct.pack("=II", 1, 32) old_data = bytearray(data[:-88] + old_stats + footer) Even the doc itself says 56 bytes later: New files can store measured duration, sampling rate, error rate, and missed sample percentage in an optional 56-byte extension immediately before the footer. Both the diagram and the section is since 7f0ccd6. While we're at it, adding THREAD_STATUS_MAIN_THREAD flag missed from the docs. Hardly newsworthy, hardly testable but I think would be nice to backport to 3.15. https://github.com/python/cpython/pull/154105/changes#diff-43a2fe1b7de3546d9e026fcf3664cdc0c35608385926a09e8038a84598acba30 addresses another issue in the document (Total sample count is now uint64.) Issue: gh-154060
Open Graph Description: The file layout diagram in: https://github.com/python/cpython/blob/a64b7ecba4db5480504a1a83ae6e80c81472fe16/InternalDocs/profiling_binary_format.md#file-layout says that the Profile Stats section i...
X Description: The file layout diagram in: https://github.com/python/cpython/blob/a64b7ecba4db5480504a1a83ae6e80c81472fe16/InternalDocs/profiling_binary_format.md#file-layout says that the Profile Stats section i...
Opengraph URL: https://github.com/python/cpython/pull/157871
X: @github
Domain: github.com
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:bd7b6e48-de67-16e8-7ee0-a1e672e1a342 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | EC12:148EE1:CDD8CB:103171F:6B022D03 |
| html-safe-nonce | a2dea99e4707602feca2c06cc7b223b1462ce9bc65bd0d0fb6f846b75ebe4b3d |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFQzEyOjE0OEVFMTpDREQ4Q0I6MTAzMTcxRjo2QjAyMkQwMyIsInZpc2l0b3JfaWQiOiIxMTQ0MDE4MjE1MjkxMjAyODIwIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 2730a42883cbc5935edd07f3d1ad7395be06ab9f30f1f922dcd13c24e0bf4749 |
| hovercard-subject-tag | pull_request:4585745081 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,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/python/cpython/pull/157871/files |
| twitter:image | https://avatars.githubusercontent.com/u/5383?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/5383?s=400&v=4 |
| og:image:alt | The file layout diagram in: https://github.com/python/cpython/blob/a64b7ecba4db5480504a1a83ae6e80c81472fe16/InternalDocs/profiling_binary_format.md#file-layout says that the Profile Stats section i... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| 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 | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 423dbb54c5e7bfecc838eb387c1435eb3d0e760d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width