mirror of
https://github.com/bcicen/ctop.git
synced 2025-12-06 15:16:41 +08:00
add net rx/tx column
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user