Class: Autotuner::RequestContext
- Inherits:
-
Object
- Object
- Autotuner::RequestContext
- Defined in:
- lib/autotuner/request_context.rb
Instance Attribute Summary collapse
-
#after_gc_context ⇒ Object
readonly
Returns the value of attribute after_gc_context.
-
#before_gc_context ⇒ Object
readonly
Returns the value of attribute before_gc_context.
-
#request_time ⇒ Object
readonly
Returns the value of attribute request_time.
Instance Method Summary collapse
- #after_request ⇒ Object
- #before_request ⇒ Object
-
#initialize ⇒ RequestContext
constructor
A new instance of RequestContext.
Constructor Details
#initialize ⇒ RequestContext
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_context ⇒ Object (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_context ⇒ Object (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_time ⇒ Object (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_request ⇒ Object
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_request ⇒ Object
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 |