From 63b1d8029c2044616b3aa1dfe912640072fe1cc7 Mon Sep 17 00:00:00 2001 From: aminst Date: Mon, 26 Feb 2024 22:23:17 -0500 Subject: [PATCH] Write average throughput to output file --- pkg/client/output.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkg/client/output.go b/pkg/client/output.go index 6d88c0f..a480502 100644 --- a/pkg/client/output.go +++ b/pkg/client/output.go @@ -11,9 +11,12 @@ func WriteOutputToFile(outputFilePath string, responseCount []ResponseCount) err return err } defer file.Close() + sum := 0.0 for _, count := range responseCount { throughput := float64(count.readOperations + count.writeOperations) + sum += throughput file.WriteString(fmt.Sprintf("Throughput: %f\n", throughput)) } + file.WriteString(fmt.Sprintf("Average Throughput: %f\n", sum/float64(len(responseCount)))) return nil }