Skip to content

Commit

Permalink
Save tcpinfo and other rtt metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
stephen-soltesz committed May 8, 2020
1 parent f15e860 commit 7150763
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion ndt5/s2c/s2c.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"github.com/m-lab/ndt-server/ndt5/metrics"
"github.com/m-lab/ndt-server/ndt5/ndt"
"github.com/m-lab/ndt-server/ndt5/protocol"
"github.com/m-lab/tcp-info/tcp"
)

// ArchivalData is the data saved by the S2C test. If a researcher wants deeper
Expand All @@ -35,11 +36,14 @@ type ArchivalData struct {
MeanThroughputMbps float64
MinRTT time.Duration
MaxRTT time.Duration
SumRTT time.Duration
CountRTT uint32
LossRate float64
ClientReportedMbps float64
// TODO: Add TCPEngine (bbr, cubic, reno, etc.), MaxThroughputKbps, and Jitter

Error string `json:",omitempty"`
TCPInfo *tcp.LinuxTCPInfo `json:",omitempty"`
Error string `json:",omitempty"`
}

// ManageTest manages the s2c test lifecycle
Expand Down Expand Up @@ -123,8 +127,11 @@ func ManageTest(ctx context.Context, controlConn protocol.Connection, s ndt.Serv
kbps := bps / 1000
record.MinRTT = time.Duration(web100metrics.MinRTT) * time.Millisecond
record.MaxRTT = time.Duration(web100metrics.MaxRTT) * time.Millisecond
record.SumRTT = time.Duration(web100metrics.SumRTT) * time.Millisecond
record.CountRTT = web100metrics.CountRTT
record.MeanThroughputMbps = kbps / 1000 // Convert Kbps to Mbps
record.LossRate = float64(web100metrics.TCPInfo.BytesRetrans) / float64(web100metrics.TCPInfo.BytesSent)
record.TCPInfo = &web100metrics.TCPInfo

// Send download results to the client.
err = m.SendS2CResults(int64(kbps), 0, web100metrics.TCPInfo.BytesAcked)
Expand Down

0 comments on commit 7150763

Please sign in to comment.