1
1
mirror of https://github.com/walles/moar.git synced 2024-12-03 06:02:36 +03:00

Log input stream consumption time

At debug level.
This commit is contained in:
Johan Walles 2021-05-03 08:08:41 +02:00
parent 9af12f451c
commit f8e45f73e2

View File

@ -106,6 +106,7 @@ func readStream(stream io.Reader, reader *Reader, fromFilter *exec.Cmd) {
bufioReader := bufio.NewReader(stream)
completeLine := make([]byte, 0)
t0 := time.Now().UnixNano()
for {
keepReadingLine := true
eof := false
@ -161,6 +162,10 @@ func readStream(stream io.Reader, reader *Reader, fromFilter *exec.Cmd) {
// Default case required for the write to be non-blocking
}
}
t1 := time.Now().UnixNano()
dtNanos := t1 - t0
log.Debug("Stream read in ", dtNanos/1_000_000, "ms")
}
// NewReaderFromStream creates a new stream reader