Class: Autotuner::RequestContext

Inherits:
Object
  • Object
show all
Defined in:
lib/autotuner/request_context.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeRequestContext

Returns a new instance of RequestContext.



9
10
11
12
13
14
15
# File 'lib/autotuner/request_context.rb', line 9

def initialize
  @before_gc_context = GCContext.new
  @after_gc_context = GCContext.new
  @request_time = 0.0

  @start_time_ms = 0.0
end

Instance Attribute Details

#after_gc_contextObject (readonly)

Returns the value of attribute after_gc_context.



6
7
8
# File 'lib/autotuner/request_context.rb', line 6

def after_gc_context
  @after_gc_context
end

#before_gc_contextObject (readonly)

Returns the value of attribute before_gc_context.



5
6
7
# File 'lib/autotuner/request_context.rb', line 5

def before_gc_context
  @before_gc_context
end

#request_timeObject (readonly)

Returns the value of attribute request_time.



7
8
9
# File 'lib/autotuner/request_context.rb', line 7

def request_time
  @request_time
end

Instance Method Details

#after_requestObject



22
23
24
25
# File 'lib/autotuner/request_context.rb', line 22

def after_request
  @request_time = Process.clock_gettime(Process::CLOCK_MONOTONIC, :float_millisecond) - @start_time_ms
  @after_gc_context.update
end

#before_requestObject



17
18
19
20
# File 'lib/autotuner/request_context.rb', line 17

def before_request
  @before_gc_context.update
  @start_time_ms = Process.clock_gettime(Process::CLOCK_MONOTONIC, :float_millisecond)
end