Module: DeepCover::Tools::Profiling

Defined in:
lib/deep_cover/tools/profiling.rb

Defined Under Namespace

Classes: RubyProfProfiler

Instance Method Summary collapse

Instance Method Details

#dont_profileObject



37
38
39
40
41
42
# File 'lib/deep_cover/tools/profiling.rb', line 37

def dont_profile
  pause if profiler_loaded?
  yield
ensure
  resume if profiler_loaded?
end

#pauseObject



16
17
18
# File 'lib/deep_cover/tools/profiling.rb', line 16

def pause
  profiler.pause
end

#profile(do_start = true) ⇒ Object

Basic utilities using forwarding methods



29
30
31
32
33
34
35
# File 'lib/deep_cover/tools/profiling.rb', line 29

def profile(do_start = true)
  return yield unless do_start
  start
  yield
  stop
  report
end

#profiler_loaded?Boolean

Returns:

  • (Boolean)


44
45
46
# File 'lib/deep_cover/tools/profiling.rb', line 44

def profiler_loaded?
  !!@profiler
end

#reportObject



24
25
26
# File 'lib/deep_cover/tools/profiling.rb', line 24

def report
  profiler.report(@results)
end

#resumeObject



20
21
22
# File 'lib/deep_cover/tools/profiling.rb', line 20

def resume
  profiler.resume
end

#startObject

Simple forwarding to implementation



8
9
10
# File 'lib/deep_cover/tools/profiling.rb', line 8

def start
  profiler.start
end

#stopObject



12
13
14
# File 'lib/deep_cover/tools/profiling.rb', line 12

def stop
  @results = profiler.stop
end