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 Attribute Summary collapse

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.



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/mini_profiler/timer_struct/custom.rb', line 10

def initialize(type, duration_ms, page, parent)
  @parent      = parent
  @page        = page
  @type        = type
  start_millis = ((Process.clock_gettime(Process::CLOCK_MONOTONIC) * 1000).to_i - page[:started]) - duration_ms
  super(
    type: type,
    start_milliseconds: start_millis,
    duration_milliseconds: duration_ms,
    parent_timing_id: nil
  )
end

Instance Attribute Details

#parentObject

Returns the value of attribute parent.



9
10
11
# File 'lib/mini_profiler/timer_struct/custom.rb', line 9

def parent
  @parent
end