(fileName string)
| 114 | } |
| 115 | |
| 116 | func formatBenchmark(fileName string) { |
| 117 | f, err := os.Open(fileName) |
| 118 | if err != nil { |
| 119 | log.Fatalf("Read file %s error: %s\n", fileName, err) |
| 120 | } |
| 121 | defer f.Close() |
| 122 | var results []stats.BenchResults |
| 123 | decoder := gob.NewDecoder(f) |
| 124 | if err = decoder.Decode(&results); err != nil { |
| 125 | log.Fatalf("Decode file %s error: %s\n", fileName, err) |
| 126 | } |
| 127 | if len(results) == 0 { |
| 128 | log.Fatalf("No benchmark results in file %s\n", fileName) |
| 129 | } |
| 130 | |
| 131 | fmt.Println("\nShared features:\n" + strings.Repeat("-", 20)) |
| 132 | fmt.Print(results[0].Features.SharedFeatures(results[0].SharedFeatures)) |
| 133 | fmt.Println(strings.Repeat("-", 35)) |
| 134 | |
| 135 | wantFeatures := results[0].SharedFeatures |
| 136 | for i := 0; i < len(results[0].SharedFeatures); i++ { |
| 137 | wantFeatures[i] = !wantFeatures[i] |
| 138 | } |
| 139 | |
| 140 | printHeader() |
| 141 | for _, r := range results { |
| 142 | printline(r.RunMode+r.Features.PrintableName(wantFeatures), r.Data) |
| 143 | } |
| 144 | } |
| 145 | |
| 146 | func main() { |
| 147 | if len(os.Args) == 2 { |
no test coverage detected