Class: Rack::MiniProfiler::TimerStruct::Custom

Inherits:
Base
  • Object
show all
Defined in:
lib/mini_profiler/timer_struct/custom.rb

Overview

Timing system for a custom timers such as cache, redis, RPC, external API calls, etc.

Instance Method Summary collapse

Methods inherited from Base

#[], #[]=, #as_json, #attributes, #to_json

Constructor Details

#initialize(type, duration_ms, page, parent) ⇒ Custom

Returns a new instance of Custom.



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/mini_profiler/timer_struct/custom.rb', line 7

def initialize(type, duration_ms, page, parent)
  @parent      = parent
  @page        = page
  @type        = type
  start_millis = ((Time.now.to_f * 1000).to_i - page[:started]) - duration_ms
  super(
    :type                  => type,
    :start_milliseconds    => start_millis,
    :duration_milliseconds => duration_ms,
    :parent_timing_id      => nil
  )
end