From a9b0dc79e3636c2e8de61463bbef412e71bdd886 Mon Sep 17 00:00:00 2001 From: Sangbum Kim Date: Fri, 6 Jul 2018 15:07:26 +0900 Subject: [PATCH] =?UTF-8?q?cpu=20tick=20=ED=8D=BC=EC=84=BC=ED=8A=B8?= =?UTF-8?q?=EB=A1=9C=EB=8F=84=20=ED=91=9C=EC=8B=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/os_darwin.go | 5 +++++ test/os_linux.go | 9 +++++++++ 2 files changed, 14 insertions(+) diff --git a/test/os_darwin.go b/test/os_darwin.go index eaba45a..2d0e191 100644 --- a/test/os_darwin.go +++ b/test/os_darwin.go @@ -90,6 +90,11 @@ func e() { fmt.Printf("cpu system: %d\n", ct.System) 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) } func f() { diff --git a/test/os_linux.go b/test/os_linux.go index 52c482b..07f1af4 100644 --- a/test/os_linux.go +++ b/test/os_linux.go @@ -104,6 +104,15 @@ func e() { fmt.Printf("cpu softirq: %d\n", ct.Softirq) 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) } func f() { disks, err := disk.Get()