diff options
| author | Will Hawkins <[email protected]> | 2024-01-26 20:46:05 -0500 |
|---|---|---|
| committer | Will Hawkins <[email protected]> | 2024-01-26 20:46:05 -0500 |
| commit | e60066f572464da3a6f55999a48b1d38cf6423d6 (patch) | |
| tree | b6e5c38f0ece8e22aac7414b43c24c4632fe4690 /rpm | |
| parent | 65b039e33717ee43620363704cb3daa304a5e724 (diff) | |
[Bugfix] Only probes collected during stable MAD count
For calculating the final RPM, only those probes that are sent/received
during the stable MAD should count.
Signed-off-by: Will Hawkins <[email protected]>
Diffstat (limited to 'rpm')
| -rw-r--r-- | rpm/calculations.go | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/rpm/calculations.go b/rpm/calculations.go index f3619dc..851e168 100644 --- a/rpm/calculations.go +++ b/rpm/calculations.go @@ -19,7 +19,6 @@ import ( "github.com/network-quality/goresponsiveness/series" "github.com/network-quality/goresponsiveness/utilities" - "golang.org/x/exp/constraints" ) type Rpm[Data utilities.Number] struct { @@ -35,7 +34,7 @@ type Rpm[Data utilities.Number] struct { MeanRpm float64 } -func CalculateRpm[Data utilities.Number, Bucket constraints.Ordered]( +func CalculateRpm[Data utilities.Number, Bucket utilities.Number]( selfRtts series.WindowSeries[Data, Bucket], aggregatedForeignRtts series.WindowSeries[Data, Bucket], trimming uint, percentile uint, ) *Rpm[Data] { // There may be more than one round trip accumulated together. If that is the case, @@ -56,12 +55,14 @@ func CalculateRpm[Data utilities.Number, Bucket constraints.Ordered]( } } + boundedSelfRtts := selfRtts.ExtractBoundedSeries() + // First, let's do a double-sided trim of the top/bottom 10% of our measurements. - selfRttsTotalCount, _ := selfRtts.Count() + selfRttsTotalCount, _ := boundedSelfRtts.Count() foreignRttsTotalCount, _ := foreignRtts.Count() _, selfProbeRoundTripTimeMean, selfRttsTrimmed := - series.TrimmedMean(selfRtts, int(trimming)) + series.TrimmedMean(boundedSelfRtts, int(trimming)) _, foreignProbeRoundTripTimeMean, foreignRttsTrimmed := series.TrimmedMean(foreignRtts, int(trimming)) @@ -69,7 +70,7 @@ func CalculateRpm[Data utilities.Number, Bucket constraints.Ordered]( foreignRttsTrimmedCount := len(foreignRttsTrimmed) // Second, let's do the P90 calculations. - _, selfProbeRoundTripTimePN := series.Percentile(selfRtts, percentile) + _, selfProbeRoundTripTimePN := series.Percentile(boundedSelfRtts, percentile) _, foreignProbeRoundTripTimePN := series.Percentile(foreignRtts, percentile) // Note: The specification indicates that we want to calculate the foreign probes as such: |
