Compare commits

..

1 Commits

Author SHA1 Message Date
Mayuresh Chaubal 80c37f52a8
Merge 902adf1599 into b8631cf531 2025-10-01 11:07:19 +08:00
1 changed files with 8 additions and 6 deletions

View File

@ -106,14 +106,16 @@ func (p *scannerMetrics) log(s scannerMetric, paths ...string) func(custom map[s
// time n scanner actions.
// Use for s < scannerMetricLastRealtime
func (p *scannerMetrics) timeN(s scannerMetric) func(n int) {
func (p *scannerMetrics) timeN(s scannerMetric) func(n int) func() {
startTime := time.Now()
return func(n int) {
duration := time.Since(startTime)
return func(n int) func() {
return func() {
duration := time.Since(startTime)
atomic.AddUint64(&p.operations[s], uint64(n))
if s < scannerMetricLastRealtime {
p.latency[s].add(duration)
atomic.AddUint64(&p.operations[s], uint64(n))
if s < scannerMetricLastRealtime {
p.latency[s].add(duration)
}
}
}
}