func (t *HTTPTrace) Latency() HTTPLatency {
	latency := HTTPLatency{
		Latency:    safeTimeDelta(t.Start, t.Finish),
		ConnReused: t.Reused,

		WriteHeader:           safeTimeDelta(t.GetConnDone, t.WriteHeaderDone),
		WriteRequest:          safeTimeDelta(t.GetConnDone, t.WriteRequestDone),
		WaitResponseFirstByte: safeTimeDelta(t.WriteRequestDone, t.FirstResponseByte),
		ReadHeader:            safeTimeDelta(t.ReadHeaderStart, t.ReadHeaderDone),
		ReadBody:              safeTimeDelta(t.ReadBodyStart, t.ReadBodyDone),
	}

	if !t.Reused {
		latency.GetConn = safeTimeDelta(t.GetConnStart, t.GetConnDone)
		latency.DNS = safeTimeDelta(t.DNSStart, t.DNSDone)
		latency.Connect = safeTimeDelta(t.ConnectStart, t.ConnectDone)
		latency.TLS = safeTimeDelta(t.TLSHandshakeStart, t.TLSHandshakeDone)
	} else {
		latency.GetConn = safeTimeDelta(t.Start, t.GetConnDone)
	}

	return latency
}
// Latency returns the latencies for an HTTP request.
Latency returns the latencies for an HTTP request.
// Latency returns the latencies for an HTTP request .
func (t *HTTPTrace) Latency() HTTPLatency {
	latency := HTTPLatency{
		Latency:    safeTimeDelta(t.Start, t.Finish),
		ConnReused: t.Reused,
		WriteHeader:           safeTimeDelta(t.GetConnDone, t.WriteHeaderDone),
		WriteRequest:          safeTimeDelta(t.GetConnDone, t.WriteRequestDone),
		WaitResponseFirstByte: safeTimeDelta(t.WriteRequestDone, t.FirstResponseByte),
		ReadHeader:            safeTimeDelta(t.ReadHeaderStart, t.ReadHeaderDone),
		ReadBody:              safeTimeDelta(t.ReadBodyStart, t.ReadBodyDone),
	}
	if !t.Reused {
		latency.GetConn = safeTimeDelta(t.GetConnStart, t.GetConnDone)
		latency.DNS = safeTimeDelta(t.DNSStart, t.DNSDone)
		latency.Connect = safeTimeDelta(t.ConnectStart, t.ConnectDone)
		latency.TLS = safeTimeDelta(t.TLSHandshakeStart, t.TLSHandshakeDone)
	} else {
		latency.GetConn = safeTimeDelta(t.Start, t.GetConnDone)
	}
	return latency
}
func ( t * HTTPTrace ) Latency ( ) HTTPLatency { latency := HTTPLatency { Latency : safeTimeDelta ( t . Start , t . Finish ) , ConnReused : t . Reused , WriteHeader : safeTimeDelta ( t . GetConnDone , t . WriteHeaderDone ) , WriteRequest : safeTimeDelta ( t . GetConnDone , t . WriteRequestDone ) , WaitResponseFirstByte : safeTimeDelta ( t . WriteRequestDone , t . FirstResponseByte ) , ReadHeader : safeTimeDelta ( t . ReadHeaderStart , t . ReadHeaderDone ) , ReadBody : safeTimeDelta ( t . ReadBodyStart , t . ReadBodyDone ) , } if ! t . Reused { latency . GetConn = safeTimeDelta ( t . GetConnStart , t . GetConnDone ) latency . DNS = safeTimeDelta ( t . DNSStart , t . DNSDone ) latency . Connect = safeTimeDelta ( t . ConnectStart , t . ConnectDone ) latency . TLS = safeTimeDelta ( t . TLSHandshakeStart , t . TLSHandshakeDone ) } else { latency . GetConn = safeTimeDelta ( t . Start , t . GetConnDone ) } return latency }
Latency returns the latencies for an HTTP request.
Latency returns the latencies for an HTTP request .