Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Gecko format? #194

Open
byroot opened this issue Jan 6, 2023 · 2 comments
Open

Support Gecko format? #194

byroot opened this issue Jan 6, 2023 · 2 comments

Comments

@byroot
Copy link
Contributor

byroot commented Jan 6, 2023

I just discovered the very nice Firefox profiler https://share.firefox.dev/3j3PJoK

The format seem relatively simple and it even support multi-threading: https://github.com/firefox-devtools/profiler/blob/fb5c866af5776e4fec760f4ca39b31848a10706b/docs-developer/gecko-profile-format.md

I'm creating this issue as a bit of a remainder, I'd like to try to add support for it when I find the time.

@tenderlove
Copy link
Collaborator

I've started adding support here.

I've currently got some pretty hacky code that will convert Stackprof profiles to Gecko format, but I think we should change the internal logging format to be something more close to Gecko format. The way Gecko stores samples is much more compact than the way we do it, and I think if we change our internal format to be more close to Gecko, then we could support flame graphs "out of the box" without asking the user to do any kind of "raw mode".

@tenderlove
Copy link
Collaborator

Actually here is a profile I generated. It's the boot process of a very simple Rails application. The translation script I used is here.

I'll clean it up a little and then send a PR.

One issue is that the profile I linked to won't show you the source code for anything. We can make it show you the source by changing the file names to particular urls. For example, if a file comes from Zeitwork, and it's like this:

/Users/aaron/.rubies/arm64/ruby-trunk/lib/ruby/gems/3.3.0+0/gems/zeitwerk-2.6.7/lib/zeitwerk/gem_loader.rb

If we change the path to this:

git:github.com/fxn/zeitwerk:lib/zeitwerk/loader.rb:v2.6.7

Then the profiler will understand to fetch the source from GitHub. I don't think Stackprof should do that type of translation by default, but I do think we should have a type of "sourcemap" post-processing function in Stackprof. So for example you could download a profile from production, then locally translate the filenames to GitHub urls or whatever.

Second, I think we need to mark Ruby frames as JS frames that way we can filter out native frames from the profile. Probably devs aren't going to change Array#each and it it would be useful to remove those from the profile. I'll tackle this point (it should be easy).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants