Class: PerfLab::Profiler

Inherits:
Object
  • Object
show all
Defined in:
lib/perflab/profiler.rb

Constant Summary collapse

DIRECTORY =
'tmp/perflab'.freeze
FILENAME =
'profiler.dump'.freeze

Class Method Summary collapse

Class Method Details

.profile(lambda) ⇒ Object



7
8
9
10
11
12
# File 'lib/perflab/profiler.rb', line 7

def profile(lambda)
  FileUtils.mkdir_p(DIRECTORY)
  path = "#{DIRECTORY}/#{FILENAME}"

  StackProf.run(mode: :wall, out: path, raw: true) { lambda.call }
end