Commit 5ea685d
committed
fb-py-spy: log thread ids and names in a perfetto compatible way
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/D626664341 parent 050e9bc commit 5ea685d
1 file changed
+45
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
| 24 | + | |
23 | 25 | | |
24 | 26 | | |
25 | 27 | | |
| |||
29 | 31 | | |
30 | 32 | | |
31 | 33 | | |
32 | | - | |
| 34 | + | |
33 | 35 | | |
34 | 36 | | |
35 | 37 | | |
| |||
71 | 73 | | |
72 | 74 | | |
73 | 75 | | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
74 | 80 | | |
75 | 81 | | |
76 | 82 | | |
| |||
80 | 86 | | |
81 | 87 | | |
82 | 88 | | |
| 89 | + | |
83 | 90 | | |
84 | 91 | | |
85 | 92 | | |
| |||
97 | 104 | | |
98 | 105 | | |
99 | 106 | | |
100 | | - | |
| 107 | + | |
101 | 108 | | |
102 | 109 | | |
103 | 110 | | |
| |||
110 | 117 | | |
111 | 118 | | |
112 | 119 | | |
| 120 | + | |
113 | 121 | | |
114 | 122 | | |
115 | 123 | | |
116 | 124 | | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
117 | 130 | | |
118 | 131 | | |
119 | 132 | | |
| |||
146 | 159 | | |
147 | 160 | | |
148 | 161 | | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
149 | 190 | | |
150 | 191 | | |
151 | 192 | | |
| |||
154 | 195 | | |
155 | 196 | | |
156 | 197 | | |
| 198 | + | |
| 199 | + | |
157 | 200 | | |
158 | 201 | | |
159 | 202 | | |
| |||
0 commit comments