2
2
mirror of https://github.com/octoleo/restic.git synced 2024-11-26 14:56:29 +00:00

Merge pull request 2138 from restic/fix-2136

Use processed bytes for summary
This commit is contained in:
Alexander Neumann 2019-02-10 12:32:50 +01:00
commit 8906d85ab8

View File

@ -49,6 +49,7 @@ type Backup struct {
Changed uint Changed uint
Unchanged uint Unchanged uint
} }
ProcessedBytes uint64
archiver.ItemStats archiver.ItemStats
} }
} }
@ -259,6 +260,12 @@ func formatBytes(c uint64) string {
func (b *Backup) CompleteItem(item string, previous, current *restic.Node, s archiver.ItemStats, d time.Duration) { func (b *Backup) CompleteItem(item string, previous, current *restic.Node, s archiver.ItemStats, d time.Duration) {
b.summary.Lock() b.summary.Lock()
b.summary.ItemStats.Add(s) b.summary.ItemStats.Add(s)
// for the last item "/", current is nil
if current != nil {
b.summary.ProcessedBytes += current.Size
}
b.summary.Unlock() b.summary.Unlock()
if current == nil { if current == nil {
@ -361,7 +368,7 @@ func (b *Backup) Finish(snapshotID restic.ID) {
b.P("\n") b.P("\n")
b.P("processed %v files, %v in %s", b.P("processed %v files, %v in %s",
b.summary.Files.New+b.summary.Files.Changed+b.summary.Files.Unchanged, b.summary.Files.New+b.summary.Files.Changed+b.summary.Files.Unchanged,
formatBytes(b.totalBytes), formatBytes(b.summary.ProcessedBytes),
formatDuration(time.Since(b.start)), formatDuration(time.Since(b.start)),
) )
} }