summaryrefslogtreecommitdiffstats
path: root/widgets/mem.go
diff options
context:
space:
mode:
Diffstat (limited to 'widgets/mem.go')
-rw-r--r--widgets/mem.go12
1 files changed, 8 insertions, 4 deletions
diff --git a/widgets/mem.go b/widgets/mem.go
index b994276..b6379a9 100644
--- a/widgets/mem.go
+++ b/widgets/mem.go
@@ -26,8 +26,10 @@ func NewMemWidget(updateInterval time.Duration, horizontalScale int) *MemWidget
mems := make(map[string]devices.MemoryInfo)
devices.UpdateMem(mems)
for name, mem := range mems {
- widg.Data[name] = []float64{0}
- widg.renderMemInfo(name, mem)
+ if mem.Total > 0 {
+ widg.Data[name] = []float64{0}
+ widg.renderMemInfo(name, mem)
+ }
}
go func() {
@@ -35,7 +37,9 @@ func NewMemWidget(updateInterval time.Duration, horizontalScale int) *MemWidget
widg.Lock()
devices.UpdateMem(mems)
for label, mi := range mems {
- widg.renderMemInfo(label, mi)
+ if mi.Total > 0 {
+ widg.renderMemInfo(label, mi)
+ }
}
widg.Unlock()
}
@@ -47,7 +51,7 @@ func NewMemWidget(updateInterval time.Duration, horizontalScale int) *MemWidget
func (mem *MemWidget) EnableMetric() {
mems := make(map[string]devices.MemoryInfo)
devices.UpdateMem(mems)
- for l, _ := range mems {
+ for l := range mems {
lc := l
metrics.NewGauge(makeName("memory", l), func() float64 {
if ds, ok := mem.Data[lc]; ok {
rpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
{
  debug: true
  production: false
  arr: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
  place: {
    name: Torre di Pisa
    longitude: 43.7224985
    latitude: 10.3970522
    favorite: false
    reviews: 3866
    rating: 4.5
    creator: {
      name: John Smith
    }
  }
}