Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

Commit

Permalink
Fix speed compute (#1408)
Browse files Browse the repository at this point in the history
  • Loading branch information
joccau authored Aug 4, 2021
1 parent 0c84977 commit 66937a1
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions pkg/summary/collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,17 +195,14 @@ func (tc *logCollector) Summary(name string) {
tc.log(name+" failed summary", logFields...)
return
}
totalCost := time.Duration(0)
for _, cost := range tc.successCosts {
totalCost += cost
}

logFields = append(logFields, zap.Duration("total-take", time.Since(tc.startTime)))
totalDureTime := time.Since(tc.startTime)
logFields = append(logFields, zap.Duration("total-take", totalDureTime))
for name, data := range tc.successData {
if name == TotalBytes {
logFields = append(logFields,
zap.String("total-kv-size", units.HumanSize(float64(data))),
zap.String("average-speed", units.HumanSize(float64(data)/totalCost.Seconds())+"/s"))
zap.String("average-speed", units.HumanSize(float64(data)/totalDureTime.Seconds())+"/s"))
continue
}
if name == BackupDataSize {
Expand Down

0 comments on commit 66937a1

Please sign in to comment.