• Russ Cox's avatar
    cmd/test2json: emit Benchmark name output early · 9044f018
    Russ Cox authored
    When benchmarks run, they print lines like:
    
      BenchmarkGenericNoMatch-8   3000000 385 ns/op
    
    The first field, padded by spaces and followed by a tab,
    is printed when the benchmark begins running.
    The rest of the line is printed when the benchmark ends.
    Tools and people can watch the timing of these prints
    to see which benchmark is running.
    
    To allow tools consuming json output to continue to be
    able to see which benchmark is running, this CL adds a
    special case to the usual "line at a time" behavior to flush
    the benchmark name if it is observed separately from the
    rest of the line.
    
    Fixes #23352.
    
    Change-Id: I7b6410698d78034eec18745d7f57b7d8e9575dbb
    Reviewed-on: https://go-review.googlesource.com/86695
    Run-TryBot: Russ Cox <rsc@golang.org>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
    9044f018
test2json.go 11.7 KB