restic stats: print uncompressed size in mode raw-data
This commit is contained in:
parent
6c69f08a7b
commit
837b816358
1 changed files with 18 additions and 7 deletions
|
@ -135,6 +135,13 @@ func runStats(gopts GlobalOptions, args []string) error {
|
|||
return fmt.Errorf("blob %v not found", blobHandle)
|
||||
}
|
||||
stats.TotalSize += uint64(pbs[0].Length)
|
||||
if repo.Config().Version >= 2 {
|
||||
if pbs[0].IsCompressed() {
|
||||
stats.TotalUncompressedSize += uint64(pbs[0].UncompressedLength)
|
||||
} else {
|
||||
stats.TotalUncompressedSize += uint64(pbs[0].Length)
|
||||
}
|
||||
}
|
||||
stats.TotalBlobCount++
|
||||
}
|
||||
}
|
||||
|
@ -156,6 +163,9 @@ func runStats(gopts GlobalOptions, args []string) error {
|
|||
if stats.TotalFileCount > 0 {
|
||||
Printf(" Total File Count: %d\n", stats.TotalFileCount)
|
||||
}
|
||||
if stats.TotalUncompressedSize > 0 {
|
||||
Printf("Total Uncompressed Size: %-5s\n", formatBytes(stats.TotalUncompressedSize))
|
||||
}
|
||||
Printf(" Total Size: %-5s\n", formatBytes(stats.TotalSize))
|
||||
|
||||
return nil
|
||||
|
@ -283,6 +293,7 @@ func verifyStatsInput(gopts GlobalOptions, args []string) error {
|
|||
// for a successful and efficient walk.
|
||||
type statsContainer struct {
|
||||
TotalSize uint64 `json:"total_size"`
|
||||
TotalUncompressedSize uint64 `json:"total_uncompressed_size"`
|
||||
TotalFileCount uint64 `json:"total_file_count"`
|
||||
TotalBlobCount uint64 `json:"total_blob_count,omitempty"`
|
||||
// holds count of all considered snapshots
|
||||
|
|
Loading…
Reference in a new issue