()
| 234 | } |
| 235 | |
| 236 | func makeSamplerCountingHook() (func(_ Entry, dec SamplingDecision), *atomic.Int64, *atomic.Int64) { |
| 237 | droppedCount := new(atomic.Int64) |
| 238 | sampledCount := new(atomic.Int64) |
| 239 | h := func(_ Entry, dec SamplingDecision) { |
| 240 | if dec&LogDropped > 0 { |
| 241 | droppedCount.Add(1) |
| 242 | } else if dec&LogSampled > 0 { |
| 243 | sampledCount.Add(1) |
| 244 | } |
| 245 | } |
| 246 | return h, droppedCount, sampledCount |
| 247 | } |
| 248 | |
| 249 | func BenchmarkSampler_CheckWithHook(b *testing.B) { |
| 250 | hook, dropped, sampled := makeSamplerCountingHook() |
no test coverage detected