aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTaras Madan <tarasmadan@google.com>2024-06-14 13:41:57 +0200
committerTaras Madan <tarasmadan@google.com>2024-06-17 07:41:38 +0000
commit88722c0f8d981b97d57db71d7bafa3a2db6f2197 (patch)
treeb8f2889ca8a4dc279f97c2569769877a567eeb86
parenta74087a0e7632520b70b06765aa0452f854b2563 (diff)
all: use VividCortex/gohistogram
-rw-r--r--pkg/stats/set.go10
-rw-r--r--pkg/stats/set_test.go2
-rw-r--r--prog/encodingexec_test.go6
3 files changed, 9 insertions, 9 deletions
diff --git a/pkg/stats/set.go b/pkg/stats/set.go
index f5671148d..143fb6fff 100644
--- a/pkg/stats/set.go
+++ b/pkg/stats/set.go
@@ -13,7 +13,7 @@ import (
"sync/atomic"
"time"
- "github.com/bsm/histogram/v3"
+ "github.com/VividCortex/gohistogram"
"github.com/google/syzkaller/pkg/html/pages"
"github.com/prometheus/client_golang/prometheus"
)
@@ -78,7 +78,7 @@ type line struct {
desc string
rate bool
data []float64
- hist []*histogram.Histogram
+ hist []*gohistogram.NumericHistogram
}
const (
@@ -268,7 +268,7 @@ type Val struct {
hist bool
prev int
histMu sync.Mutex
- histVal *histogram.Histogram
+ histVal *gohistogram.NumericHistogram
}
func (v *Val) Add(val int) {
@@ -278,7 +278,7 @@ func (v *Val) Add(val int) {
if v.hist {
v.histMu.Lock()
if v.histVal == nil {
- v.histVal = histogram.New(histogramBuckets)
+ v.histVal = gohistogram.NewHistogram(histogramBuckets)
}
v.histVal.Add(float64(val))
v.histMu.Unlock()
@@ -336,7 +336,7 @@ func (s *set) tick() {
rate: v.rate,
}
if v.hist {
- ln.hist = make([]*histogram.Histogram, s.historySize)
+ ln.hist = make([]*gohistogram.NumericHistogram, s.historySize)
} else {
ln.data = make([]float64, s.historySize)
}
diff --git a/pkg/stats/set_test.go b/pkg/stats/set_test.go
index 9a19011bb..56bac54dd 100644
--- a/pkg/stats/set_test.go
+++ b/pkg/stats/set_test.go
@@ -176,7 +176,7 @@ func TestSetHistoryDistribution(t *testing.T) {
a.Equal(step(1), [3][]float64{{3, 6, 1}, {3, 6, 1}, {3, 6, 1}})
a.Equal(step(2), [3][]float64{{3, 6, 1, 2}, {3, 6, 1, 2}, {3, 6, 1, 2}})
a.Equal(step(1), [3][]float64{{3, 1}, {3, 1}, {3, 1}})
- a.Equal(step(10), [3][]float64{{3, 1, 1}, {3, 1, 10}, {3, 1, 10}})
+ a.Equal(step(10), [3][]float64{{3, 1, 1}, {3, 1, 1}, {3, 1, 10}})
}
func TestSetStress(t *testing.T) {
diff --git a/prog/encodingexec_test.go b/prog/encodingexec_test.go
index 5dfcbd0e3..f968b6cf2 100644
--- a/prog/encodingexec_test.go
+++ b/prog/encodingexec_test.go
@@ -10,14 +10,14 @@ import (
"reflect"
"testing"
- "github.com/bsm/histogram/v3"
+ "github.com/VividCortex/gohistogram"
)
func TestSerializeForExecRandom(t *testing.T) {
target, rs, iters := initTest(t)
ct := target.DefaultChoiceTable()
- execSizes := histogram.New(1000)
- textSizes := histogram.New(1000)
+ execSizes := gohistogram.NewHistogram(1000)
+ textSizes := gohistogram.NewHistogram(1000)
totalSize := 0
sizes := make(map[string]int)
for i := 0; i < iters; i++ {