pub struct BandwidthMeasurement {
pub direction: TransferDirection,
pub bytes: usize,
pub elapsed_ms: f64,
pub bandwidth_gbps: f64,
pub timestamp: Instant,
}Expand description
A single transfer bandwidth measurement.
Each measurement captures the direction, size, elapsed time, computed throughput, and a wall-clock timestamp for when it was recorded.
Fields§
§direction: TransferDirectionDirection of the transfer.
bytes: usizeNumber of bytes transferred.
elapsed_ms: f64Elapsed time for the transfer in milliseconds.
bandwidth_gbps: f64Computed bandwidth in GB/s (10^9 bytes/s).
timestamp: InstantWall-clock timestamp when this measurement was created.
Implementations§
Source§impl BandwidthMeasurement
impl BandwidthMeasurement
Sourcepub fn new(direction: TransferDirection, bytes: usize, elapsed_ms: f64) -> Self
pub fn new(direction: TransferDirection, bytes: usize, elapsed_ms: f64) -> Self
Creates a new measurement from raw transfer parameters.
The bandwidth_gbps field is automatically computed from bytes and
elapsed_ms. If elapsed_ms is zero or negative, bandwidth is set
to zero to avoid division-by-zero or negative values.
Sourcepub fn bandwidth_mbps(&self) -> f64
pub fn bandwidth_mbps(&self) -> f64
Returns the bandwidth in MB/s (10^6 bytes/s).
Sourcepub fn latency_us(&self) -> f64
pub fn latency_us(&self) -> f64
Returns the transfer latency in microseconds.
Trait Implementations§
Source§impl Clone for BandwidthMeasurement
impl Clone for BandwidthMeasurement
Source§fn clone(&self) -> BandwidthMeasurement
fn clone(&self) -> BandwidthMeasurement
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for BandwidthMeasurement
impl Debug for BandwidthMeasurement
Auto Trait Implementations§
impl Freeze for BandwidthMeasurement
impl RefUnwindSafe for BandwidthMeasurement
impl Send for BandwidthMeasurement
impl Sync for BandwidthMeasurement
impl Unpin for BandwidthMeasurement
impl UnsafeUnpin for BandwidthMeasurement
impl UnwindSafe for BandwidthMeasurement
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more