Created
October 24, 2024 14:28
-
-
Save Zooip/fa7d65f1a48694e556f485b772ce7d8e to your computer and use it in GitHub Desktop.
Small helper to run StackProf and immediatly open the flamegfraph in Speedscope
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module SpeedscopeProfile | |
| def self.profile(**options, &block) | |
| dump = StackProf.run(mode: :wall, **options, raw: true, &block) | |
| Tempfile.create do |f| | |
| f.write JSON.generate(dump) | |
| `npx --yes speedscope #{f.path}` | |
| end | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment