Create a new thread structure with processed profile format.
(self, tid, is_main_thread)
| 291 | self.sample_count += len(times) |
| 292 | |
| 293 | def _create_thread(self, tid, is_main_thread): |
| 294 | """Create a new thread structure with processed profile format.""" |
| 295 | |
| 296 | thread = { |
| 297 | "name": f"Thread-{tid}", |
| 298 | "isMainThread": is_main_thread, |
| 299 | "processStartupTime": 0, |
| 300 | "processShutdownTime": None, |
| 301 | "registerTime": 0, |
| 302 | "unregisterTime": None, |
| 303 | "pausedRanges": [], |
| 304 | "pid": str(os.getpid()), |
| 305 | "tid": tid, |
| 306 | "processType": "default", |
| 307 | "processName": "Python Process", |
| 308 | # Sample data - processed format with direct arrays |
| 309 | "samples": { |
| 310 | "stack": [], |
| 311 | "time": [], |
| 312 | "eventDelay": [], |
| 313 | "weight": None, |
| 314 | "weightType": "samples", |
| 315 | "length": 0, # Will be updated on export |
| 316 | }, |
| 317 | # Stack table - processed format |
| 318 | "stackTable": { |
| 319 | "frame": [], |
| 320 | "category": [], |
| 321 | "subcategory": [], |
| 322 | "prefix": [], |
| 323 | "length": 0, # Will be updated on export |
| 324 | }, |
| 325 | # Frame table - processed format |
| 326 | "frameTable": { |
| 327 | "address": [], |
| 328 | "category": [], |
| 329 | "subcategory": [], |
| 330 | "func": [], |
| 331 | "innerWindowID": [], |
| 332 | "implementation": [], |
| 333 | "optimizations": [], |
| 334 | "line": [], |
| 335 | "column": [], |
| 336 | "inlineDepth": [], |
| 337 | "nativeSymbol": [], |
| 338 | "length": 0, # Will be updated on export |
| 339 | }, |
| 340 | # Function table - processed format |
| 341 | "funcTable": { |
| 342 | "name": [], |
| 343 | "isJS": [], |
| 344 | "relevantForJS": [], |
| 345 | "resource": [], |
| 346 | "fileName": [], |
| 347 | "lineNumber": [], |
| 348 | "columnNumber": [], |
| 349 | "length": 0, # Will be updated on export |
| 350 | }, |