jlfwong / speedscope

🔬 A fast, interactive web-based viewer for performance profiles.
https://www.speedscope.app
MIT License
5.59k stars 247 forks source link

Thread names lost when using `#title=` hash fragment #346

Open gjoseph92 opened 3 years ago

gjoseph92 commented 3 years ago

With multi-threaded profiles, setting #title= turns every thread's name into the title, which makes them difficult to tell them apart. When there are multiple threads, I'd prefer if it kept the original thread names from the file, and just change document.title.

For example, when I want to look at MainThread here: https://www.speedscope.app/#profileURL=https%3A%2F%2Frawcdn.githack.com%2Fgjoseph92%2Fdask-profiling-coiled%2Fe48d1e07ff9ab9f61360e04b597d0b58c0e3e2c8%2Fresults%2Fcython.json%3Fraw%3Dtrue

It's harder to find here: https://www.speedscope.app/#profileURL=https%3A%2F%2Frawcdn.githack.com%2Fgjoseph92%2Fdask-profiling-coiled%2Fe48d1e07ff9ab9f61360e04b597d0b58c0e3e2c8%2Fresults%2Fcython.json%3Fraw%3Dtrue&title=cython

I imagine the change would just happen on this line: https://github.com/jlfwong/speedscope/blob/b71cef5db4162e9cd871ad7a1bf5716fffabe5ff/src/views/application.tsx#L207 and maybe also https://github.com/jlfwong/speedscope/blob/b71cef5db4162e9cd871ad7a1bf5716fffabe5ff/src/views/application.tsx#L194-L199

If it's that simple, I'm happy to make a PR.

jlfwong commented 3 years ago

Haha oh wow, the current behavior seems pretty unhelpful for multithreaded profiles. (The #title functionality was built before multithreaded profiles were supported, and I never tested them together)

I'm not sure without spending more time in the code to know if it's as simple as that, but the #title=... is probably used little enough that changing its behavior is probably fine. I'd accept a PR to do this.