[BUGFIX] Memory calc for meshviewer (#38)

Discussed in https://github.com/FreifunkBremen/yanic/issues/35
This commit is contained in:
Geno 2017-03-13 18:36:39 +01:00 committed by GitHub
parent a68e13d311
commit 49a153b7a2
1 changed files with 4 additions and 2 deletions

View File

@ -69,9 +69,11 @@ func NewStatistics(stats *data.Statistics) *Statistics {
total = stats.Clients.Wifi24 + stats.Clients.Wifi5 total = stats.Clients.Wifi24 + stats.Clients.Wifi5
} }
/* The Meshviewer could not handle absolute memory output /* The Meshviewer could not handle absolute memory output
* calc the used memory as a float witch 100% equal 1.0 * calc the used memory as a float which 100% equal 1.0
* calc is coppied from node statuspage (look discussion:
* https://github.com/FreifunkBremen/yanic/issues/35)
*/ */
memoryUsage := (float64(stats.Memory.Total) - float64(stats.Memory.Free)) / float64(stats.Memory.Total) memoryUsage := 1 - (float64(stats.Memory.Free)+float64(stats.Memory.Buffers)+float64(stats.Memory.Cached))/float64(stats.Memory.Total)
return &Statistics{ return &Statistics{
NodeID: stats.NodeID, NodeID: stats.NodeID,