summaryrefslogtreecommitdiff
path: root/rpm/parameters.go
diff options
context:
space:
mode:
authorWill Hawkins <[email protected]>2023-07-14 10:55:02 -0400
committerWill Hawkins <[email protected]>2023-07-14 10:58:51 -0400
commitdf37c3e0d572ff3b4b4de3e9919402e8e0ccf971 (patch)
tree62e35137fa3d233f5506804775b6c71e728e71c3 /rpm/parameters.go
parent399eda676f7889accf72231c6696b89de7ea3fae (diff)
Parameterize Percentile in RPM Calculations
Make the percentile used by RPM calculations user-controlled. Note: A percentile-based calculation is not part of the spec. This is an optional feature. Signed-off-by: Will Hawkins <[email protected]>
Diffstat (limited to 'rpm/parameters.go')
-rw-r--r--rpm/parameters.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/rpm/parameters.go b/rpm/parameters.go
index aff8639..1d7e065 100644
--- a/rpm/parameters.go
+++ b/rpm/parameters.go
@@ -30,9 +30,10 @@ type SpecParameters struct {
MaxParallelConns int
ProbeInterval time.Duration
ProbeCapacityPct float64
+ Percentile uint
}
-func SpecParametersFromArguments(timeout int, mad int, id int, tmp uint, sdt float64, mnp int, mps int, ptc float64) (*SpecParameters, error) {
+func SpecParametersFromArguments(timeout int, mad int, id int, tmp uint, sdt float64, mnp int, mps int, ptc float64, p int) (*SpecParameters, error) {
if timeout <= 0 {
return nil, fmt.Errorf("cannot specify a 0 or negative timeout for the test")
}
@@ -57,6 +58,9 @@ func SpecParametersFromArguments(timeout int, mad int, id int, tmp uint, sdt flo
if ptc <= 0 {
return nil, fmt.Errorf("cannot specify a 0 or negative probe capacity for the test")
}
+ if p < 1 || p >= 100 {
+ return nil, fmt.Errorf("percentile for statistical calculations (%v) is invalid", p)
+ }
testTimeout := time.Second * time.Duration(timeout)
evalInterval := time.Second * time.Duration(id)
probeInterval := utilities.PerSecondToInterval(int64(mps))
@@ -64,7 +68,7 @@ func SpecParametersFromArguments(timeout int, mad int, id int, tmp uint, sdt flo
params := SpecParameters{
TestTimeout: testTimeout, MovingAvgDist: mad,
EvalInterval: evalInterval, TrimmedMeanPct: tmp, StdDevTolerance: sdt,
- MaxParallelConns: mnp, ProbeInterval: probeInterval, ProbeCapacityPct: ptc,
+ MaxParallelConns: mnp, ProbeInterval: probeInterval, ProbeCapacityPct: ptc, Percentile: uint(p),
}
return &params, nil
}