2020-03-23 22:41:10 -07:00
|
|
|
// Copyright The OpenTelemetry Authors
|
2024-02-29 07:05:28 +01:00
|
|
|
// SPDX-License-Identifier: Apache-2.0
|
2020-03-23 22:41:10 -07:00
|
|
|
|
2022-04-14 17:22:03 +02:00
|
|
|
package global
|
2019-12-23 23:03:04 -08:00
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
2020-07-28 10:47:08 -07:00
|
|
|
func BenchmarkStartEndSpanNoSDK(b *testing.B) {
|
|
|
|
// Compare with BenchmarkStartEndSpan() in
|
2020-11-16 18:30:54 +01:00
|
|
|
// ../../sdk/trace/benchmark_test.go.
|
2022-04-14 17:22:03 +02:00
|
|
|
ResetForTest(b)
|
|
|
|
t := TracerProvider().Tracer("Benchmark StartEndSpan")
|
2019-12-23 23:03:04 -08:00
|
|
|
ctx := context.Background()
|
|
|
|
b.ResetTimer()
|
|
|
|
for i := 0; i < b.N; i++ {
|
2020-07-28 10:47:08 -07:00
|
|
|
_, span := t.Start(ctx, "/foo")
|
|
|
|
span.End()
|
2020-01-02 13:20:38 -08:00
|
|
|
}
|
|
|
|
}
|