Skip to content

Commit

Permalink
kubele: add RSS memroy to the summary API
Browse files Browse the repository at this point in the history
  • Loading branch information
yujuhong committed Apr 8, 2016
1 parent 22f01f1 commit 388b4ff
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/kubelet/api/v1alpha1/stats/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,9 @@ type MemoryStats struct {
// The amount of working set memory. This includes recently accessed memory,
// dirty memory, and kernel memory. UsageBytes is <= TotalBytes.
WorkingSetBytes *uint64 `json:"workingSetBytes,omitempty"`
// The amount of anonymous and swap cache memory (includes transparent
// hugepages).
RSSBytes *uint64 `json:"rssBytes,omitempty"`
// Cumulative number of minor page faults.
PageFaults *uint64 `json:"pageFaults,omitempty"`
// Cumulative number of major page faults.
Expand Down
1 change: 1 addition & 0 deletions pkg/kubelet/server/stats/summary.go
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@ func (sb *summaryBuilder) containerInfoV2ToStats(
Time: unversioned.NewTime(cstat.Timestamp),
UsageBytes: &cstat.Memory.Usage,
WorkingSetBytes: &cstat.Memory.WorkingSet,
RSSBytes: &cstat.Memory.RSS,
PageFaults: &pageFaults,
MajorPageFaults: &majorPageFaults,
}
Expand Down
3 changes: 3 additions & 0 deletions pkg/kubelet/server/stats/summary_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ const (
offsetMemPageFaults
offsetMemMajorPageFaults
offsetMemUsageBytes
offsetMemRSSBytes
offsetMemWorkingSetBytes
offsetNetRxBytes
offsetNetRxErrors
Expand Down Expand Up @@ -258,6 +259,7 @@ func summaryTestContainerInfo(seed int, podName string, podNamespace string, con
Memory: &v1.MemoryStats{
Usage: uint64(seed + offsetMemUsageBytes),
WorkingSet: uint64(seed + offsetMemWorkingSetBytes),
RSS: uint64(seed + offsetMemRSSBytes),
ContainerData: v1.MemoryStatsMemoryData{
Pgfault: uint64(seed + offsetMemPageFaults),
Pgmajfault: uint64(seed + offsetMemMajorPageFaults),
Expand Down Expand Up @@ -310,6 +312,7 @@ func checkMemoryStats(t *testing.T, label string, seed int, stats *kubestats.Mem
assert.EqualValues(t, testTime(timestamp, seed).Unix(), stats.Time.Time.Unix(), label+".Mem.Time")
assert.EqualValues(t, seed+offsetMemUsageBytes, *stats.UsageBytes, label+".Mem.UsageBytes")
assert.EqualValues(t, seed+offsetMemWorkingSetBytes, *stats.WorkingSetBytes, label+".Mem.WorkingSetBytes")
assert.EqualValues(t, seed+offsetMemRSSBytes, *stats.RSSBytes, label+".Mem.RSSBytes")
assert.EqualValues(t, seed+offsetMemPageFaults, *stats.PageFaults, label+".Mem.PageFaults")
assert.EqualValues(t, seed+offsetMemMajorPageFaults, *stats.MajorPageFaults, label+".Mem.MajorPageFaults")
}
Expand Down

1 comment on commit 388b4ff

@k8s-teamcity-mesosphere

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TeamCity OSS :: Kubernetes Mesos :: 4 - Smoke Tests Build 20919 outcome was SUCCESS
Summary: Tests passed: 1, ignored: 273 Build time: 00:08:13

Please sign in to comment.