diff --git a/benchmarks/cmd/db.go b/benchmarks/cmd/db.go index b958b0826a..17adddbaa0 100644 --- a/benchmarks/cmd/db.go +++ b/benchmarks/cmd/db.go @@ -60,7 +60,7 @@ func loadSampleFile(file string) (*parser.Sample, error) { reports := []types.Report{} err = json.Unmarshal(data, &reports) if err != nil { - fmt.Printf("error: %s\n", data) + fmt.Printf("failed to unmarshal report: %q\n", data) return nil, err } if len(reports) < 1 { diff --git a/benchmarks/cmd/parser/parser.go b/benchmarks/cmd/parser/parser.go index d9e7cf4808..ba07cce8da 100644 --- a/benchmarks/cmd/parser/parser.go +++ b/benchmarks/cmd/parser/parser.go @@ -59,7 +59,7 @@ func NewSetup(specReports types.SpecReports, result map[string]Measurement) (str data := entry.Value.AsJSON err := json.Unmarshal([]byte(data), &xp) if err != nil { - fmt.Printf("error: %s\n", data) + fmt.Printf("failed to unmarshal setup: %s\n", data) return "", err } // in report: @@ -130,7 +130,7 @@ func NewExperiments(specReports types.SpecReports, result map[string]Experiment) data := entry.Value.AsJSON err := json.Unmarshal([]byte(data), &xp) if err != nil { - fmt.Printf("error: %s\n", data) + fmt.Printf("failed to unmarshal experiment: %s\n", data) return total, err } // raw := entry.GetRawValue() diff --git a/benchmarks/cmd/root.go b/benchmarks/cmd/root.go index 8d985b66c4..7d246b3b87 100644 --- a/benchmarks/cmd/root.go +++ b/benchmarks/cmd/root.go @@ -24,6 +24,7 @@ var ( input string db string verbose bool + debug bool ) func main() { @@ -42,6 +43,7 @@ func init() { rootCmd.AddCommand(reportCmd) rootCmd.AddCommand(csvCmd) rootCmd.PersistentFlags().StringVarP(&input, "input", "i", "report.json", "input file") + rootCmd.PersistentFlags().BoolVarP(&debug, "debug", "", false, "debug output") rootCmd.PersistentFlags().BoolVarP(&verbose, "verbose", "v", false, "verbose output") reportCmd.PersistentFlags().StringVarP(&db, "db", "d", "db/", "path to json file database dir") @@ -180,7 +182,7 @@ var reportCmd = &cobra.Command{ calculate(sample, dsPop, scores) - if verbose { + if debug { fmt.Println("# Population from DB") fmt.Println("```") fmt.Println(prettyPrint(dsPop)) @@ -196,40 +198,54 @@ var reportCmd = &cobra.Command{ if sample.Description != "" { fmt.Println("# Description of Setup") fmt.Println() + fmt.Println("> This section contains information about the setup used for the current sample. Like the k8s version, the node resources and the images available to the node.") fmt.Println(sample.Description) - fmt.Println() - fmt.Printf("Population size: %d\n", len(population.Samples)) + + fmt.Println("Population Size") + fmt.Println("===============") + fmt.Printf("Reports in %q: %d\n", db, len(population.Samples)) fmt.Println() } - t1 := report.NewTable(sample.Setup) - t1.TableStyle.EnableTextStyling = false - fmt.Println(t1.Render()) - - fmt.Println("# Individual Measurements") + fmt.Println("# Results for Current Sample") + fmt.Println() + fmt.Println("> These measurements were taken before and after the experiments.") fmt.Println() - mRows := map[string]map[string]MeasurementRow{} - for experiment, xp := range sample.Experiments { - mRows[experiment] = map[string]MeasurementRow{} - for measurement, m := range xp.Measurements { - row := MeasurementRow{ - Experiment: experiment, - Measurement: measurement, - Value: m.String(), - Mean: dsPop[experiment][measurement].Mean, - StdDev: dsPop[experiment][measurement].StdDev, - ZScore: dsPop[experiment][measurement].ZScore, + t := report.NewTable(sample.Setup) + t.TableStyle.EnableTextStyling = false + fmt.Println(t.Render()) + + if verbose { + fmt.Println("# Compare Individual Measurements to Population") + fmt.Println() + fmt.Println("> For each experiment, the measurements for the current sample are compared to the population's data.") + fmt.Println() + + rows := map[string]map[string]MeasurementRow{} + for experiment, xp := range sample.Experiments { + rows[experiment] = map[string]MeasurementRow{} + for measurement, m := range xp.Measurements { + row := MeasurementRow{ + Experiment: experiment, + Measurement: measurement, + Value: m.String(), + Mean: dsPop[experiment][measurement].Mean, + StdDev: dsPop[experiment][measurement].StdDev, + ZScore: dsPop[experiment][measurement].ZScore, + } + rows[experiment][measurement] = row } - mRows[experiment][measurement] = row } - } - mTable := newMeasurementTable(mRows) - fmt.Println(mTable.Render()) + t := newMeasurementTable(rows) + fmt.Println(t.Render()) + } // table for experiments - fmt.Println("# Experiment Summary") + fmt.Println("# Summary for each Experiment") + fmt.Println() + fmt.Println("> The duration of each experiment is compared to the population's data.") fmt.Println() rows := map[string]Row{} @@ -244,12 +260,12 @@ var reportCmd = &cobra.Command{ rows[experiment] = row } - xpTable := newTable(rows) - fmt.Println(xpTable.Render()) + t = newTable(rows) + fmt.Println(t.Render()) - // Final score - fmt.Println("# Total Score") - fmt.Printf("%s, %.02f\n", input, scores.AvgZScores()) + fmt.Println("# Final Score") + fmt.Println() + fmt.Printf("%s: %.02f\n", input, scores.AvgZScores()) return nil }, @@ -288,7 +304,6 @@ func newTable(rows map[string]Row) *table.Table { table.C("ZScore"), table.C(""), table.Divider("="), - //"{{bold}}", )) keys := slices.Sorted(maps.Keys(rows)) @@ -326,7 +341,6 @@ func newMeasurementTable(rows map[string]map[string]MeasurementRow) *table.Table table.C("Population StdDev"), table.C("ZScore"), table.Divider("="), - //"{{bold}}", )) keys := slices.Sorted(maps.Keys(rows)) diff --git a/benchmarks/record/record.go b/benchmarks/record/record.go index f3b0662213..ef01584432 100644 --- a/benchmarks/record/record.go +++ b/benchmarks/record/record.go @@ -197,7 +197,7 @@ func Nodes(ctx context.Context, experiment *gm.Experiment) { } func Header(s string) string { - h := fmt.Sprintf("{{bold}}%s{{/}}\n", s) + h := fmt.Sprintf("%s\n", s) h += strings.Repeat("=", len(s)) + "\n" return h }