MCPcopy
hub / github.com/bnb-chain/bsc / BenchmarkGaugeFloat64Parallel

Function BenchmarkGaugeFloat64Parallel

metrics/gauge_float64_test.go:16–32  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

14}
15
16func BenchmarkGaugeFloat64Parallel(b *testing.B) {
17 c := NewGaugeFloat64()
18 var wg sync.WaitGroup
19 for i := 0; i < 10; i++ {
20 wg.Add(1)
21 go func() {
22 for i := 0; i < b.N; i++ {
23 c.Update(float64(i))
24 }
25 wg.Done()
26 }()
27 }
28 wg.Wait()
29 if have, want := c.Value(), float64(b.N-1); have != want {
30 b.Fatalf("have %f want %f", have, want)
31 }
32}
33
34func TestGaugeFloat64(t *testing.T) {
35 g := NewGaugeFloat64()

Callers

nothing calls this directly

Calls 7

UpdateMethod · 0.95
ValueMethod · 0.95
NewGaugeFloat64Function · 0.85
DoneMethod · 0.80
AddMethod · 0.65
WaitMethod · 0.45
FatalfMethod · 0.45

Tested by

no test coverage detected