ReportJSON

This commit is contained in:
Tomás Senart
2013-09-10 13:45:01 +01:00
parent 6e9f34846b
commit ee9a1a0954
4 changed files with 42 additions and 15 deletions

View File

@@ -6,6 +6,7 @@ import (
"code.google.com/p/plotinum/plotutil"
"code.google.com/p/plotinum/vg"
"code.google.com/p/plotinum/vg/vgsvg"
"encoding/json"
"fmt"
"io"
"text/tabwriter"
@@ -41,6 +42,11 @@ func ReportText(results []Result, out io.Writer) error {
return w.Flush()
}
// ReportJSON writes a computed Metrics struct to out as JSON
func ReportJSON(results []Result, out io.Writer) error {
return json.NewEncoder(out).Encode(NewMetrics(results))
}
// ReportTimingsPlot builds up a plot of the response times of the requests
// in SVG format and writes it to out
func ReportTimingsPlot(results []Result, out io.Writer) error {