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



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

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

#pauseObject



14
15
16
# File 'lib/deep_cover/tools/profiling.rb', line 14

def pause
  profiler.pause
end

#profile(do_start = true) ⇒ Object

Basic utilities using forwarding methods



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

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

#profiler_loaded?Boolean

Returns:

  • (Boolean)


42
43
44
# File 'lib/deep_cover/tools/profiling.rb', line 42

def profiler_loaded?
  !!@profiler
end

#reportObject



22
23
24
# File 'lib/deep_cover/tools/profiling.rb', line 22

def report
  profiler.report(@results)
end

#resumeObject



18
19
20
# File 'lib/deep_cover/tools/profiling.rb', line 18

def resume
  profiler.resume
end

#startObject

Simple forwarding to implementation



6
7
8
# File 'lib/deep_cover/tools/profiling.rb', line 6

def start
  profiler.start
end

#stopObject



10
11
12
# File 'lib/deep_cover/tools/profiling.rb', line 10

def stop
  @results = profiler.stop
end