gh-154060: Fix the Profile Stats offsets in the profiling binary format docs and a missing flag - #157871
Merged
Conversation
Contributor
Author
|
cc @pablogsal 🖤 |
Profile Stats offsets in the profiling binary format docsProfile Stats offsets in the profiling binary format docs and a missing flag
maurycy
commented
Sep 20, 2026
pablogsal
enabled auto-merge (squash)
October 5, 2026 14:06
pablogsal
approved these changes
Oct 5, 2026
|
Thanks @maurycy for the PR, and @pablogsal for merging it 🌮🎉.. I'm working now to backport this PR to: 3.15. |
|
GH-158855 is a backport of this pull request to the 3.15 branch. |
pablogsal
added a commit
that referenced
this pull request
Oct 5, 2026
…nary format docs and a missing flag (GH-157871) (#158855) gh-154060: Fix the `Profile Stats` offsets in the profiling binary format docs and a missing flag (GH-157871) * correct profile stats size and paddings * missing flag * gh-154060: Clarify the main-thread status flag --------- (cherry picked from commit 8df2580) Co-authored-by: Maurycy Pawłowski-Wieroński <[email protected]> Co-authored-by: Pablo Galindo Salgado <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The file layout diagram in:
https://github.com/python/cpython/blob/a64b7ecba4db5480504a1a83ae6e80c81472fe16/InternalDocs/profiling_binary_format.md#file-layout
says that the
Profile Statssection is 32 bytes and starts atfile_size - 64, while it's 56 bytes and starts atfile_size - 88(56 + 32 = 88).cpython/Modules/_remote_debugging/binary_io.h
Lines 122 to 123 in a64b7ec
cpython/Modules/_remote_debugging/binary_io.h
Lines 91 to 92 in a64b7ec
The test:
cpython/Lib/test/test_profiling/test_sampling_profiler/test_binary_format.py
Lines 1655 to 1660 in a64b7ec
Even the doc itself says 56 bytes later:
Both the diagram and the section is since 7f0ccd6.
While we're at it, adding
THREAD_STATUS_MAIN_THREADflag 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 countis nowuint64.)