forked from TrueCloudLab/restic
Extend cmd/split
This commit is contained in:
parent
878a96e761
commit
16dfd73ecb
1 changed files with 16 additions and 15 deletions
|
@ -31,22 +31,23 @@ func main() {
|
||||||
for {
|
for {
|
||||||
chunk, err := ch.Next()
|
chunk, err := ch.Next()
|
||||||
|
|
||||||
if chunk != nil {
|
|
||||||
fmt.Printf("%d %016x %02x\n", chunk.Length, chunk.Cut, sha256.Sum256(chunk.Data))
|
|
||||||
count++
|
|
||||||
bytes += chunk.Length
|
|
||||||
|
|
||||||
if chunk.Length == chunker.MaxSize {
|
|
||||||
max++
|
|
||||||
} else if chunk.Length == chunker.MinSize {
|
|
||||||
min++
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if err == io.EOF {
|
if err == io.EOF {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
fmt.Printf("%d %016x %02x\n", chunk.Length, chunk.Cut, sha256.Sum256(chunk.Data))
|
||||||
|
count++
|
||||||
|
bytes += chunk.Length
|
||||||
|
|
||||||
|
if chunk.Length == chunker.MaxSize {
|
||||||
|
max++
|
||||||
|
} else if chunk.Length == chunker.MinSize {
|
||||||
|
min++
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var avg int
|
var avg int
|
||||||
|
@ -54,6 +55,6 @@ func main() {
|
||||||
avg = bytes / count
|
avg = bytes / count
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Fprintf(os.Stderr, "%d chunks, average size %d (%d min size, %d max size chunks)\n",
|
fmt.Fprintf(os.Stderr, "%d chunks from %d bytes, average size %d (%d min size, %d max size chunks)\n",
|
||||||
count, avg, min, max)
|
count, bytes, avg, min, max)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue