1
0
Fork 0

cpu tick 퍼센트로도 표시

This commit is contained in:
Sangbum Kim 2018-07-06 15:07:26 +09:00
parent d06269e787
commit a9b0dc79e3
2 changed files with 14 additions and 0 deletions

View File

@ -90,6 +90,11 @@ func e() {
fmt.Printf("cpu system: %d\n", ct.System) fmt.Printf("cpu system: %d\n", ct.System)
fmt.Printf("cpu total: %d\n", ct.Total) fmt.Printf("cpu total: %d\n", ct.Total)
fmt.Printf("cpu user: %d\n", ct.User) 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() { func f() {

View File

@ -104,6 +104,15 @@ func e() {
fmt.Printf("cpu softirq: %d\n", ct.Softirq) fmt.Printf("cpu softirq: %d\n", ct.Softirq)
fmt.Printf("cpu steal: %d\n", ct.Steal) fmt.Printf("cpu steal: %d\n", ct.Steal)
fmt.Printf("cpu total: %d\n", ct.Total) 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() { func f() {
disks, err := disk.Get() disks, err := disk.Get()