diff options
author | Luke Shumaker <lukeshu@beefcake.parabola.nu> | 2018-05-19 11:06:57 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@beefcake.parabola.nu> | 2018-05-19 11:06:57 -0400 |
commit | 19eeecd2821a36fe647584026379645a8764735b (patch) | |
tree | 87a824468cbb6baea52a8fa56e807f308ad0c7c0 /go | |
parent | 9899b4cad260e5574b1df611777dbf11aa26d902 (diff) |
cow-dedupe: more status lines
Diffstat (limited to 'go')
-rw-r--r-- | go/src/cow-dedupe/dedupe.go | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/go/src/cow-dedupe/dedupe.go b/go/src/cow-dedupe/dedupe.go index b67d677..ea60604 100644 --- a/go/src/cow-dedupe/dedupe.go +++ b/go/src/cow-dedupe/dedupe.go @@ -133,7 +133,8 @@ func main() { fiemap2filenames := getFiemaps(os.Args[1:]) - fmt.Fprintf(os.Stderr, "building list of spanning files...") + fmt.Fprintf(os.Stderr, "Building list of spanning files...") + filename2fiemap := map[string]string{} for fiemap, filenames := range fiemap2filenames { for _, filename := range filenames { @@ -151,7 +152,8 @@ func main() { i++ } - fmt.Fprintf(os.Stderr, " done\n") + fmt.Fprintf(os.Stderr, " done (%d files)\n", len(spanningFiles)) + checksum2filenames := getChecksums(spanningFiles) checksum2fiemaps := map[string][]string{} @@ -166,7 +168,9 @@ func main() { } } - fmt.Fprintf(os.Stderr, "Deduplicating %d sets of files...\n", len(checksum2fiemaps)) + sl := statusline.NewAsyncStatusLine(os.Stderr, time.Second/2) + cnt := 0 + sl.Put(fmt.Sprintf("Deduplicating sets of files... %d/%d", cnt, len(checksum2fiemaps))) for checksum, fiemaps := range checksum2fiemaps { // choose the fiemap with the fewest extents minFiemap := fiemaps[0] @@ -203,5 +207,10 @@ func main() { fmt.Println("#", checksum) fmt.Println(cmd.Args) errhandle(cmd.Run()) + + cnt++ + sl.Put(fmt.Sprintf("Deduplicating sets of files... %d/%d", cnt, len(checksum2fiemaps))) } + sl.End() + fmt.Fprintf(os.Stderr, "Deduplicating sets of files... done; deduplicated %d sets", cnt) } |