diff options
| author | Will Hawkins <[email protected]> | 2023-07-14 11:25:20 -0400 |
|---|---|---|
| committer | Will Hawkins <[email protected]> | 2023-07-14 11:25:20 -0400 |
| commit | a422c6266cf9fbc8e8eef518ec769e86472eedb8 (patch) | |
| tree | d9ff67139bf7c9741941058981bde3c615737f4e | |
| parent | c59943a12da4845ccaf7b93ec4b293b19dedea76 (diff) | |
Add license information to files where its missing
Some new(ish) files were missing license text.
Signed-off-by: Will Hawkins <[email protected]>
| -rw-r--r-- | qualityattenuation/qualityattenuation.go | 38 | ||||
| -rw-r--r-- | qualityattenuation/qualityattenuation_test.go | 22 | ||||
| -rw-r--r-- | series/message.go | 14 | ||||
| -rw-r--r-- | series/statistics.go | 14 |
4 files changed, 77 insertions, 11 deletions
diff --git a/qualityattenuation/qualityattenuation.go b/qualityattenuation/qualityattenuation.go index c6a2f85..bb2b77c 100644 --- a/qualityattenuation/qualityattenuation.go +++ b/qualityattenuation/qualityattenuation.go @@ -1,3 +1,17 @@ +/* + * This file is part of Go Responsiveness. + * + * Go Responsiveness is free software: you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software Foundation, + * either version 2 of the License, or (at your option) any later version. + * Go Responsiveness is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with Go Responsiveness. If not, see <https://www.gnu.org/licenses/>. + */ + // Implements a data structure for quality attenuation. package qualityattenuation @@ -213,19 +227,23 @@ func (qa *SimpleQualityAttenuation) EmpiricalDistributionHistogram() []float64 { // 4 bins from 1400 to 3000 ms, each 400 ms wide hist := make([]float64, 256) for i := 0; i < 100; i++ { - hist[i] = float64(qa.numberOfSamples) * (qa.empiricalDistribution.CDF(float64(i+1)*0.0005) - qa.empiricalDistribution.CDF(float64(i)*0.0005)) + hist[i] = float64(qa.numberOfSamples) * (qa.empiricalDistribution.CDF(float64(i+1)*0.0005) - + qa.empiricalDistribution.CDF(float64(i)*0.0005)) } for i := 100; i < 200; i++ { - hist[i] = float64(qa.numberOfSamples) * (qa.empiricalDistribution.CDF(0.050+float64(i-99)*0.001) - qa.empiricalDistribution.CDF(0.050+float64(i-100)*0.001)) + hist[i] = float64(qa.numberOfSamples) * (qa.empiricalDistribution.CDF(0.050+float64(i-99)*0.001) - + qa.empiricalDistribution.CDF(0.050+float64(i-100)*0.001)) } for i := 200; i < 250; i++ { - hist[i] = float64(qa.numberOfSamples) * (qa.empiricalDistribution.CDF(0.150+float64(i-199)*0.020) - qa.empiricalDistribution.CDF(0.150+float64(i-200)*0.020)) + hist[i] = float64(qa.numberOfSamples) * (qa.empiricalDistribution.CDF(0.150+float64(i-199)*0.020) - + qa.empiricalDistribution.CDF(0.150+float64(i-200)*0.020)) } for i := 250; i < 251; i++ { hist[i] = float64(qa.numberOfSamples) * (qa.empiricalDistribution.CDF(1.150+0.250) - qa.empiricalDistribution.CDF(1.150)) } for i := 251; i < 255; i++ { - hist[i] = float64(qa.numberOfSamples) * (qa.empiricalDistribution.CDF(1.400+float64(i-250)*0.400) - qa.empiricalDistribution.CDF(1.400+float64(i-251)*0.400)) + hist[i] = float64(qa.numberOfSamples) * (qa.empiricalDistribution.CDF(1.400+float64(i-250)*0.400) - + qa.empiricalDistribution.CDF(1.400+float64(i-251)*0.400)) } hist[255] = float64(qa.numberOfSamples) * (1 - qa.empiricalDistribution.CDF(3.000)) return hist @@ -259,8 +277,14 @@ func (qa *SimpleQualityAttenuation) QoO(requirement qualityRequirement) float64 func (qa *SimpleQualityAttenuation) GetGamingQoO() float64 { qualReq := qualityRequirement{} qualReq.latencyRequirements = []percentileLatencyPair{} - qualReq.latencyRequirements = append(qualReq.latencyRequirements, percentileLatencyPair{percentile: 50.0, perfectLatency: 0.030, uselessLatency: 0.150}) - qualReq.latencyRequirements = append(qualReq.latencyRequirements, percentileLatencyPair{percentile: 95.0, perfectLatency: 0.065, uselessLatency: 0.200}) - qualReq.latencyRequirements = append(qualReq.latencyRequirements, percentileLatencyPair{percentile: 99.0, perfectLatency: 0.100, uselessLatency: 0.250}) + qualReq.latencyRequirements = append(qualReq.latencyRequirements, percentileLatencyPair{ + percentile: 50.0, perfectLatency: 0.030, uselessLatency: 0.150, + }) + qualReq.latencyRequirements = append(qualReq.latencyRequirements, percentileLatencyPair{ + percentile: 95.0, perfectLatency: 0.065, uselessLatency: 0.200, + }) + qualReq.latencyRequirements = append(qualReq.latencyRequirements, percentileLatencyPair{ + percentile: 99.0, perfectLatency: 0.100, uselessLatency: 0.250, + }) return qa.QoO(qualReq) } diff --git a/qualityattenuation/qualityattenuation_test.go b/qualityattenuation/qualityattenuation_test.go index 4746364..724ac47 100644 --- a/qualityattenuation/qualityattenuation_test.go +++ b/qualityattenuation/qualityattenuation_test.go @@ -1,3 +1,17 @@ +/* + * This file is part of Go Responsiveness. + * + * Go Responsiveness is free software: you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software Foundation, + * either version 2 of the License, or (at your option) any later version. + * Go Responsiveness is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with Go Responsiveness. If not, see <https://www.gnu.org/licenses/>. + */ + package qualityattenuation import ( @@ -20,7 +34,7 @@ func TestBasicSimpleQualityAttenuation(t *testing.T) { assert.InEpsilon(t, 1.0, qa.empiricalDistribution.Quantile(0.1), 0.000001) assert.InEpsilon(t, 2.0, qa.empiricalDistribution.Quantile(0.5), 0.000001) assert.InEpsilon(t, 3.0, qa.empiricalDistribution.Quantile(0.9), 0.000001) - //Test the get functions + // Test the get functions assert.Equal(t, qa.GetNumberOfSamples(), int64(3)) assert.Equal(t, qa.GetNumberOfLosses(), int64(0)) assert.InEpsilon(t, 1.0, qa.GetMinimum(), 0.000001) @@ -40,10 +54,10 @@ func TestBasicSimpleQualityAttenuation(t *testing.T) { func TestManySamples(t *testing.T) { qa := NewSimpleQualityAttenuation() for i := 1; i < 160000; i++ { - qa.AddSample(float64(i) / 10000.0) //Linear ramp from 0.0001 to 16.0 + qa.AddSample(float64(i) / 10000.0) // Linear ramp from 0.0001 to 16.0 } assert.Equal(t, qa.numberOfSamples, int64(160000-1)) - assert.Equal(t, qa.numberOfLosses, int64(10000-1)) //Samples from 15.0001 to 16.0 are lost + assert.Equal(t, qa.numberOfLosses, int64(10000-1)) // Samples from 15.0001 to 16.0 are lost assert.InEpsilon(t, 0.0001, qa.minimumLatency, 0.000001) assert.InEpsilon(t, 15.0000, qa.maximumLatency, 0.000001) assert.InEpsilon(t, 1110007.5, qa.offsetSum, 0.000001) @@ -51,7 +65,7 @@ func TestManySamples(t *testing.T) { assert.InEpsilon(t, 1.50005, qa.empiricalDistribution.Quantile(0.1), 0.000001) assert.InEpsilon(t, 7.500049, qa.empiricalDistribution.Quantile(0.5), 0.000001) assert.InEpsilon(t, 13.50005, qa.empiricalDistribution.Quantile(0.9), 0.000001) - //Test the get functions + // Test the get functions assert.Equal(t, qa.GetNumberOfSamples(), int64(160000-1)) assert.Equal(t, qa.GetNumberOfLosses(), int64(10000-1)) assert.InEpsilon(t, 0.0001, qa.GetMinimum(), 0.000001) diff --git a/series/message.go b/series/message.go index fa0b096..fac643b 100644 --- a/series/message.go +++ b/series/message.go @@ -1,3 +1,17 @@ +/* + * This file is part of Go Responsiveness. + * + * Go Responsiveness is free software: you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software Foundation, + * either version 2 of the License, or (at your option) any later version. + * Go Responsiveness is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with Go Responsiveness. If not, see <https://www.gnu.org/licenses/>. + */ + package series import ( diff --git a/series/statistics.go b/series/statistics.go index 96ec93b..5d11164 100644 --- a/series/statistics.go +++ b/series/statistics.go @@ -1,3 +1,17 @@ +/* + * This file is part of Go Responsiveness. + * + * Go Responsiveness is free software: you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software Foundation, + * either version 2 of the License, or (at your option) any later version. + * Go Responsiveness is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with Go Responsiveness. If not, see <https://www.gnu.org/licenses/>. + */ + package series import ( |
