Module: ProfileIt::Tracer

Defined in:
lib/profile_it/tracer.rb

Overview

Contains the methods that instrument blocks of code.

When a code block is wrapped inside #instrument(metric_name):

  • The #instrument method pushes a StackItem onto Store#stack

  • When a code block is finished, #instrument pops the last item off the stack and verifies it’s the StackItem we created earlier.

  • Once verified, the metrics for the recording session are merged into the in-memory Store#metric_hash. The current scope is also set for the metric (if Thread::current isn’t nil).

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Class Method Details

.included(klass) ⇒ Object



10
11
12
# File 'lib/profile_it/tracer.rb', line 10

def self.included(klass)
  klass.extend ClassMethods
end