Skip to content

armgit / hey

Public Imported from GitHub
0

HTTP load generator, ApacheBench (ab) replacement

Go

Add a report constructor.

Burcu Dogan4ca32972f34b
diff --git a/boomer/boomer.go b/boomer/boomer.go
index 7e4e3c7..a0f0602 100644
--- a/boomer/boomer.go
+++ b/boomer/boomer.go
@@ -118,7 +118,7 @@ func (b *Boomer) Run() {
b.bar.Finish()
}
- printReport(b.N, b.results, b.Output, time.Now().Sub(start))
+ newReport(b.N, b.results, b.Output, time.Now().Sub(start)).finalize()
close(b.results)
}
diff --git a/boomer/print.go b/boomer/print.go
index 0610842..64b117e 100644
--- a/boomer/print.go
+++ b/boomer/print.go
@@ -43,15 +43,14 @@ type report struct {
output string
}
-func printReport(size int, results chan *result, output string, total time.Duration) {
- r := &report{
+func newReport(size int, results chan *result, output string, total time.Duration) *report {
+ return &report{
output: output,
results: results,
total: total,
statusCodeDist: make(map[int]int),
errorDist: make(map[string]int),
}
- r.finalize()
}
func (r *report) finalize() {