MCPcopy
hub / github.com/kopia/kopia / run

Method run

cli/command_benchmark_encryption.go:38–61  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

36}
37
38func (c *commandBenchmarkEncryption) run(ctx context.Context) error {
39 results := c.runBenchmark(ctx)
40
41 sort.Slice(results, func(i, j int) bool {
42 return results[i].throughput > results[j].throughput
43 })
44 c.out.printStdout(" %-30v %v\n", "Encryption", "Throughput")
45 c.out.printStdout("-----------------------------------------------------------------\n")
46
47 for ndx, r := range results {
48 c.out.printStdout("%3d. %-30v %v / second", ndx, r.encryption, units.BytesString(r.throughput))
49
50 if c.optionPrint {
51 c.out.printStdout(", --encryption=%s", r.encryption)
52 }
53
54 c.out.printStdout("\n")
55 }
56
57 c.out.printStdout("-----------------------------------------------------------------\n")
58 c.out.printStdout("Fastest option for this machine is: --encryption=%s\n", results[0].encryption)
59
60 return nil
61}
62
63func (c *commandBenchmarkEncryption) runBenchmark(ctx context.Context) []cryptoBenchResult {
64 var results []cryptoBenchResult

Callers

nothing calls this directly

Calls 3

runBenchmarkMethod · 0.95
BytesStringFunction · 0.92
printStdoutMethod · 0.80

Tested by

no test coverage detected