← Back to Performance Viewer

🔥 How to Generate Profiles

Performance Viewer works with several profile formats. Everything is processed locally in your browser — no data is uploaded.

FormatLanguageFeatures
Vernier .vernier.jsonRubyFull Stack chart, SQL queries, N+1 detection, GC, feature flags, markers
StackProf .jsonRubyPartial Stack chart, hotspots, lifecycle (no SQL/marker data)
Folded Stacks .txtAnyPartial Stack chart, hotspots (Go, perf, dtrace, etc.)

Vernier (Recommended for Ruby/Rails)

Vernier is a modern Ruby profiler that captures CPU time, SQL queries, GC pauses, feature flags, and more.

1. Install the gem

gem install vernier
# or add to your Gemfile:
gem "vernier", group: :development

2. Profile your code

# Profile a block of code
Vernier.profile(out: "my_profile.vernier.json") do
  # your code here
end

# Profile a Rails request (add to a controller):
# GET /posts?flamegraph=1
around_action :vernier_profile, if: -> { params[:flamegraph] }

def vernier_profile
  Vernier.profile(out: "request.vernier.json") { yield }
end

3. Profile from the command line

# Profile any Ruby script
vernier run -- ruby my_script.rb

# Profile with allocation tracking
vernier run --allocation-interval 1 -- ruby my_script.rb

# Profile a Rails server request
vernier run -- rails runner "MyModel.expensive_query"

4. Drag the file onto Performance Viewer

Drop the .vernier.json file onto the Performance Viewer to see the full analysis.

StackProf (Alternative Ruby Profiler)

gem install stackprof

# Profile a block
StackProf.run(mode: :wall, raw: true, out: "stackprof.json") do
  # your code here
end

# IMPORTANT: use raw: true for flamegraph data

Go (pprof)

Export a Go CPU profile as folded stacks:

# Generate a CPU profile
go test -cpuprofile cpu.prof ./...

# Convert to folded stacks format
go tool pprof -raw cpu.prof > profile.txt

# Or use stackcollapse-go.pl from Brendan Gregg's tools:
go tool pprof -raw cpu.prof | stackcollapse-go.pl > profile.folded

Linux perf

# Record a profile
perf record -g -p PID sleep 30

# Convert to folded stacks
perf script | stackcollapse-perf.pl > profile.folded

Any Language (Folded Stacks)

Any profiler that can output the Brendan Gregg folded stack format works:

# Format: semicolon-separated stack followed by a count
main;handleRequest;db.Query 150
main;handleRequest;json.Marshal 80
main;handleRequest;template.Execute 60

← Back to Performance Viewer