Skip to main content

Module bandwidth_loop

Module bandwidth_loop 

Source
Expand description

Shared bandwidth measurement loop for download/upload tests.

Eliminates duplication between download.rs and upload.rs by providing a unified state for:

  • Throttled speed sampling (20 Hz max)
  • Peak speed tracking
  • Progress bar updates
  • Atomic byte counting

Each I/O operation (download chunk, upload round) calls record_bytes() to update shared state. Call finish() at the end to compute final results.

Structsยง

BandwidthLoopState
Shared state for a bandwidth test (download or upload).
BandwidthResult
Final result from a bandwidth test.