2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
# File 'lib/singed/kernel_ext.rb', line 2
def flamegraph(label = nil, open: true, ignore_gc: false, interval: 1000, io: $stdout, &)
fg = Singed::Flamegraph.new(label: label, ignore_gc: ignore_gc, interval: interval)
result = fg.record(&)
fg.save
bright_red = "\e[91m"
none = "\e[0m"
if open
io.puts "🔥📈 #{bright_red}Captured flamegraph, opening with#{none}: #{fg.open_command}"
fg.open
else
io.puts "🔥📈 #{bright_red}Captured flamegraph to file#{none}: #{fg.filename}"
end
result
end
|