File: autorun.rb

package info (click to toggle)
ruby-stackprof 0.2.26-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 552 kB
  • sloc: python: 2,494; ruby: 1,264; perl: 920; ansic: 761; javascript: 735; makefile: 4
file content (19 lines) | stat: -rw-r--r-- 582 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
require "stackprof"

options = {}
options[:mode] = ENV["STACKPROF_MODE"].to_sym if ENV.key?("STACKPROF_MODE")
options[:interval] = Integer(ENV["STACKPROF_INTERVAL"]) if ENV.key?("STACKPROF_INTERVAL")
options[:raw] = true if ENV["STACKPROF_RAW"]
options[:ignore_gc] = true if ENV["STACKPROF_IGNORE_GC"]

at_exit do
  StackProf.stop
  output_path = ENV.fetch("STACKPROF_OUT") do
    require "tempfile"
    Tempfile.create(["stackprof", ".dump"]).path
  end
  StackProf.results(output_path)
  $stderr.puts("StackProf results dumped at: #{output_path}")
end

StackProf.start(**options)