Last active
May 30, 2018 17:57
-
-
Save deeptir18/22f222865e6c82c9bf7824f5a27eae41 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(def | |
(Report | |
(volatile acked 0) | |
(volatile sacked 0) | |
(volatile loss 0) | |
(volatile timeout false) | |
(volatile rtt 0) | |
(volatile inflight 0) | |
(minrtt +infinity) | |
(rttSampleCount 0) | |
(debug 0) | |
) | |
(currentMinRtt +infinity) | |
(minRttIncreaseThreshold 0) | |
(lastRTT +infinity) | |
) | |
(when true | |
(:= Report.acked (+ Report.acked Ack.bytes_acked)) | |
(:= Report.sacked (+ Report.sacked Ack.packets_misordered)) | |
(:= Report.loss Ack.lost_pkts_sample) | |
(:= Report.timeout Flow.was_timeout) | |
(:= Report.rtt Flow.rtt_sample_us) | |
(:= Report.inflight Flow.packets_in_flight) | |
(:= Report.minrtt (min Report.minrtt Flow.rtt_sample_us)) | |
(:= Report.rttSampleCount (!if (== lastRTT Flow.rtt_sample_us) (+ Report.rttSampleCount 1))) | |
(:= lastRTT Flow.rtt_sample_us) | |
(:= Cwnd (+ Cwnd Ack.bytes_acked)) | |
(fallthrough) | |
) | |
(when (< Report.rttSampleCount 9) | |
(:= currentMinRtt (min currentMinRtt Flow.rtt_sample_us)) | |
(fallthrough) | |
) | |
(when (== Report.rttSampleCount 8) | |
(:= minRttIncreaseThreshold (/ Report.minrtt 8)) | |
(:= Report.debug minRttIncreaseThreshold) | |
(fallthrough) | |
) | |
(when (&& (> minRttIncreaseThreshold 0) (&& (> Cwnd 23360) (> currentMinRtt (+ Report.minrtt minRttIncreaseThreshold)))) | |
(:= Report.debug 20) | |
(report) | |
) | |
(when (|| Report.timeout (> Report.loss 0)) | |
(report) | |
) | |
", None | |
).unwrap() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment