Class: Rack::MiniProfiler::CustomTimerStruct

Inherits:
TimerStruct
  • Object
show all
Defined in:
lib/mini_profiler/custom_timer_struct.rb

Overview

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

Instance Method Summary collapse

Methods inherited from TimerStruct

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

Constructor Details

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

Returns a new instance of CustomTimerStruct.



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

def initialize(type, duration_ms, page, parent)
  @parent = parent
  @page = page
  @type = type

  super("Type" => type,
        "StartMilliseconds" => ((Time.now.to_f * 1000).to_i - page['Started']) - duration_ms,
        "DurationMilliseconds" => duration_ms,
        "ParentTimingId" => nil)
end