diff options
author | Luke Shumaker <lukeshu@beefcake.parabola.nu> | 2018-06-03 14:14:36 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@beefcake.parabola.nu> | 2018-06-03 14:14:36 -0400 |
commit | d09444e79d297f70b39f2cd15c2222668bb8c2f8 (patch) | |
tree | f4cb5d69807c8c61585630131345be395bfc359e /go/src | |
parent | 4af19e8a4c5c1363872ca4c37f181a19e67da4c0 (diff) |
cow-dedupe: Fix set statistics
Diffstat (limited to 'go/src')
-rw-r--r-- | go/src/cow-dedupe/dedupe.go | 13 |
1 files 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" |