class Async::HTTP::Statistics

Tracks response timing statistics including time to first byte and total duration.

def self.start

@returns [Statistics] A new statistics instance.
Start tracking statistics from the current time.
def self.start
	self.new(Clock.now)
end

def initialize(start_time)

@parameter start_time [Float] The start time for measuring durations.
Initialize the statistics tracker.
def initialize(start_time)
	@start_time = start_time
end

def wrap(response, &block)

@returns [Protocol::HTTP::Response] The wrapped response.
@parameter response [Protocol::HTTP::Response] The response to wrap.
Wrap a response body with a statistics-collecting wrapper.
def wrap(response, &block)
	if response and response.body
		response.body = Body::Statistics.new(@start_time, response.body, block)
	end
	
	return response
end