aboutsummaryrefslogtreecommitdiff
path: root/src/internal/testmath/bench.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/internal/testmath/bench.go')
-rw-r--r--src/internal/testmath/bench.go38
1 files changed, 0 insertions, 38 deletions
diff --git a/src/internal/testmath/bench.go b/src/internal/testmath/bench.go
deleted file mode 100644
index 6f034b4685..0000000000
--- a/src/internal/testmath/bench.go
+++ /dev/null
@@ -1,38 +0,0 @@
-// Copyright 2022 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package testmath
-
-import (
- "math"
- "testing"
- "time"
-)
-
-type BenchmarkResults []testing.BenchmarkResult
-
-func (b BenchmarkResults) Weight() float64 {
- var weight int
- for _, r := range b {
- weight += r.N
- }
- return float64(weight)
-}
-
-func (b BenchmarkResults) Mean() float64 {
- var dur time.Duration
- for _, r := range b {
- dur += r.T * time.Duration(r.N)
- }
- return float64(dur) / b.Weight()
-}
-
-func (b BenchmarkResults) Variance() float64 {
- var num float64
- mean := b.Mean()
- for _, r := range b {
- num += math.Pow(float64(r.T)-mean, 2) * float64(r.N)
- }
- return float64(num) / b.Weight()
-}