chrometrace: use metadata for thread id and name#681
Open
d4l3k wants to merge 1 commit into
Open
Conversation
andrewjcg
added a commit
to andrewjcg/py-spy
that referenced
this pull request
Nov 1, 2024
Summary: This modifies py-spy to use a sequential thread ID counter for each event and instead log a thread_name metadata field that includes the full thread ID as well as the thread name. Perfetto doesn't support u64 thread ids so we lose thread information and the py-spy chrometrace format doesn't include thread names. Upstream PR: benfred#681 Test Plan: Launch a process that uses subprocesses and threads ``` buck2 run fbsource//third-party/py-spy:py-spy -- record --format chrometrace --nonblocking --output ~/test-pyspy.json.gz --subprocesses -- torchx run -s local_cwd dist.ddp -j2x2 -m hi ``` {F1866175191} Perfetto: {F1866171613} Chrome Tracing: {F1866174988} Reviewers: agallagher, kunalb, egl Reviewed By: kunalb, egl Differential Revision: https://phabricator.intern.facebook.com/D62666434
andrewjcg
added a commit
to andrewjcg/py-spy
that referenced
this pull request
Nov 1, 2024
Summary: This modifies py-spy to use a sequential thread ID counter for each event and instead log a thread_name metadata field that includes the full thread ID as well as the thread name. Perfetto doesn't support u64 thread ids so we lose thread information and the py-spy chrometrace format doesn't include thread names. Upstream PR: benfred#681 Test Plan: Launch a process that uses subprocesses and threads ``` buck2 run fbsource//third-party/py-spy:py-spy -- record --format chrometrace --nonblocking --output ~/test-pyspy.json.gz --subprocesses -- torchx run -s local_cwd dist.ddp -j2x2 -m hi ``` {F1866175191} Perfetto: {F1866171613} Chrome Tracing: {F1866174988} Reviewers: agallagher, kunalb, egl Reviewed By: kunalb, egl Differential Revision: https://phabricator.intern.facebook.com/D62666434
andrewjcg
added a commit
to andrewjcg/py-spy
that referenced
this pull request
Mar 24, 2025
Summary: This modifies py-spy to use a sequential thread ID counter for each event and instead log a thread_name metadata field that includes the full thread ID as well as the thread name. Perfetto doesn't support u64 thread ids so we lose thread information and the py-spy chrometrace format doesn't include thread names. Upstream PR: benfred#681 Test Plan: Launch a process that uses subprocesses and threads ``` buck2 run fbsource//third-party/py-spy:py-spy -- record --format chrometrace --nonblocking --output ~/test-pyspy.json.gz --subprocesses -- torchx run -s local_cwd dist.ddp -j2x2 -m hi ``` {F1866175191} Perfetto: {F1866171613} Chrome Tracing: {F1866174988} Reviewers: agallagher, kunalb, egl Reviewed By: kunalb, egl Differential Revision: https://phabricator.intern.facebook.com/D62666434
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 modifies py-spy to use a sequential thread ID counter for each event and instead log a thread_name metadata field that includes the full thread ID as well as the thread name.
Perfetto doesn't support u64 thread ids so we lose thread information and the py-spy chrometrace format doesn't include thread names.
See google/perfetto#886 for more details
Test plan:
Run on a program that launches multiple processes and threads
Test in both Perfetto and Chrome trace viewer