From 90324bcfc4fa22238ef1e5dbf5b6b7df2b9f8e3c Mon Sep 17 00:00:00 2001 From: Javier Palomo Date: Tue, 28 Jul 2020 14:19:37 +0200 Subject: [PATCH] tsdb: Replace usage of sync/atomic with uber-go/atomic Signed-off-by: Javier Palomo --- tsdb/head_bench_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tsdb/head_bench_test.go b/tsdb/head_bench_test.go index 0dd30b55d6..a8595ed8cb 100644 --- a/tsdb/head_bench_test.go +++ b/tsdb/head_bench_test.go @@ -17,11 +17,11 @@ import ( "io/ioutil" "os" "strconv" - "sync/atomic" "testing" "github.com/prometheus/prometheus/pkg/labels" "github.com/prometheus/prometheus/util/testutil" + "go.uber.org/atomic" ) func BenchmarkHeadStripeSeriesCreate(b *testing.B) { @@ -51,11 +51,11 @@ func BenchmarkHeadStripeSeriesCreateParallel(b *testing.B) { testutil.Ok(b, err) defer h.Close() - var count int64 + var count atomic.Int64 b.RunParallel(func(pb *testing.PB) { for pb.Next() { - i := atomic.AddInt64(&count, 1) + i := count.Inc() h.getOrCreate(uint64(i), labels.FromStrings("a", strconv.Itoa(int(i)))) } })