mirror of
https://github.com/bcicen/ctop.git
synced 2024-08-30 18:23:19 +00:00
rename Memory widget
This commit is contained in:
parent
27e272c58f
commit
954aaeb06b
@ -13,7 +13,7 @@ type Compact struct {
|
|||||||
Name *TextCol
|
Name *TextCol
|
||||||
Cid *TextCol
|
Cid *TextCol
|
||||||
Cpu *GaugeCol
|
Cpu *GaugeCol
|
||||||
Memory *GaugeCol
|
Mem *GaugeCol
|
||||||
Net *TextCol
|
Net *TextCol
|
||||||
IO *TextCol
|
IO *TextCol
|
||||||
Pids *TextCol
|
Pids *TextCol
|
||||||
@ -32,7 +32,7 @@ func NewCompact(id string) *Compact {
|
|||||||
Name: NewTextCol("-"),
|
Name: NewTextCol("-"),
|
||||||
Cid: NewTextCol(id),
|
Cid: NewTextCol(id),
|
||||||
Cpu: NewGaugeCol(),
|
Cpu: NewGaugeCol(),
|
||||||
Memory: NewGaugeCol(),
|
Mem: NewGaugeCol(),
|
||||||
Net: NewTextCol("-"),
|
Net: NewTextCol("-"),
|
||||||
IO: NewTextCol("-"),
|
IO: NewTextCol("-"),
|
||||||
Pids: NewTextCol("-"),
|
Pids: NewTextCol("-"),
|
||||||
@ -70,7 +70,7 @@ func (row *Compact) SetMetrics(m models.Metrics) {
|
|||||||
// Set gauges, counters to default unread values
|
// Set gauges, counters to default unread values
|
||||||
func (row *Compact) Reset() {
|
func (row *Compact) Reset() {
|
||||||
row.Cpu.Reset()
|
row.Cpu.Reset()
|
||||||
row.Memory.Reset()
|
row.Mem.Reset()
|
||||||
row.Net.Reset()
|
row.Net.Reset()
|
||||||
row.IO.Reset()
|
row.IO.Reset()
|
||||||
row.Pids.Reset()
|
row.Pids.Reset()
|
||||||
@ -121,7 +121,7 @@ func (row *Compact) Buffer() ui.Buffer {
|
|||||||
buf.Merge(row.Name.Buffer())
|
buf.Merge(row.Name.Buffer())
|
||||||
buf.Merge(row.Cid.Buffer())
|
buf.Merge(row.Cid.Buffer())
|
||||||
buf.Merge(row.Cpu.Buffer())
|
buf.Merge(row.Cpu.Buffer())
|
||||||
buf.Merge(row.Memory.Buffer())
|
buf.Merge(row.Mem.Buffer())
|
||||||
buf.Merge(row.Net.Buffer())
|
buf.Merge(row.Net.Buffer())
|
||||||
buf.Merge(row.IO.Buffer())
|
buf.Merge(row.IO.Buffer())
|
||||||
buf.Merge(row.Pids.Buffer())
|
buf.Merge(row.Pids.Buffer())
|
||||||
@ -134,7 +134,7 @@ func (row *Compact) all() []ui.GridBufferer {
|
|||||||
row.Name,
|
row.Name,
|
||||||
row.Cid,
|
row.Cid,
|
||||||
row.Cpu,
|
row.Cpu,
|
||||||
row.Memory,
|
row.Mem,
|
||||||
row.Net,
|
row.Net,
|
||||||
row.IO,
|
row.IO,
|
||||||
row.Pids,
|
row.Pids,
|
||||||
|
@ -37,12 +37,12 @@ func (row *Compact) SetCPU(val int) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (row *Compact) SetMem(val int64, limit int64, percent int) {
|
func (row *Compact) SetMem(val int64, limit int64, percent int) {
|
||||||
row.Memory.Label = fmt.Sprintf("%s / %s", cwidgets.ByteFormat(val), cwidgets.ByteFormat(limit))
|
row.Mem.Label = fmt.Sprintf("%s / %s", cwidgets.ByteFormat(val), cwidgets.ByteFormat(limit))
|
||||||
if percent < 5 {
|
if percent < 5 {
|
||||||
percent = 5
|
percent = 5
|
||||||
row.Memory.BarColor = ui.ColorBlack
|
row.Mem.BarColor = ui.ColorBlack
|
||||||
} else {
|
} else {
|
||||||
row.Memory.BarColor = ui.ThemeAttr("gauge.bar.bg")
|
row.Mem.BarColor = ui.ThemeAttr("gauge.bar.bg")
|
||||||
}
|
}
|
||||||
row.Memory.Percent = percent
|
row.Mem.Percent = percent
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user