event: move all the benchmarks to live with their adapter

Change-Id: I79b092244bda9dfb05c714a439a99c4f304c0eda
Reviewed-on: https://go-review.googlesource.com/c/exp/+/325577
Trust: Ian Cottrell <iancottrell@google.com>
Run-TryBot: Ian Cottrell <iancottrell@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
diff --git a/event/bench/logrus_test.go b/event/adapter/logrus/bench_test.go
similarity index 98%
rename from event/bench/logrus_test.go
rename to event/adapter/logrus/bench_test.go
index 127554e..cc2f81a 100644
--- a/event/bench/logrus_test.go
+++ b/event/adapter/logrus/bench_test.go
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-package bench_test
+package logrus_test
 
 import (
 	"context"
diff --git a/event/bench/zap_test.go b/event/adapter/zap/bench_test.go
similarity index 98%
rename from event/bench/zap_test.go
rename to event/adapter/zap/bench_test.go
index 6ee3609..55cf653 100644
--- a/event/bench/zap_test.go
+++ b/event/adapter/zap/bench_test.go
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-package bench_test
+package zap_test
 
 import (
 	"context"
diff --git a/event/bench/zerolog_test.go b/event/adapter/zerolog/bench_test.go
similarity index 98%
rename from event/bench/zerolog_test.go
rename to event/adapter/zerolog/bench_test.go
index 5a944cb..d60d95d 100644
--- a/event/bench/zerolog_test.go
+++ b/event/adapter/zerolog/bench_test.go
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-package bench_test
+package zerolog_test
 
 import (
 	"context"
diff --git a/event/alloc_test.go b/event/alloc_test.go
index 52c4500..64124f3 100644
--- a/event/alloc_test.go
+++ b/event/alloc_test.go
@@ -13,6 +13,7 @@
 
 	"golang.org/x/exp/event"
 	"golang.org/x/exp/event/adapter/logfmt"
+	"golang.org/x/exp/event/bench"
 )
 
 func TestAllocs(t *testing.T) {
@@ -28,3 +29,7 @@
 		t.Errorf("Got %d allocs, expect 0", allocs)
 	}
 }
+
+func TestBenchAllocs(t *testing.T) {
+	bench.TestAllocs(t, eventPrint, eventLog, 0)
+}
diff --git a/event/bench/alloc_test.go b/event/bench/alloc_test.go
deleted file mode 100644
index bcacac4..0000000
--- a/event/bench/alloc_test.go
+++ /dev/null
@@ -1,17 +0,0 @@
-// Copyright 2020 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.
-
-// +build !race
-
-package bench_test
-
-import (
-	"testing"
-
-	"golang.org/x/exp/event/bench"
-)
-
-func TestLogEventAllocs(t *testing.T) {
-	bench.TestAllocs(t, eventPrint, eventLog, 0)
-}
diff --git a/event/bench/event_enabled_test.go b/event/bench/event_enabled_test.go
deleted file mode 100644
index 0cd2af5..0000000
--- a/event/bench/event_enabled_test.go
+++ /dev/null
@@ -1,55 +0,0 @@
-// Copyright 2020 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.
-
-// +build !disable_events
-
-package bench_test
-
-import (
-	"testing"
-
-	"golang.org/x/exp/event/bench"
-)
-
-func TestLogEventf(t *testing.T) {
-	bench.TestBenchmark(t, eventPrint, eventLogf, `
-time=2020-03-05T14:27:48 msg="a where A=0"
-time=2020-03-05T14:27:49 msg="b where B=\"A value\""
-time=2020-03-05T14:27:50 msg="a where A=1"
-time=2020-03-05T14:27:51 msg="b where B=\"Some other value\""
-time=2020-03-05T14:27:52 msg="a where A=22"
-time=2020-03-05T14:27:53 msg="b where B=\"Some other value\""
-time=2020-03-05T14:27:54 msg="a where A=333"
-time=2020-03-05T14:27:55 msg="b where B=\"\""
-time=2020-03-05T14:27:56 msg="a where A=4444"
-time=2020-03-05T14:27:57 msg="b where B=\"prime count of values\""
-time=2020-03-05T14:27:58 msg="a where A=55555"
-time=2020-03-05T14:27:59 msg="b where B=\"V\""
-time=2020-03-05T14:28:00 msg="a where A=666666"
-time=2020-03-05T14:28:01 msg="b where B=\"A value\""
-time=2020-03-05T14:28:02 msg="a where A=7777777"
-time=2020-03-05T14:28:03 msg="b where B=\"A value\""
-`)
-}
-
-func TestLogEvent(t *testing.T) {
-	bench.TestBenchmark(t, eventPrint, eventLog, `
-time=2020-03-05T14:27:48 A=0 msg=a
-time=2020-03-05T14:27:49 B="A value" msg=b
-time=2020-03-05T14:27:50 A=1 msg=a
-time=2020-03-05T14:27:51 B="Some other value" msg=b
-time=2020-03-05T14:27:52 A=22 msg=a
-time=2020-03-05T14:27:53 B="Some other value" msg=b
-time=2020-03-05T14:27:54 A=333 msg=a
-time=2020-03-05T14:27:55 B="" msg=b
-time=2020-03-05T14:27:56 A=4444 msg=a
-time=2020-03-05T14:27:57 B="prime count of values" msg=b
-time=2020-03-05T14:27:58 A=55555 msg=a
-time=2020-03-05T14:27:59 B=V msg=b
-time=2020-03-05T14:28:00 A=666666 msg=a
-time=2020-03-05T14:28:01 B="A value" msg=b
-time=2020-03-05T14:28:02 A=7777777 msg=a
-time=2020-03-05T14:28:03 B="A value" msg=b
-`)
-}
diff --git a/event/bench/event_test.go b/event/bench_test.go
similarity index 97%
rename from event/bench/event_test.go
rename to event/bench_test.go
index 913545d..ac7f397 100644
--- a/event/bench/event_test.go
+++ b/event/bench_test.go
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-package bench_test
+package event_test
 
 import (
 	"context"
@@ -69,7 +69,6 @@
 		},
 	}
 
-	gauge       = event.NewFloatGauge("gauge", "a gauge")
 	eventMetric = bench.Hooks{
 		AStart: func(ctx context.Context, a int) context.Context {
 			event.To(ctx).With(aStat.Of(a)).Metric(gauge.Record(1))
diff --git a/event/event_test.go b/event/event_test.go
index d2321bb..ce4bff9 100644
--- a/event/event_test.go
+++ b/event/event_test.go
@@ -16,6 +16,7 @@
 	"golang.org/x/exp/event"
 	"golang.org/x/exp/event/adapter/eventtest"
 	"golang.org/x/exp/event/adapter/logfmt"
+	"golang.org/x/exp/event/bench"
 	"golang.org/x/exp/event/keys"
 )
 
@@ -126,3 +127,45 @@
 	// time=2020-03-05T14:27:48 myInt=6 msg="my event"
 	// time=2020-03-05T14:27:49 myString="some string value" msg="error event"
 }
+
+func TestLogEventf(t *testing.T) {
+	bench.TestBenchmark(t, eventPrint, eventLogf, `
+time=2020-03-05T14:27:48 msg="a where A=0"
+time=2020-03-05T14:27:49 msg="b where B=\"A value\""
+time=2020-03-05T14:27:50 msg="a where A=1"
+time=2020-03-05T14:27:51 msg="b where B=\"Some other value\""
+time=2020-03-05T14:27:52 msg="a where A=22"
+time=2020-03-05T14:27:53 msg="b where B=\"Some other value\""
+time=2020-03-05T14:27:54 msg="a where A=333"
+time=2020-03-05T14:27:55 msg="b where B=\"\""
+time=2020-03-05T14:27:56 msg="a where A=4444"
+time=2020-03-05T14:27:57 msg="b where B=\"prime count of values\""
+time=2020-03-05T14:27:58 msg="a where A=55555"
+time=2020-03-05T14:27:59 msg="b where B=\"V\""
+time=2020-03-05T14:28:00 msg="a where A=666666"
+time=2020-03-05T14:28:01 msg="b where B=\"A value\""
+time=2020-03-05T14:28:02 msg="a where A=7777777"
+time=2020-03-05T14:28:03 msg="b where B=\"A value\""
+`)
+}
+
+func TestLogEvent(t *testing.T) {
+	bench.TestBenchmark(t, eventPrint, eventLog, `
+time=2020-03-05T14:27:48 A=0 msg=a
+time=2020-03-05T14:27:49 B="A value" msg=b
+time=2020-03-05T14:27:50 A=1 msg=a
+time=2020-03-05T14:27:51 B="Some other value" msg=b
+time=2020-03-05T14:27:52 A=22 msg=a
+time=2020-03-05T14:27:53 B="Some other value" msg=b
+time=2020-03-05T14:27:54 A=333 msg=a
+time=2020-03-05T14:27:55 B="" msg=b
+time=2020-03-05T14:27:56 A=4444 msg=a
+time=2020-03-05T14:27:57 B="prime count of values" msg=b
+time=2020-03-05T14:27:58 A=55555 msg=a
+time=2020-03-05T14:27:59 B=V msg=b
+time=2020-03-05T14:28:00 A=666666 msg=a
+time=2020-03-05T14:28:01 B="A value" msg=b
+time=2020-03-05T14:28:02 A=7777777 msg=a
+time=2020-03-05T14:28:03 B="A value" msg=b
+`)
+}