(ctx context.Context)
| 34 | } |
| 35 | |
| 36 | func (c *commandBenchmarkEcc) run(ctx context.Context) error { |
| 37 | results := c.runBenchmark(ctx) |
| 38 | |
| 39 | sort.Slice(results, func(i, j int) bool { |
| 40 | return min(results[i].throughputEncoding, results[i].throughputDecoding) > |
| 41 | min(results[j].throughputEncoding, results[j].throughputDecoding) |
| 42 | }) |
| 43 | |
| 44 | c.out.printStdout(" %-30v %14v %14v %10v\n", "ECC", "Throughput", "Throughput", "Growth") |
| 45 | c.out.printStdout(" %-30v %14v %14v %6v\n", "", "Encoding", "Decoding", "") |
| 46 | c.out.printStdout("---------------------------------------------------------------------------------------\n") |
| 47 | |
| 48 | for ndx, r := range results { |
| 49 | c.out.printStdout("%3d. %-30v %12v/s %12v/s %6v%% [%v]", ndx, r.ecc, |
| 50 | units.BytesString(r.throughputEncoding), |
| 51 | units.BytesString(r.throughputDecoding), |
| 52 | int(math.Round(r.growth*100)), //nolint:mnd |
| 53 | units.BytesString(r.size), |
| 54 | ) |
| 55 | |
| 56 | if c.optionPrint { |
| 57 | c.out.printStdout(", --ecc=%s", r.ecc) |
| 58 | } |
| 59 | |
| 60 | c.out.printStdout("\n") |
| 61 | } |
| 62 | |
| 63 | c.out.printStdout("---------------------------------------------------------------------------------------\n") |
| 64 | c.out.printStdout("Fastest option for this machine is: --ecc=%s\n", results[0].ecc) |
| 65 | |
| 66 | return nil |
| 67 | } |
| 68 | |
| 69 | func (c *commandBenchmarkEcc) runBenchmark(ctx context.Context) []eccBenchResult { |
| 70 | var results []eccBenchResult |
nothing calls this directly
no test coverage detected