From cc763de2215f6077d0fd1824763e2dff761d1f7a Mon Sep 17 00:00:00 2001 From: GoEdgeLab Date: Wed, 2 Aug 2023 12:21:47 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=B9=E7=A1=AC=E7=9B=98=E5=86=99=E5=85=A5?= =?UTF-8?q?=E9=80=9F=E5=BA=A6=E6=A0=BC=E5=BC=8F=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmd/edge-node/main.go | 2 +- internal/utils/fs/disk.go | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/cmd/edge-node/main.go b/cmd/edge-node/main.go index d3fb630..798157b 100644 --- a/cmd/edge-node/main.go +++ b/cmd/edge-node/main.go @@ -436,7 +436,7 @@ func main() { if err != nil { fmt.Println("[ERROR]" + err.Error()) } else { - fmt.Printf("Speed: %.2fMB/s\n", speedMB) + fmt.Printf("Speed: %.0fMB/s\n", speedMB) if isFast { fmt.Println("IsFast: true") } else { diff --git a/internal/utils/fs/disk.go b/internal/utils/fs/disk.go index 3d24551..89a8549 100644 --- a/internal/utils/fs/disk.go +++ b/internal/utils/fs/disk.go @@ -4,6 +4,7 @@ package fsutils import ( "bytes" + "math" "os" "time" ) @@ -52,6 +53,7 @@ func CheckDiskWritingSpeed() (speedMB float64, err error) { var costSeconds = time.Since(before).Seconds() speedMB = float64(len(data)) / (1 << 20) / costSeconds + speedMB = math.Ceil(speedMB/10) * 10 isClosed = true