From 7544eeb242d0aba2da054a1663e043feaedb9618 Mon Sep 17 00:00:00 2001 From: Zach Koopmans Date: Fri, 19 Feb 2021 17:10:27 -0800 Subject: Correctly set and respect b.N in fio benchmark. fio should scale by written/read bytes and not iterate runs of the fio container. PiperOrigin-RevId: 358511771 --- test/benchmarks/tools/fio.go | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'test/benchmarks/tools/fio.go') diff --git a/test/benchmarks/tools/fio.go b/test/benchmarks/tools/fio.go index f6324c3ab..ea12436d2 100644 --- a/test/benchmarks/tools/fio.go +++ b/test/benchmarks/tools/fio.go @@ -62,18 +62,15 @@ func (f *Fio) Report(b *testing.B, output string) { // parseBandwidth reports the bandwidth in b/s. func (f *Fio) parseBandwidth(data string, isRead bool) (float64, error) { + op := "write" if isRead { - result, err := f.parseFioJSON(data, "read", "bw") - if err != nil { - return 0, err - } - return 1024 * result, nil + op = "read" } - result, err := f.parseFioJSON(data, "write", "bw") + result, err := f.parseFioJSON(data, op, "bw") if err != nil { return 0, err } - return 1024 * result, nil + return result * 1024, nil } // parseIOps reports the write IO per second metric. -- cgit v1.2.3