MCPcopy Create free account
hub / github.com/GoEdgeLab/EdgeNode / TestCounter_GC2

Function TestCounter_GC2

internal/utils/counters/counter_test.go:60–77  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

58}
59
60func TestCounter_GC2(t *testing.T) {
61 if !testutils.IsSingleTesting() {
62 return
63 }
64
65 var counter = counters.NewCounter[uint32]().WithGC()
66 for i := 0; i < 100_000; i++ {
67 counter.Increase(uint64(i), rands.Int(10, 300))
68 }
69
70 var ticker = time.NewTicker(1 * time.Second)
71 for range ticker.C {
72 t.Log(timeutil.Format("H:i:s"), counter.TotalItems())
73 if counter.TotalItems() == 0 {
74 break
75 }
76 }
77}
78
79func TestCounterMemory(t *testing.T) {
80 var stat = &runtime.MemStats{}

Callers

nothing calls this directly

Calls 6

IsSingleTestingFunction · 0.92
WithGCMethod · 0.80
LogMethod · 0.80
TotalItemsMethod · 0.80
FormatMethod · 0.65
IncreaseMethod · 0.45

Tested by

no test coverage detected