mirror of
https://github.com/weaveworks/scope.git
synced 2026-07-28 09:41:57 +00:00
Merge pull request #3435 from weaveworks/docker-memory-no-cache
Subtract page cache from container memory usage
This commit is contained in:
@@ -336,7 +336,10 @@ func (c *container) memoryUsageMetric(stats []docker.Stats) report.Metric {
|
||||
samples := make([]report.Sample, len(stats))
|
||||
for i, s := range stats {
|
||||
samples[i].Timestamp = s.Read
|
||||
samples[i].Value = float64(s.MemoryStats.Usage)
|
||||
// This code adapted from
|
||||
// https://github.com/docker/cli/blob/5931fb4276be0afdd6e5ed338d1b2b4b9b5ec8e5/cli/command/container/stats_helpers.go
|
||||
// so that Scope numbers match Docker numbers. Page cache is intentionally excluded.
|
||||
samples[i].Value = float64(s.MemoryStats.Usage - s.MemoryStats.Stats.Cache)
|
||||
if float64(s.MemoryStats.Limit) > max {
|
||||
max = float64(s.MemoryStats.Limit)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user