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

Method run

cli/command_benchmark_hashing.go:35–58  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

33}
34
35func (c *commandBenchmarkHashing) run(ctx context.Context) error {
36 results := c.runBenchmark(ctx)
37
38 sort.Slice(results, func(i, j int) bool {
39 return results[i].throughput > results[j].throughput
40 })
41 c.out.printStdout(" %-20v %v\n", "Hash", "Throughput")
42 c.out.printStdout("-----------------------------------------------------------------\n")
43
44 for ndx, r := range results {
45 c.out.printStdout("%3d. %-20v %v / second", ndx, r.hash, units.BytesString(r.throughput))
46
47 if c.optionPrint {
48 c.out.printStdout(", --block-hash=%s", r.hash)
49 }
50
51 c.out.printStdout("\n")
52 }
53
54 c.out.printStdout("-----------------------------------------------------------------\n")
55 c.out.printStdout("Fastest option for this machine is: --block-hash=%s\n", results[0].hash)
56
57 return nil
58}
59
60func (c *commandBenchmarkHashing) runBenchmark(ctx context.Context) []cryptoBenchResult {
61 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