Skip to content
Myr

Print ingestion time in --bench output

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Junegunn Choi · committed by Junegunn Choi · parent 12a280b · Browse files · 1 file+6 added−2 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+6 added−2 removed

  • other:+6 added−2 removed

1 file+6 added−2 removed

modified:src/core.go+6 added-2 removed
193 unmodified lines
194195 // Reader196 streamingFilter := opts.Filter != nil && !sort && !opts.Tac && !opts.Sync && opts.Bench == 0197 var reader *Reader198 var ingestionStart time.Time199 if !streamingFilter {200 reader = NewReader(func(data []byte) bool {201 return chunkList.Push(data)202 }, eventBox, executor, opts.ReadZero, opts.Filter == nil)203204 ingestionStart = time.Now()205 readyChan := make(chan bool)206 go reader.ReadSource(opts.Input, opts.WalkerRoot, opts.WalkerOpts, opts.WalkerSkip, initialReload, initialEnv, readyChan)207 <-readyChan208 }
75 unmodified lines
284 reader.ReadSource(opts.Input, opts.WalkerRoot, opts.WalkerOpts, opts.WalkerSkip, initialReload, initialEnv, nil)285 } else {286 eventBox.Unwatch(EvtReadNew)287 eventBox.WaitFor(EvtReadFin)288 ingestionTime := time.Since(ingestionStart)289290 // NOTE: Streaming filter is inherently not compatible with --tail291 snapshot, _, _ := chunkList.Snapshot(opts.Tail)292
25 unmodified lines
318 }319 }320 avg := total / time.Duration(len(times))321 selectivity := float64(matchCount) / float64(totalItems) * 100319 fmt.Printf(" %d iterations avg: %.2fms min: %.2fms max: %.2fms total: %.2fs items: %d matches: %d (%.2f%%)\n",322 fmt.Printf(" %d iterations avg: %.2fms min: %.2fms max: %.2fms total: %.2fs items: %d matches: %d (%.2f%%) ingestion: %.2fms\n",323 len(times),324 float64(avg.Microseconds())/1000,325 float64(minD.Microseconds())/1000,326 float64(maxD.Microseconds())/1000,327 total.Seconds(),325 totalItems, matchCount, selectivity)328 totalItems, matchCount, selectivity,329 float64(ingestionTime.Microseconds())/1000)330 return ExitOk, nil331 }332333 result := matcher.scan(MatchRequest{
302 unmodified lines