diff options
| author | Will Hawkins <[email protected]> | 2023-02-10 18:47:42 -0500 |
|---|---|---|
| committer | Will Hawkins <[email protected]> | 2023-02-10 18:47:42 -0500 |
| commit | a2aeaef3cd55c3c6e5977b77d1ed146bb2b20e23 (patch) | |
| tree | 89720ec9788b1df50a3599b5cf4fc82c19898e73 /stabilizer/rev3.go | |
| parent | 14d738b379c5a64f70c77795f06b3716eb6c4c57 (diff) | |
[Cleanup] Long-lines cleanup
Diffstat (limited to 'stabilizer/rev3.go')
| -rw-r--r-- | stabilizer/rev3.go | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/stabilizer/rev3.go b/stabilizer/rev3.go index fa9b378..4ab0bd9 100644 --- a/stabilizer/rev3.go +++ b/stabilizer/rev3.go @@ -41,7 +41,13 @@ type ThroughputStabilizer DataPointStabilizer // calculate the standard deviation of those values. If the calculated standard deviation is less than S, we declare // stability. -func NewProbeStabilizer(i uint64, k uint64, s float64, debugLevel debug.DebugLevel, debug *debug.DebugWithPrefix) ProbeStabilizer { +func NewProbeStabilizer( + i uint64, + k uint64, + s float64, + debugLevel debug.DebugLevel, + debug *debug.DebugWithPrefix, +) ProbeStabilizer { return ProbeStabilizer{instantaneousMeasurements: ms.NewCappedMathematicalSeries[float64](i), movingAverages: ms.NewCappedMathematicalSeries[float64](k), stabilityStandardDeviation: s, @@ -58,7 +64,9 @@ func (r3 *ProbeStabilizer) AddMeasurement(measurement rpm.ProbeDataPoint) { // be 1 / measurement.RoundTripCount of the total length. for range utilities.Iota(0, int(measurement.RoundTripCount)) { // Add this instantaneous measurement to the mix of the I previous instantaneous measurements. - r3.instantaneousMeasurements.AddElement(measurement.Duration.Seconds() / float64(measurement.RoundTripCount)) + r3.instantaneousMeasurements.AddElement( + measurement.Duration.Seconds() / float64(measurement.RoundTripCount), + ) } // Calculate the moving average of the I previous instantaneous measurements and add it to // the mix of K previous moving averages. @@ -108,12 +116,20 @@ func (r3 *ProbeStabilizer) IsStable() bool { return isStable } -func NewThroughputStabilizer(i uint64, k uint64, s float64, debugLevel debug.DebugLevel, debug *debug.DebugWithPrefix) ThroughputStabilizer { - return ThroughputStabilizer{instantaneousMeasurements: ms.NewCappedMathematicalSeries[float64](i), +func NewThroughputStabilizer( + i uint64, + k uint64, + s float64, + debugLevel debug.DebugLevel, + debug *debug.DebugWithPrefix, +) ThroughputStabilizer { + return ThroughputStabilizer{ + instantaneousMeasurements: ms.NewCappedMathematicalSeries[float64](i), movingAverages: ms.NewCappedMathematicalSeries[float64](k), stabilityStandardDeviation: s, dbgConfig: debug, - dbgLevel: debugLevel} + dbgLevel: debugLevel, + } } func (r3 *ThroughputStabilizer) AddMeasurement(measurement rpm.ThroughputDataPoint) { |
