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:

  • LoopState — unified state for throttled speed sampling, peak tracking, progress bar updates, and atomic byte counting
  • run_concurrent_streams — shared spawn/collect/report pattern that both download and upload tests delegate to

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§

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

Constants§

SAMPLE_INTERVAL_MS
Throttle interval for speed sampling (20 Hz max).

Functions§

run_concurrent_streams
Run a bandwidth test using multiple concurrent streams.