mirror of
https://github.com/walles/moar.git
synced 2024-11-22 11:45:50 +03:00
Improve timing printouts with --debug
By reporting stream reading timings as first the reading time and then the highlighting time.
This commit is contained in:
parent
2692fd2a84
commit
4db604533d
12
m/reader.go
12
m/reader.go
@ -100,7 +100,7 @@ func (reader *Reader) preAllocLines(originalFileName string) {
|
||||
}
|
||||
}
|
||||
|
||||
// This function will be update the Reader struct in the background.
|
||||
// This function will update the Reader struct in the background.
|
||||
func (reader *Reader) readStream(stream io.Reader, originalFileName *string, onDone func()) {
|
||||
defer func() {
|
||||
reader.done.Store(true)
|
||||
@ -191,11 +191,13 @@ func (reader *Reader) readStream(stream io.Reader, originalFileName *string, onD
|
||||
default:
|
||||
}
|
||||
|
||||
if onDone != nil {
|
||||
onDone()
|
||||
}
|
||||
|
||||
log.Debug("Stream read in ", time.Since(t0))
|
||||
|
||||
if onDone != nil {
|
||||
t1 := time.Now()
|
||||
onDone()
|
||||
log.Debug("onDone() took ", time.Since(t1))
|
||||
}
|
||||
}
|
||||
|
||||
// Note that you must call reader.SetStyleForHighlighting() after this to get
|
||||
|
Loading…
Reference in New Issue
Block a user