pub fn classify(
        &mut self,
        rott: f64,
        interarrival_time: f64,
        num_lost_packets: u32,
    ) -> PacketLoss {
        assert!(rott >= 0.0);
        assert!(interarrival_time >= 0.0);
        assert!(num_lost_packets > 0);

        if interarrival_time < self.t_min {
            self.t_min = interarrival_time;
        }
        if rott < self.rott_min {
            self.rott_min = rott;
        }

        self.t_avg = 0.875 * self.t_avg
            + 0.125 * interarrival_time * interarrival_time / num_lost_packets as f64;

        // In WLH topology t_narr ~ 1, while in WB topology t_narr ~ N, where N is the number of flows
        // sharing the link with the lowest bandwidth.
        let t_narr = self.t_avg / self.t_min;

        if rott < self.rott_min + 0.05 * self.t_min {
            self.spike.classify(rott)
        } else {
            if t_narr < 0.875 {
                self.zigzag.classify(rott, num_lost_packets)
            } else if t_narr < 1.5 {
                self.mbiaz.classify(interarrival_time, num_lost_packets)
            } else if t_narr < 2.0 {
                self.zigzag.classify(rott, num_lost_packets)
            } else {
                self.spike.classify(rott)
            }
        }
    }
/// Classifies the reason of packet loss based on the ROTT of the current packet.
///
/// # Arguments
///
/// - `rott`: relative one-way trip time of the current packet.
/// - `interarrival_time`: interarrival time between packet P(i) and packet P(i + n + 1).
/// - `num_lost_packets`: number of packets that have been lost in a row.
Classifies the reason of packet loss based on the ROTT of the current packet.
Classifies the reason of packet loss based on the ROTT of the current packet .
pub fn classify(
        &mut self,
        rott: f64,
        interarrival_time: f64,
        num_lost_packets: u32,
    ) -> PacketLoss {
        assert!(rott >= 0.0);
        assert!(interarrival_time >= 0.0);
        assert!(num_lost_packets > 0);
        if interarrival_time < self.t_min {
            self.t_min = interarrival_time;
        }
        if rott < self.rott_min {
            self.rott_min = rott;
        }
        self.t_avg = 0.875 * self.t_avg
            + 0.125 * interarrival_time * interarrival_time / num_lost_packets as f64;
        // In WLH topology t_narr ~ 1, while in WB topology t_narr ~ N, where N is the number of flows
        // sharing the link with the lowest bandwidth.
        let t_narr = self.t_avg / self.t_min;
        if rott < self.rott_min + 0.05 * self.t_min {
            self.spike.classify(rott)
        } else {
            if t_narr < 0.875 {
                self.zigzag.classify(rott, num_lost_packets)
            } else if t_narr < 1.5 {
                self.mbiaz.classify(interarrival_time, num_lost_packets)
            } else if t_narr < 2.0 {
                self.zigzag.classify(rott, num_lost_packets)
            } else {
                self.spike.classify(rott)
            }
        }
    }
pub fn classify ( & mut self , rott : f64 , interarrival_time : f64 , num_lost_packets : u32 , ) -> PacketLoss { assert ! ( rott 0.0 ) ; assert ! ( interarrival_time 0.0 ) ; assert ! ( num_lost_packets 0 ) ; if interarrival_time < self . t_min { self . t_min = interarrival_time ; } if rott < self . rott_min { self . rott_min = rott ; } self . t_avg = 0.875 * self . t_avg + 0.125 * interarrival_time * interarrival_time / num_lost_packets as f64 ; // In WLH topology t_narr ~ 1, while in WB topology t_narr ~ N, where N is the number of flows // sharing the link with the lowest bandwidth. let t_narr = self . t_avg / self . t_min ; if rott < self . rott_min + 0.05 * self . t_min { self . spike . classify ( rott ) } else { if t_narr < 0.875 { self . zigzag . classify ( rott , num_lost_packets ) } else if t_narr < 1.5 { self . mbiaz . classify ( interarrival_time , num_lost_packets ) } else if t_narr < 2.0 { self . zigzag . classify ( rott , num_lost_packets ) } else { self . spike . classify ( rott ) } } }
Classifies the reason of packet loss based on the ROTT of the current packet.
Classifies the reason of packet loss based on the ROTT of the current packet .
&mut self
rott
f64
relative one-way trip time of the current packet.
relative one - way trip time of the current packet .
interarrival_time
f64
interarrival time between packet P(i) and packet P(i + n + 1).
interarrival time between packet P ( i ) and packet P ( i + n + 1 ) .
num_lost_packets
u32
number of packets that have been lost in a row.
number of packets that have been lost in a row .