Skip to content

Commit

Permalink
Update utils.go
Browse files Browse the repository at this point in the history
  • Loading branch information
spiritLHLS authored May 12, 2024
1 parent ee11ab9 commit 369f2ad
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion disktest/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,15 @@ func parseResultDD(tempText, blockCount string) string {
if len(tp2) == 4 {
usageTime, _ = strconv.ParseFloat(strings.Split(strings.TrimSpace(tp2[2]), " ")[0], 64)
ioSpeed := strings.Split(strings.TrimSpace(tp2[3]), " ")[0]
ioSpeedFlat := strings.Split(strings.TrimSpace(tp2[3]), " ")[1]
iops := records / usageTime
var iopsText string
if iops >= 1000 {
iopsText = strconv.FormatFloat(iops/1000, 'f', 2, 64) + "K IOPS, " + strconv.FormatFloat(usageTime, 'f', 2, 64) + "s"
} else {
iopsText = strconv.FormatFloat(iops, 'f', 2, 64) + " IOPS, " + strconv.FormatFloat(usageTime, 'f', 2, 64) + "s"
}
result += fmt.Sprintf("%-30s", strings.TrimSpace(ioSpeed)+" MB/s("+iopsText+")") + " "
result += fmt.Sprintf("%-30s", strings.TrimSpace(ioSpeed)+" " + ioSpeedFlat + "("+iopsText+")") + " "
}
}
}
Expand Down

0 comments on commit 369f2ad

Please sign in to comment.