From 19eeecd2821a36fe647584026379645a8764735b Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sat, 19 May 2018 11:06:57 -0400 Subject: cow-dedupe: more status lines --- go/src/cow-dedupe/dedupe.go | 15 ++++++++++++--- 1 file 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) } -- cgit v1.2.3-2-g168b