class Flows::Plugin::Profiler::Report

Base class for {Profiler} reports.

@!method to_s

@abstract
@return [String] human-readable representation.

Constants

Event

@api private

Attributes

raw_data[R]

@return [Array<Array>] raw profiler events

Public Class Methods

new() click to toggle source
# File lib/flows/plugin/profiler/report.rb, line 18
def initialize
  @raw_data = []
end

Public Instance Methods

add(*args) click to toggle source

Add event to profile report.

@param event_type [:started, :finished] event type @param klass [Class] class where called method is placed @param method_type [:instance, :singleton] method type @param method_name [Symbol] name of the called method @param data [nil, Float] event data, time represented as

a Float microseconds value.
# File lib/flows/plugin/profiler/report.rb, line 30
def add(*args)
  raw_data << args
end
events() click to toggle source

@return [Array<Event>] array of events

# File lib/flows/plugin/profiler/report.rb, line 35
def events
  raw_data.map do |raw_event|
    klass = case raw_event.first
            when :started then StartEvent
            when :finished then FinishEvent
            end

    klass.new(*raw_event[1..-1])
  end
end