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

feat(forge): add support for flamegraph #7761

Open
zemse opened this issue Apr 23, 2024 · 5 comments
Open

feat(forge): add support for flamegraph #7761

zemse opened this issue Apr 23, 2024 · 5 comments
Labels
A-extensions Area: extensions C-forge Command: forge T-feature Type: feature
Milestone

Comments

@zemse
Copy link

zemse commented Apr 23, 2024

Component

Forge

Describe the feature you would like

I was recently interested in flamegraphs, had to hack something locally and then over the weekend packaged it as a foundry plugin: forge-flamegraph. Here is a 4-minute video demo.

The features in brief:

  • Uses inferno-rs which produces svg
  • Call trace backend which simply produces a flamegraph based on the call tree.
  • Experimental debug trace flamegraph which parses the debug trace and source mappings (which are not that great) to display internal functions.
  • --open flag which simply opens the SVG in the browser post-generation.
  • --merge flag which is useful when a function is called multiple times.

After asking for some feedback, I've learned that there is friction because of typical solidity devs don't have Cargo installed as well as current flow of installation also requires users to build the plugin. I've created #7760 to discuss potential remedies for this problem. The reason I went forward with a plugin instead of direct subcommand PR because I was mainly interested in the "debug trace flamegraph" which is very hacky and does not always work well, so I was not sure if having such experimental code in foundry codebase is fine.

But if this is helpful, I am interested to clean up the code and PR, so that these features are more accessible to people!

Additional context

No response

@zemse zemse added the T-feature Type: feature label Apr 23, 2024
@klkvr
Copy link
Member

klkvr commented Jun 19, 2024

Hi @zemse! Great work on this project, it would be great if we could get this into foundry natively :)

Do you have time for kicking off PR with this at the moment? We'd be happy to give you pointers and help with integrating everything into existing code

@zemse
Copy link
Author

zemse commented Jun 20, 2024

Sure I'll try making a PR over the weekend :)

@klkvr
Copy link
Member

klkvr commented Jun 23, 2024

hey @zemse I've been playing around with internal fns tracking in #8222 lately in context of displaying them in traces

it is based on using the CallTraceArena instead of DebugStep so should be easier to integrate as it does not require using debugger logic directly.

I believe it can be reused for flamegraphs as well so feel free to use it in your PR if you find it feasible to integrate

@klkvr
Copy link
Member

klkvr commented Jun 27, 2024

hey @zemse! how's it going with the PR? do you need any help?

@zemse
Copy link
Author

zemse commented Jun 27, 2024

Sorry last weekend I was not in best health, couldn't start this.

I looked at your PR and it made sense. Aiming to make up something this weekend!

@zerosnacks zerosnacks added A-extensions Area: extensions C-forge Command: forge labels Jul 15, 2024
@zerosnacks zerosnacks changed the title Support for flamegraph feat(forge): add support for flamegraph Jul 15, 2024
@zerosnacks zerosnacks added this to the v1.0.0 milestone Jul 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-extensions Area: extensions C-forge Command: forge T-feature Type: feature
Projects
None yet
Development

No branches or pull requests

3 participants