use humanize.IBytes instead of humanize.Bytes (#4455)

This commit is contained in:
Harshavardhana
2023-01-24 07:14:25 -08:00
committed by GitHub
parent 34a67cb169
commit 842a816385
3 changed files with 8 additions and 8 deletions
+3 -3
View File
@@ -572,17 +572,17 @@ func (s shortBackgroundHealStatusMessage) String() string {
healPrettyMsg += fmt.Sprintf("Objects Healed: %s/%s (%s), %s/%s (%s)\n",
humanize.Comma(int64(itemsHealed)), humanize.Comma(int64(totalItems)), humanize.CommafWithDigits(itemsPct, 1)+"%%",
humanize.Bytes(bytesHealed), humanize.Bytes(totalBytes), humanize.CommafWithDigits(bytesPct, 1)+"%%")
humanize.IBytes(bytesHealed), humanize.IBytes(totalBytes), humanize.CommafWithDigits(bytesPct, 1)+"%%")
if itemsFailed > 0 {
itemsPct := math.Min(100, 100*float64(itemsFailed)/float64(totalItems))
bytesPct := math.Min(100, 100*float64(bytesFailed)/float64(totalBytes))
healPrettyMsg += fmt.Sprintf("Objects Failed: %s/%s (%s), %s/%s (%s)\n",
humanize.Comma(int64(itemsFailed)), humanize.Comma(int64(totalItems)), humanize.CommafWithDigits(itemsPct, 1)+"%%",
humanize.Bytes(bytesFailed), humanize.Bytes(totalBytes), humanize.CommafWithDigits(bytesPct, 1)+"%%")
humanize.IBytes(bytesFailed), humanize.IBytes(totalBytes), humanize.CommafWithDigits(bytesPct, 1)+"%%")
}
} else {
healPrettyMsg += fmt.Sprintf("Objects Healed: %s, %s\n", humanize.Comma(int64(itemsHealed)), humanize.Bytes(bytesHealed))
healPrettyMsg += fmt.Sprintf("Objects Healed: %s, %s\n", humanize.Comma(int64(itemsHealed)), humanize.IBytes(bytesHealed))
}
if accumulatedElapsedTime > 0 {
+1 -1
View File
@@ -119,7 +119,7 @@ func mainAdminRebalanceStatus(ctx *cli.Context) error {
var b strings.Builder
fmt.Fprintf(&b, "Summary: \n")
fmt.Fprintf(&b, "Data: %s (%d objects, %d versions) \n", humanize.Bytes(totalBytes), totalObjects, totalVersions)
fmt.Fprintf(&b, "Data: %s (%d objects, %d versions) \n", humanize.IBytes(totalBytes), totalObjects, totalVersions)
fmt.Fprintf(&b, "Time: %s (%s to completion)", maxElapsed, maxETA)
console.Println(b.String())
return nil
+4 -4
View File
@@ -73,10 +73,10 @@ func GetSysInfo() map[string]string {
"host.arch": runtime.GOARCH,
"host.lang": runtime.Version(),
"host.cpus": strconv.Itoa(runtime.NumCPU()),
"mem.used": humanize.Bytes(memstats.Alloc),
"mem.total": humanize.Bytes(memstats.Sys),
"mem.heap.used": humanize.Bytes(memstats.HeapAlloc),
"mem.heap.total": humanize.Bytes(memstats.HeapSys),
"mem.used": humanize.IBytes(memstats.Alloc),
"mem.total": humanize.IBytes(memstats.Sys),
"mem.heap.used": humanize.IBytes(memstats.HeapAlloc),
"mem.heap.total": humanize.IBytes(memstats.HeapSys),
}
}