2015-04-21 12:51:01 +03:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"github.com/pyk/byten"
|
|
|
|
)
|
|
|
|
|
|
|
|
// DummyUI is an simple console UI mockup, for testing purposes.
|
|
|
|
type DummyUI struct{}
|
|
|
|
|
|
|
|
func (u *DummyUI) Init() {}
|
|
|
|
func (u *DummyUI) Close() {}
|
|
|
|
func (u *DummyUI) Update(data Data) {
|
|
|
|
if data.Services == nil {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
for _, service := range data.Services {
|
|
|
|
fmt.Printf("%s: ", service.Name)
|
|
|
|
if service.Err != nil {
|
|
|
|
fmt.Printf("ERROR: %s", service.Err)
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
|
|
|
|
if service.Memstats != nil {
|
|
|
|
alloc := byten.Size(int64(service.Memstats.Alloc))
|
|
|
|
sys := byten.Size(int64(service.Memstats.Sys))
|
|
|
|
fmt.Printf("%s/%s ", alloc, sys)
|
|
|
|
}
|
|
|
|
|
2015-04-25 15:54:17 +03:00
|
|
|
/*
|
|
|
|
if service.Goroutines != 0 {
|
|
|
|
fmt.Printf("goroutines: %d", service.Goroutines)
|
|
|
|
}
|
|
|
|
*/
|
2015-04-21 12:51:01 +03:00
|
|
|
fmt.Printf("\n")
|
|
|
|
}
|
|
|
|
}
|