gh-146256: Add --jsonl flag to the profiling.sampling#146257
Draft
maurycy wants to merge 3 commits intopython:mainfrom
Draft
gh-146256: Add --jsonl flag to the profiling.sampling#146257maurycy wants to merge 3 commits intopython:mainfrom
--jsonl flag to the profiling.sampling#146257maurycy wants to merge 3 commits intopython:mainfrom
Conversation
--ndjson flag to the profiling.sampling--jsonl flag to the profiling.sampling
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.
This PR adds
--jsonldiscussed in #146256.It's a draft - it does not contain tests yet. The class is below 2**8 lines of code and does not touch existing
profiling.samplingcode, so I took a leap. I'm already uncomfortable with creating a PR for an issue that wasn't widely discussed. I don't want to clutter it with tests, until the format is solidified.For example:
sudo -E \ uv run \ --python /Users/maurycy/src/github.com/maurycy/cpython/python.exe \ python \ -m profiling.sampling \ run \ --jsonl \ -o /tmp/profile.jsonl /tmp/hello_world.pyWhere
/tmp/hello_world.pycould be:Given the similarity, the class just inherits from
StackTraceCollector.Visual Studio Code Extension
For the purpose of demonstrating the
--jsonlusefulness, I have vibe-coded (with Claude Code) a simple VSCode Extension that leverages this play profile and displays it in the editor:I think that, once we have
--streamit could be much more exciting: updating the real-time hot spots from the production in VSCode, or, well, making agents' life easier.You can fetch the vibe-coded VSCode Extension here:
Or:
Please do not forget about removing
~/.vscode/extensions/profiling-heatmap/after tests.--jsonlflag to theprofiling.sampling#146256