From fcb0d6cfdc8e082e7a8158b7903787ad70c4eb5b Mon Sep 17 00:00:00 2001 From: Marten Seemann Date: Mon, 8 Apr 2019 10:51:13 +0900 Subject: [PATCH] record InSlowStart and InRecovery --- internal/ackhandler/sent_packet_handler.go | 2 ++ internal/congestion/interface.go | 2 ++ internal/mocks/congestion.go | 28 ++++++++++++++++++++++ quictrace/interface.go | 2 ++ quictrace/tracer.go | 12 ++++++---- 5 files changed, 41 insertions(+), 5 deletions(-) diff --git a/internal/ackhandler/sent_packet_handler.go b/internal/ackhandler/sent_packet_handler.go index b3159a9c7..08a1643bc 100644 --- a/internal/ackhandler/sent_packet_handler.go +++ b/internal/ackhandler/sent_packet_handler.go @@ -694,5 +694,7 @@ func (h *sentPacketHandler) GetStats() *quictrace.TransportState { LatestRTT: h.rttStats.LatestRTT(), BytesInFlight: h.bytesInFlight, CongestionWindow: h.congestion.GetCongestionWindow(), + InSlowStart: h.congestion.InSlowStart(), + InRecovery: h.congestion.InRecovery(), } } diff --git a/internal/congestion/interface.go b/internal/congestion/interface.go index c6f098215..7f09246e6 100644 --- a/internal/congestion/interface.go +++ b/internal/congestion/interface.go @@ -20,5 +20,7 @@ type SendAlgorithm interface { // A SendAlgorithmWithDebugInfos is a SendAlgorithm that exposes some debug infos type SendAlgorithmWithDebugInfos interface { SendAlgorithm + InSlowStart() bool + InRecovery() bool GetCongestionWindow() protocol.ByteCount } diff --git a/internal/mocks/congestion.go b/internal/mocks/congestion.go index ea8970ff6..c678c47dc 100644 --- a/internal/mocks/congestion.go +++ b/internal/mocks/congestion.go @@ -63,6 +63,34 @@ func (mr *MockSendAlgorithmWithDebugInfosMockRecorder) GetCongestionWindow() *go return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetCongestionWindow", reflect.TypeOf((*MockSendAlgorithmWithDebugInfos)(nil).GetCongestionWindow)) } +// InRecovery mocks base method +func (m *MockSendAlgorithmWithDebugInfos) InRecovery() bool { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "InRecovery") + ret0, _ := ret[0].(bool) + return ret0 +} + +// InRecovery indicates an expected call of InRecovery +func (mr *MockSendAlgorithmWithDebugInfosMockRecorder) InRecovery() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "InRecovery", reflect.TypeOf((*MockSendAlgorithmWithDebugInfos)(nil).InRecovery)) +} + +// InSlowStart mocks base method +func (m *MockSendAlgorithmWithDebugInfos) InSlowStart() bool { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "InSlowStart") + ret0, _ := ret[0].(bool) + return ret0 +} + +// InSlowStart indicates an expected call of InSlowStart +func (mr *MockSendAlgorithmWithDebugInfosMockRecorder) InSlowStart() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "InSlowStart", reflect.TypeOf((*MockSendAlgorithmWithDebugInfos)(nil).InSlowStart)) +} + // MaybeExitSlowStart mocks base method func (m *MockSendAlgorithmWithDebugInfos) MaybeExitSlowStart() { m.ctrl.T.Helper() diff --git a/quictrace/interface.go b/quictrace/interface.go index 83781bd2b..561c5543b 100644 --- a/quictrace/interface.go +++ b/quictrace/interface.go @@ -45,4 +45,6 @@ type TransportState struct { BytesInFlight protocol.ByteCount CongestionWindow protocol.ByteCount + InSlowStart bool + InRecovery bool } diff --git a/quictrace/tracer.go b/quictrace/tracer.go index 4bcc706a6..8b9db6cd4 100644 --- a/quictrace/tracer.go +++ b/quictrace/tracer.go @@ -173,12 +173,14 @@ func getFrames(wframes []wire.Frame) []*pb.Frame { func getTransportState(state *TransportState) *pb.TransportState { bytesInFlight := uint64(state.BytesInFlight) congestionWindow := uint64(state.CongestionWindow) + ccs := fmt.Sprintf("InSlowStart: %t, InRecovery: %t", state.InSlowStart, state.InRecovery) return &pb.TransportState{ - MinRttUs: durationToUs(state.MinRTT), - SmoothedRttUs: durationToUs(state.SmoothedRTT), - LastRttUs: durationToUs(state.LatestRTT), - InFlightBytes: &bytesInFlight, - CwndBytes: &congestionWindow, + MinRttUs: durationToUs(state.MinRTT), + SmoothedRttUs: durationToUs(state.SmoothedRTT), + LastRttUs: durationToUs(state.LatestRTT), + InFlightBytes: &bytesInFlight, + CwndBytes: &congestionWindow, + CongestionControlState: &ccs, } }