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

fix: single status line for one stream #43

Merged
merged 1 commit into from
Jan 17, 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: 10 additions & 5 deletions cmd/minimal-download/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -349,21 +349,26 @@ func main() {
wg.Wait()

log.Println("------")
// Average over all connections.
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)

// Average over first connection.
elapsedAvg := s.firstStopTime.Sub(s.firstStartTime)
bytesAvg := s.bytesAtFirstStop.Load() // like msak-client, bytes during first-start to first-stop.
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)
if *flagStreams > 1 {
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)
}

// TODO: we assume connections all overlap during peak periods.
// NOTE: we assume connections all overlap during peak periods.
// Average over period when all streams were concurrent.
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 {
Expand Down