From d09444e79d297f70b39f2cd15c2222668bb8c2f8 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 3 Jun 2018 14:14:36 -0400 Subject: cow-dedupe: Fix set statistics --- go/src/cow-dedupe/dedupe.go | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/go/src/cow-dedupe/dedupe.go b/go/src/cow-dedupe/dedupe.go index 3fc2254..84f03f8 100644 --- a/go/src/cow-dedupe/dedupe.go +++ b/go/src/cow-dedupe/dedupe.go @@ -130,12 +130,15 @@ func getChecksums(sl statusline.StatusLine, slfmt string, basecmd []string, path return ret } -func pruneSingles(key2vals map[string][]string) { +func pruneSingles(key2vals map[string][]string) int { + n := 0 for key, vals := range key2vals { if len(vals) < 2 { delete(key2vals, key) + n++ } } + return n } func dedupe(srcFile string, dupFiles []string) error { @@ -244,13 +247,9 @@ func main() { status.summed += len(filenames) status.verb = "pruneSingles" sl.Put(status.String()) - pruneSingles(checksum2filenames) + status.set.p += len(checksum2filenames) - 1 + status.set.m += pruneSingles(checksum2filenames) // And loop over the smaller, precise buckets - if len(checksum2filenames) == 0 { - status.set.m++ - } else { - status.set.p += len(checksum2filenames) - 1 - } for _, filenames := range checksum2filenames { status.set.size = len(filenames) status.verb = "prep" -- cgit v1.2.3-2-g168b