Skip to content

gh-154090: Store profiling mode in binary files - #154105

Merged
pablogsal merged 4 commits into
python:mainfrom
pablogsal:agent/gh-154090-binary-mode
Sep 24, 2026
Merged

pablogsal merged 4 commits into
python:mainfrom
pablogsal:agent/gh-154090-binary-mode

Conversation

@pablogsal

@pablogsal pablogsal commented Jul 19, 2026 •

Copy link
Copy Markdown
Member

@pablogsal pablogsal added the needs backport to 3.15 pre-release feature fixes, bugs and security fixes label Jul 19, 2026
@pablogsal

Copy link
Copy Markdown
Member Author

CC: @lkollar

@pablogsal
pablogsal marked this pull request as ready for review July 19, 2026 14:08
@pablogsal
pablogsal requested a review from AA-Turner as a code owner July 19, 2026 14:08

@maurycy maurycy left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about threads (ie: main v. --all-threads; now implicit from HDR_OFF_THREADS), native_frames, gc for diffs?

Truth be told, I wonder about the all flags (especially if we strictly care about honest diffs and replays), about describing the target (especially for Gecko), but also about error rate, maybe even failed samples (ref #154092).

That's a bit of a Whac-A-Mole without approaching this is in a bit more generic way (eg: flexible metadata struct within the existing header.)

| 44 | 8 | uint64 | Frame table offset |
| 52 | 4 | uint32 | Compression type (0=none, 1=zstd) |
| 56 | 8 | bytes | Reserved (zero-filled) |
| 28 | 8 | uint64 | Total sample count |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you

Comment thread InternalDocs/profiling_binary_format.md Outdated
Comment on lines +94 to +95
Profiling modes use their `_remote_debugging.PROFILING_MODE_*` value plus one,
leaving zero available for binaries written before this field was defined.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we care about backwards compatibility that much, given that we have recently changed the total sample count from uint32 to uint64 lately (#153425)?

@pablogsal
pablogsal force-pushed the agent/gh-154090-binary-mode branch from b926588 to e33d34f Compare September 24, 2026 19:54
@pablogsal
pablogsal enabled auto-merge (squash) September 24, 2026 22:56
@pablogsal
pablogsal disabled auto-merge September 24, 2026 22:56
@pablogsal
pablogsal enabled auto-merge (squash) September 24, 2026 22:56
@pablogsal
pablogsal merged commit d3663ef into python:main Sep 24, 2026
100 of 102 checks passed
@pablogsal
pablogsal deleted the agent/gh-154090-binary-mode branch September 24, 2026 23:17
@miss-islington-app

Copy link
Copy Markdown

Thanks @pablogsal for the PR 🌮🎉.. I'm working now to backport this PR to: 3.15.
🐍🍒⛏🤖

@miss-islington-app

Copy link
Copy Markdown

Sorry, @pablogsal, I could not cleanly backport this to 3.15 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker d3663ef943d984f4c8e349d705b61f393385d817 3.15

@bedevere-app

bedevere-app Bot commented Sep 24, 2026

Copy link
Copy Markdown

GH-158144 is a backport of this pull request to the 3.15 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.15 pre-release feature fixes, bugs and security fixes label Sep 24, 2026
pablogsal added a commit that referenced this pull request Sep 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Sampling binary profiles do not record the profiling mode

2 participants