From 5de0a1a5d9a071a50bfbcc326962a9aec5ef203e Mon Sep 17 00:00:00 2001 From: Sangbum Kim Date: Fri, 6 Jul 2018 15:10:32 +0900 Subject: [PATCH] =?UTF-8?q?=ED=83=80=EC=9E=85=EC=98=A4=EB=A5=98=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/os_darwin.go | 8 ++++---- test/os_linux.go | 16 ++++++++-------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/test/os_darwin.go b/test/os_darwin.go index 2d0e191..4e02981 100644 --- a/test/os_darwin.go +++ b/test/os_darwin.go @@ -91,10 +91,10 @@ func e() { fmt.Printf("cpu total: %d\n", ct.Total) fmt.Printf("cpu user: %d\n", ct.User) - fmt.Printf("cpu idle: %f%%\n", ct.Idle*100/ct.Total) - fmt.Printf("cpu nice: %f%%\n", ct.Nice*100/ct.Total) - fmt.Printf("cpu system: %f%%\n", ct.System*100/ct.Total) - fmt.Printf("cpu user: %f%%\n", ct.User*100/ct.Total) + fmt.Printf("cpu idle: %f%%\n", float64(ct.Idle*100)/float64(ct.Total)) + fmt.Printf("cpu nice: %f%%\n", float64(ct.Nice*100)/float64(ct.Total)) + fmt.Printf("cpu system: %f%%\n", float64(ct.System*100)/float64(ct.Total)) + fmt.Printf("cpu user: %f%%\n", float64(ct.User*100)/float64(ct.Total)) } func f() { diff --git a/test/os_linux.go b/test/os_linux.go index 07f1af4..2d59807 100644 --- a/test/os_linux.go +++ b/test/os_linux.go @@ -105,14 +105,14 @@ func e() { fmt.Printf("cpu steal: %d\n", ct.Steal) fmt.Printf("cpu total: %d\n", ct.Total) - fmt.Printf("cpu user: %f%%\n", ct.User*100/ct.Total) - fmt.Printf("cpu nice: %f%%\n", ct.Nice*100/ct.Total) - fmt.Printf("cpu system: %f%%\n", ct.System*100/ct.Total) - fmt.Printf("cpu idle: %f%%\n", ct.Idle*100/ct.Total) - fmt.Printf("cpu iowait: %f%%\n", ct.Iowait*100/ct.Total) - fmt.Printf("cpu irq: %f%%\n", ct.Irq*100/ct.Total) - fmt.Printf("cpu softirq: %f%%\n", ct.Softirq*100/ct.Total) - fmt.Printf("cpu steal: %f%%\n", ct.Steal*100/ct.Total) + fmt.Printf("cpu user: %f%%\n", float64(ct.User*100)/float64(ct.Total)) + fmt.Printf("cpu nice: %f%%\n", float64(ct.Nice*100)/float64(ct.Total)) + fmt.Printf("cpu system: %f%%\n", float64(ct.System*100)/float64(ct.Total)) + fmt.Printf("cpu idle: %f%%\n", float64(ct.Idle*100)/float64(ct.Total)) + fmt.Printf("cpu iowait: %f%%\n", float64(ct.Iowait*100)/float64(ct.Total)) + fmt.Printf("cpu irq: %f%%\n", float64(ct.Irq*100)/float64(ct.Total)) + fmt.Printf("cpu softirq: %f%%\n", float64(ct.Softirq*100)/float64(ct.Total)) + fmt.Printf("cpu steal: %f%%\n", float64(ct.Steal*100)/float64(ct.Total)) } func f() { disks, err := disk.Get()