add net rx/tx column

This commit is contained in:
Bradley Cicenas
2016-12-26 17:57:55 +00:00
parent e5e84ee206
commit 1bbe8463fe
4 changed files with 24 additions and 6 deletions

View File

@@ -10,6 +10,7 @@ import (
type Widgets struct {
cid *ui.Par
cpu *ui.Gauge
net *ui.Gauge
memory *ui.Gauge
}
@@ -22,6 +23,10 @@ func (w *Widgets) SetCPU(val int) {
w.cpu.Percent = val
}
func (w *Widgets) SetNet(rx int64, tx int64) {
w.net.Label = fmt.Sprintf("%s / %s", byteFormat(rx), byteFormat(tx))
}
func (w *Widgets) SetMem(val int64, limit int64) {
if val < 5 {
val = 5
@@ -36,7 +41,7 @@ func NewWidgets(id string) *Widgets {
cid.Height = 1
cid.Width = 20
cid.TextFgColor = ui.ColorWhite
return &Widgets{cid, mkGauge(), mkGauge()}
return &Widgets{cid, mkGauge(), mkGauge(), mkGauge()}
}
func mkGauge() *ui.Gauge {