Class: Critique::Profiling::Profiler

Inherits:
Object
  • Object
show all
Defined in:
lib/critique/profiling.rb

Class Method Summary collapse

Class Method Details

.enter(label) ⇒ Object



20
21
22
23
24
25
# File 'lib/critique/profiling.rb', line 20

def enter(label)
  padding(:+)
  before = stack.push(system_usage.push(label)).last

  info(([label, '-->', filler(label)] + pretty(before)).join(' '))
end

.info(message) ⇒ Object



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

def info(message)
  Critique.logger.info(['X', padding, message].join)
end

.leave(label) ⇒ Object



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

def leave(label)
  before = stack.pop
  after  = system_usage

  info(([label, '<--', filler(label)] + pretty(after, before)).join(' '))

  padding(:-)
end