qlog loss recovery metrics

This commit is contained in:
Marten Seemann
2020-01-27 15:26:59 +07:00
parent a58bcb747b
commit f13ca7e791
6 changed files with 101 additions and 4 deletions

View File

@@ -4,6 +4,8 @@ import (
"io"
"time"
"github.com/lucas-clemente/quic-go/internal/congestion"
"github.com/francoispqt/gojay"
"github.com/lucas-clemente/quic-go/internal/protocol"
"github.com/lucas-clemente/quic-go/internal/wire"
@@ -15,6 +17,7 @@ type Tracer interface {
SentPacket(time.Time, *wire.ExtendedHeader, *wire.AckFrame, []wire.Frame)
ReceivedRetry(time.Time, *wire.Header)
ReceivedPacket(time.Time, *wire.ExtendedHeader, []wire.Frame)
UpdatedMetrics(time time.Time, rttStats *congestion.RTTStats, cwnd protocol.ByteCount, bytesInFLight protocol.ByteCount, packetsInFlight int)
}
type tracer struct {
@@ -101,3 +104,18 @@ func (t *tracer) ReceivedRetry(time time.Time, hdr *wire.Header) {
},
})
}
func (t *tracer) UpdatedMetrics(time time.Time, rttStats *congestion.RTTStats, cwnd, bytesInFlight protocol.ByteCount, packetsInFlight int) {
t.events = append(t.events, event{
Time: time,
eventDetails: eventMetricsUpdated{
MinRTT: rttStats.MinRTT(),
SmoothedRTT: rttStats.SmoothedRTT(),
LatestRTT: rttStats.LatestRTT(),
RTTVariance: rttStats.MeanDeviation(),
CongestionWindow: cwnd,
BytesInFlight: bytesInFlight,
PacketsInFlight: packetsInFlight,
},
})
}