Module: Profiler

Defined in:
lib/profiler.rb,
lib/profiler/result.rb,
lib/profiler/profile.rb,
lib/profiler/version.rb,
lib/profiler/printers/flat_printer.rb,
lib/profiler/printers/abstract_printer.rb

Defined Under Namespace

Classes: AbstractPrinter, FlatPrinter, Profile, Result

Constant Summary collapse

VERSION =
'0.1.0'

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.is_pausedObject

Returns the value of attribute is_paused.



8
9
10
# File 'lib/profiler.rb', line 8

def is_paused
  @is_paused
end

.profileObject

Returns the value of attribute profile.



8
9
10
# File 'lib/profiler.rb', line 8

def profile
  @profile
end

Class Method Details

.check(caller_offset = 0) ⇒ Object



23
24
25
26
27
# File 'lib/profiler.rb', line 23

def check(caller_offset=0)
  raise "Profiler hasn't started yet. Please call Profiler.start first." if self.profile.nil?
  return if is_paused
  profile.check(caller_offset)
end

.pauseObject



15
16
17
# File 'lib/profiler.rb', line 15

def pause
  self.is_paused = true
end

.resultObject



33
34
35
# File 'lib/profiler.rb', line 33

def result
  profile.result
end

.resumeObject



19
20
21
# File 'lib/profiler.rb', line 19

def resume
  self.is_paused = false
end

.startObject



10
11
12
13
# File 'lib/profiler.rb', line 10

def start
  self.profile = Profile.new
  self.is_paused = false
end

.stopObject



29
30
31
# File 'lib/profiler.rb', line 29

def stop
  profile.stop
end