Report timing from restic restore --verify

This commit is contained in:
greatroar 2020-02-20 21:54:31 +01:00 committed by Michael Eischer
parent 973fa921cb
commit 92ae951ffa

View file

@ -2,6 +2,7 @@ package main
import ( import (
"strings" "strings"
"time"
"github.com/restic/restic/internal/debug" "github.com/restic/restic/internal/debug"
"github.com/restic/restic/internal/errors" "github.com/restic/restic/internal/errors"
@ -202,6 +203,7 @@ func runRestore(opts RestoreOptions, gopts GlobalOptions, args []string) error {
if opts.Verify { if opts.Verify {
Verbosef("verifying files in %s\n", opts.Target) Verbosef("verifying files in %s\n", opts.Target)
var count int var count int
t0 := time.Now()
count, err = res.VerifyFiles(ctx, opts.Target) count, err = res.VerifyFiles(ctx, opts.Target)
if err != nil { if err != nil {
return err return err
@ -209,7 +211,8 @@ func runRestore(opts RestoreOptions, gopts GlobalOptions, args []string) error {
if totalErrors > 0 { if totalErrors > 0 {
return errors.Fatalf("There were %d errors\n", totalErrors) return errors.Fatalf("There were %d errors\n", totalErrors)
} }
Verbosef("finished verifying %d files in %s\n", count, opts.Target) Verbosef("finished verifying %d files in %s (took %s)\n", count, opts.Target,
time.Since(t0).Round(time.Millisecond))
} }
return nil return nil