Skip to content

[Feature Request] Make the main thread easier to identify #514

@JLC827

Description

@JLC827

I'm really enjoying using speedscope, it's a great tool. Thank you for your work on it!

The Problem

When profiling a multi-threaded Python application with py-spy, the resulting profile can contain hundreds of individual threads. In the current UI, it's difficult and time-consuming to locate the main thread among all the others, as it is not explicitly identified.

Proposed Solution

Highlight the main thread: Automatically identify and highlight the main thread in the thread list (e.g., by placing it at the top, adding an icon, or using a different background color).
Add sorting options: Allow users to sort the list of threads by the number of samples. Sorting by sample count would help quickly identify the most active threads.

Current Workaround

I've been able to find the most active thread (which is usually the main thread) by manually parsing the JSON with a PowerShell script. This demonstrates that the data is available in the profile. It would be great if this or a similar feature were integrated directly into speedscope.

>> (Get-Content -Raw 'profile.speedscope' | ConvertFrom-Json).profiles | `
Select-Object name, @{Name="SampleCount"; Expression={$_.samples.Count}} | `
Sort-Object -Property SampleCount -Descending

name                                   SampleCount
----                                   -----------
Thread 58880 ""                              19319
Thread 0 ""                                     95
Thread 57900 "Thread-29 (run)"                  56
etc...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions