Skip to content

Instantly share code, notes, and snippets.

@Zooip
Created October 24, 2024 14:28
Show Gist options
  • Select an option

  • Save Zooip/fa7d65f1a48694e556f485b772ce7d8e to your computer and use it in GitHub Desktop.

Select an option

Save Zooip/fa7d65f1a48694e556f485b772ce7d8e to your computer and use it in GitHub Desktop.
Small helper to run StackProf and immediatly open the flamegfraph in Speedscope
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