Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update formatting #39

Merged
merged 1 commit into from
Jan 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions cmd/minimal-download/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ func prepareHeaders(ctx context.Context, s *url.URL) (string, http.Header) {

// formatMessage reports a WireMeasurement in a human readable format.
func formatMessage(prefix string, stream int, m WireMeasurement) {
log.Printf("%s #%d - rate %0.2f Mbps, rtt %5.2fms, elapsed %0.4fs, application r/w: %d/%d, network r/w: %d/%d kernel* r/w: %d/%d\n",
log.Printf("%s #%d rate: %0.2f Mbps, rtt %5.2fms, elapsed %0.4fs, application r/w: %d/%d, network r/w: %d/%d kernel* r/w: %d/%d\n",
prefix, stream,
8*float64(m.TCPInfo["BytesAcked"])/(float64(m.ElapsedTime)), // to mbps.
float64(m.TCPInfo["RTT"])/1000.0, // to ms.
Expand Down Expand Up @@ -312,7 +312,7 @@ outer:
case streamCount > 1 && stream == 0:
// Only do this for one stream.
elapsed := time.Since(s.firstStartTime)
log.Printf("Download client #1 - Avg %0.2f Mbps, MinRTT %5.2fms, elapsed %0.4fs, application r/w: %d/%d\n",
log.Printf("Download stream #1 rate: %0.2f Mbps, MinRTT %5.2fms, elapsed %0.4fs, application r/w: %d/%d\n",
8*float64(s.bytesTotal.Load())/1e6/elapsed.Seconds(), // as mbps.
float64(s.minRTT.Load())/1000.0, // as ms.
elapsed.Seconds(), 0, s.bytesTotal.Load())
Expand Down Expand Up @@ -345,9 +345,16 @@ func main() {
wg.Wait()

log.Println("------")
elapsedTotal := s.lastStopTime.Sub(s.firstStartTime)
bytesTotal := s.bytesTotal.Load()
log.Printf("Download total average: %0.2f Mbps, MinRTT %5.2fms, elapsed %0.4fs, application r/w: %d/%d\n",
8*float64(bytesTotal)/1e6/elapsedTotal.Seconds(), // as mbps.
float64(s.minRTT.Load())/1000.0, // as ms.
elapsedTotal.Seconds(), 0, bytesTotal)

elapsedAvg := s.firstStopTime.Sub(s.firstStartTime)
bytesAvg := s.bytesAtFirstStop.Load() // like msak-client, bytes during first-start to first-stop.
log.Printf("Download client #1 - Avg %0.2f Mbps, MinRTT %5.2fms, elapsed %0.4fs, application r/w: %d/%d\n",
log.Printf("Download first average: %0.2f Mbps, MinRTT %5.2fms, elapsed %0.4fs, application r/w: %d/%d\n",
8*float64(bytesAvg)/1e6/elapsedAvg.Seconds(), // as mbps.
float64(s.minRTT.Load())/1000.0, // as ms.
elapsedAvg.Seconds(), 0, bytesAvg)
Expand All @@ -356,7 +363,7 @@ func main() {
elapsedPeak := s.firstStopTime.Sub(s.lastStartTime)
bytesPeak := s.bytesAtFirstStop.Load() - s.bytesAtLastStart.Load() // bytes during of peak period.
if *flagStreams > 1 && bytesPeak > 0 && elapsedPeak > 0 {
log.Printf("Download client #1 - Peak %0.2f Mbps, MinRTT %5.2fms, elapsed %0.4fs, application r/w: %d/%d\n",
log.Printf("Download center average: %0.2f Mbps, MinRTT %5.2fms, elapsed %0.4fs, application r/w: %d/%d\n",
8*float64(bytesPeak)/1e6/elapsedPeak.Seconds(), // as mbps.
float64(s.minRTT.Load())/1000.0, // as ms.
elapsedPeak.Seconds(), 0, bytesPeak)
Expand Down