internal/global/benchmark_test.go
raw| 1 | // Copyright The OpenTelemetry Authors |
| 2 | // SPDX-License-Identifier: Apache-2.0 |
| 3 | |
| 4 | package global |
| 5 | |
| 6 | import ( |
| 7 | "testing" |
| 8 | ) |
| 9 | |
| 10 | func BenchmarkStartEndSpanNoSDK(b *testing.B) { |
| 11 | // Compare with BenchmarkStartEndSpan() in |
| 12 | // ../../sdk/trace/benchmark_test.go. |
| 13 | ResetForTest(b) |
| 14 | t := TracerProvider().Tracer("Benchmark StartEndSpan") |
| 15 | ctx := b.Context() |
| 16 | |
| 17 | for b.Loop() { |
| 18 | _, span := t.Start(ctx, "/foo") |
| 19 | span.End() |
| 20 | } |
| 21 | } |