jlfwong / jlfwong/speedscope

Speedscope doesn't match `chrome://tracing`: events never end

Open
#345 10 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
6.8k
Forks
320
PR merge metrics
No merged PRs in 30d

Description

[This file](https://gist.githubusercontent.com/gjoseph92/8485ce1b7eeaf7a6496c547133b27224/raw/c689e9c77ff51b8b74753f5b8faf3b0bd513e418/profile-no-negative-durs.json) in Chrome trace format looks very different in speedscope versus `chrome://tracing`:

![Screen Shot 2021-05-12 at 5 20 26 PM](https://user-images.githubusercontent.com/3309802/118056145-9f804b80-b346-11eb-9af2-04aac5ce2cc4.png)

![Screen Shot 2021-05-12 at 5 20 59 PM](https://user-images.githubusercontent.com/3309802/118056153-a1e2a580-b346-11eb-8861-d61c60bee05c.png)

In speedscope, you can see from the minimap that the events don't seem to end properly—every event stretches all the way to the end of the whole trace.

I'm not that familiar with the file format, so I'm not sure if it's a malformed trace that Chrome just happens to be okay with, or if speedscope is actually doing something wrong here.

I also see lots of errors like `Tried to end "transition_memory_released [...]" when "time.time" was on the top of the stack. Doing nothing instead.` in the console.

FWIW, these traces were generated by [viztracer](https://github.com/gaogaotiantian/viztracer). viztracer actually has [an issue](https://github.com/gaogaotiantian/viztracer/issues/106#issuecomment-815429834) where the files it generates break speedscope entirely (`😿 Something went wrong`), and the same sorts of "tried to end x when y was on top of the stack" errors also show up. I noticed the file had lots of events with negative durations (`"dur": -0.02`), so I just wrote a script to drop all of those. That produced the file I linked above, which at least loads into speedscope (albeit with errors in the console), but looks very wrong. Note that `chrome://tracing` is able to load the file with negative durations just fine, and it looks indistinguishable (as far as I can tell) from my filtered one. Here is the original file with negative durations as well: [`profile-original.json`](https://gist.githubusercontent.com/gjoseph92/8485ce1b7eeaf7a6496c547133b27224/raw/c689e9c77ff51b8b74753f5b8faf3b0bd513e418/profile-original.json).

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.