Commit 0ef6ddc5c6 for golang
commit 0ef6ddc5c60e2bf2c5fdd01610d67263419df5aa
Author: Felix Geisendörfer <felix.geisendoerfer@datadoghq.com>
Date: Fri Dec 4 07:12:18 2026 +0100
runtime/pprof: rename remaining rss* procmem identifiers to procmem*
Rename internal identifiers left over from when the procmem profile was
called the rss profile:
- rssVirtualFrame and rssFrame* -> procmemVirtualFrame and procmemFrame*
- validateRSSMetrics -> validateProcmemMetrics
- rssPath, rssSampleHasFrame, rssProfileCycle*, allocateRSSProfile* ->
procmemPath, procmemSampleHasFrame, procmemProfileCycle*,
allocateProcmemProfile*
For #83336
Change-Id: Idad19b935247264728aeadde5a7cc042d521af76
Reviewed-on: https://go-review.googlesource.com/c/go/+/869984
Reviewed-by: Nick Ripley <nick.ripley@datadoghq.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
diff --git a/src/runtime/pprof/procmem.go b/src/runtime/pprof/procmem.go
index 4056b5ae8d..0b45038110 100644
--- a/src/runtime/pprof/procmem.go
+++ b/src/runtime/pprof/procmem.go
@@ -14,34 +14,34 @@ import (
"slices"
)
-// rssVirtualFrame is a virtual frame name used in the procmem profile to represent
+// procmemVirtualFrame is a virtual frame name used in the procmem profile to represent
// memory categories. The bracketed names cannot collide with real Go function names.
-type rssVirtualFrame string
+type procmemVirtualFrame string
const (
- rssFrameGoMemory rssVirtualFrame = "[Go Memory]"
- rssFrameNonGoMemory rssVirtualFrame = "[Non-Go Memory]"
- rssFrameFileShared rssVirtualFrame = "[File & Shared]"
- rssFrameAnonymous rssVirtualFrame = "[Anonymous]"
- rssFrameStacks rssVirtualFrame = "[Stacks]"
- rssFrameGoroutineStacks rssVirtualFrame = "[Goroutine Stacks]"
- rssFrameOSStacks rssVirtualFrame = "[OS Stacks]"
- rssFrameRuntime rssVirtualFrame = "[Runtime]"
- rssFrameMetadata rssVirtualFrame = "[Metadata]"
- rssFrameMSpan rssVirtualFrame = "[MSpan]"
- rssFrameInUseMSpans rssVirtualFrame = "[In-Use MSpans]"
- rssFrameFreeMSpans rssVirtualFrame = "[Free MSpans]"
- rssFrameMCache rssVirtualFrame = "[MCache]"
- rssFrameInUseMCaches rssVirtualFrame = "[In-Use MCaches]"
- rssFrameFreeMCaches rssVirtualFrame = "[Free MCaches]"
- rssFrameOtherMetadata rssVirtualFrame = "[Other Metadata]"
- rssFrameProfilingBuckets rssVirtualFrame = "[Profiling Buckets]"
- rssFrameOtherRuntime rssVirtualFrame = "[Other Runtime]"
- rssFrameHeap rssVirtualFrame = "[Heap]"
- rssFrameLiveHeap rssVirtualFrame = "[Live Heap]"
- rssFrameDeadHeap rssVirtualFrame = "[Dead Heap]"
- rssFrameUnusedHeap rssVirtualFrame = "[Unused Heap]"
- rssFrameFreeHeap rssVirtualFrame = "[Free Heap]"
+ procmemFrameGoMemory procmemVirtualFrame = "[Go Memory]"
+ procmemFrameNonGoMemory procmemVirtualFrame = "[Non-Go Memory]"
+ procmemFrameFileShared procmemVirtualFrame = "[File & Shared]"
+ procmemFrameAnonymous procmemVirtualFrame = "[Anonymous]"
+ procmemFrameStacks procmemVirtualFrame = "[Stacks]"
+ procmemFrameGoroutineStacks procmemVirtualFrame = "[Goroutine Stacks]"
+ procmemFrameOSStacks procmemVirtualFrame = "[OS Stacks]"
+ procmemFrameRuntime procmemVirtualFrame = "[Runtime]"
+ procmemFrameMetadata procmemVirtualFrame = "[Metadata]"
+ procmemFrameMSpan procmemVirtualFrame = "[MSpan]"
+ procmemFrameInUseMSpans procmemVirtualFrame = "[In-Use MSpans]"
+ procmemFrameFreeMSpans procmemVirtualFrame = "[Free MSpans]"
+ procmemFrameMCache procmemVirtualFrame = "[MCache]"
+ procmemFrameInUseMCaches procmemVirtualFrame = "[In-Use MCaches]"
+ procmemFrameFreeMCaches procmemVirtualFrame = "[Free MCaches]"
+ procmemFrameOtherMetadata procmemVirtualFrame = "[Other Metadata]"
+ procmemFrameProfilingBuckets procmemVirtualFrame = "[Profiling Buckets]"
+ procmemFrameOtherRuntime procmemVirtualFrame = "[Other Runtime]"
+ procmemFrameHeap procmemVirtualFrame = "[Heap]"
+ procmemFrameLiveHeap procmemVirtualFrame = "[Live Heap]"
+ procmemFrameDeadHeap procmemVirtualFrame = "[Dead Heap]"
+ procmemFrameUnusedHeap procmemVirtualFrame = "[Unused Heap]"
+ procmemFrameFreeHeap procmemVirtualFrame = "[Free Heap]"
)
var procmemProfile = &Profile{
@@ -60,7 +60,7 @@ func writeProcmem(w io.Writer, debug int) error {
return errors.New("procmem profile: disabled by GODEBUG=procmemprofile=0")
}
p, metrics := readMemProfileWithMetrics()
- if err := validateRSSMetrics(&metrics); err != nil {
+ if err := validateProcmemMetrics(&metrics); err != nil {
return fmt.Errorf("procmem profile: %w", err)
}
return writeProcmemProto(w, p, int64(runtime.MemProfileRate), &metrics)
@@ -79,7 +79,7 @@ func readMemProfileWithMetrics() ([]profilerecord.MemProfileRecord, profilerecor
}
}
-func validateRSSMetrics(m *profilerecord.MemProfileMetrics) error {
+func validateProcmemMetrics(m *profilerecord.MemProfileMetrics) error {
leafSum := m.MemoryClassesHeapStacks + m.MemoryClassesOSStacks +
m.MemoryClassesMetadataMSpanInuse + m.MemoryClassesMetadataMSpanFree +
m.MemoryClassesMetadataMCacheInuse + m.MemoryClassesMetadataMCacheFree +
@@ -118,16 +118,16 @@ func writeProcmemProto(w io.Writer, p []profilerecord.MemProfileRecord, rate int
}
}
- frames := []rssVirtualFrame{
- rssFrameGoMemory, rssFrameNonGoMemory, rssFrameFileShared, rssFrameAnonymous,
- rssFrameStacks, rssFrameGoroutineStacks, rssFrameOSStacks,
- rssFrameRuntime, rssFrameMetadata,
- rssFrameMSpan, rssFrameInUseMSpans, rssFrameFreeMSpans,
- rssFrameMCache, rssFrameInUseMCaches, rssFrameFreeMCaches,
- rssFrameOtherMetadata, rssFrameProfilingBuckets, rssFrameOtherRuntime,
- rssFrameHeap, rssFrameLiveHeap, rssFrameDeadHeap, rssFrameUnusedHeap, rssFrameFreeHeap,
+ frames := []procmemVirtualFrame{
+ procmemFrameGoMemory, procmemFrameNonGoMemory, procmemFrameFileShared, procmemFrameAnonymous,
+ procmemFrameStacks, procmemFrameGoroutineStacks, procmemFrameOSStacks,
+ procmemFrameRuntime, procmemFrameMetadata,
+ procmemFrameMSpan, procmemFrameInUseMSpans, procmemFrameFreeMSpans,
+ procmemFrameMCache, procmemFrameInUseMCaches, procmemFrameFreeMCaches,
+ procmemFrameOtherMetadata, procmemFrameProfilingBuckets, procmemFrameOtherRuntime,
+ procmemFrameHeap, procmemFrameLiveHeap, procmemFrameDeadHeap, procmemFrameUnusedHeap, procmemFrameFreeHeap,
}
- vLoc := make(map[rssVirtualFrame]uint64, len(frames))
+ vLoc := make(map[procmemVirtualFrame]uint64, len(frames))
for _, frame := range frames {
name := string(frame)
funcID := b.reserveFuncID()
@@ -146,7 +146,7 @@ func writeProcmemProto(w io.Writer, p []profilerecord.MemProfileRecord, rate int
}
var sampleLocs []uint64
- emitSample := func(value int64, vpath []rssVirtualFrame, realLocs []uint64, size int64) {
+ emitSample := func(value int64, vpath []procmemVirtualFrame, realLocs []uint64, size int64) {
if value == 0 {
return
}
@@ -164,24 +164,24 @@ func writeProcmemProto(w io.Writer, p []profilerecord.MemProfileRecord, rate int
fixed := []struct {
value uint64
- path []rssVirtualFrame
+ path []procmemVirtualFrame
}{
- {m.MemoryClassesHeapStacks, []rssVirtualFrame{rssFrameGoMemory, rssFrameStacks, rssFrameGoroutineStacks}},
- {m.MemoryClassesOSStacks, []rssVirtualFrame{rssFrameGoMemory, rssFrameStacks, rssFrameOSStacks}},
- {m.MemoryClassesMetadataMSpanInuse, []rssVirtualFrame{rssFrameGoMemory, rssFrameRuntime, rssFrameMetadata, rssFrameMSpan, rssFrameInUseMSpans}},
- {m.MemoryClassesMetadataMSpanFree, []rssVirtualFrame{rssFrameGoMemory, rssFrameRuntime, rssFrameMetadata, rssFrameMSpan, rssFrameFreeMSpans}},
- {m.MemoryClassesMetadataMCacheInuse, []rssVirtualFrame{rssFrameGoMemory, rssFrameRuntime, rssFrameMetadata, rssFrameMCache, rssFrameInUseMCaches}},
- {m.MemoryClassesMetadataMCacheFree, []rssVirtualFrame{rssFrameGoMemory, rssFrameRuntime, rssFrameMetadata, rssFrameMCache, rssFrameFreeMCaches}},
- {m.MemoryClassesMetadataOther, []rssVirtualFrame{rssFrameGoMemory, rssFrameRuntime, rssFrameMetadata, rssFrameOtherMetadata}},
- {m.MemoryClassesProfilingBuckets, []rssVirtualFrame{rssFrameGoMemory, rssFrameRuntime, rssFrameProfilingBuckets}},
- {m.MemoryClassesOther, []rssVirtualFrame{rssFrameGoMemory, rssFrameRuntime, rssFrameOtherRuntime}},
+ {m.MemoryClassesHeapStacks, []procmemVirtualFrame{procmemFrameGoMemory, procmemFrameStacks, procmemFrameGoroutineStacks}},
+ {m.MemoryClassesOSStacks, []procmemVirtualFrame{procmemFrameGoMemory, procmemFrameStacks, procmemFrameOSStacks}},
+ {m.MemoryClassesMetadataMSpanInuse, []procmemVirtualFrame{procmemFrameGoMemory, procmemFrameRuntime, procmemFrameMetadata, procmemFrameMSpan, procmemFrameInUseMSpans}},
+ {m.MemoryClassesMetadataMSpanFree, []procmemVirtualFrame{procmemFrameGoMemory, procmemFrameRuntime, procmemFrameMetadata, procmemFrameMSpan, procmemFrameFreeMSpans}},
+ {m.MemoryClassesMetadataMCacheInuse, []procmemVirtualFrame{procmemFrameGoMemory, procmemFrameRuntime, procmemFrameMetadata, procmemFrameMCache, procmemFrameInUseMCaches}},
+ {m.MemoryClassesMetadataMCacheFree, []procmemVirtualFrame{procmemFrameGoMemory, procmemFrameRuntime, procmemFrameMetadata, procmemFrameMCache, procmemFrameFreeMCaches}},
+ {m.MemoryClassesMetadataOther, []procmemVirtualFrame{procmemFrameGoMemory, procmemFrameRuntime, procmemFrameMetadata, procmemFrameOtherMetadata}},
+ {m.MemoryClassesProfilingBuckets, []procmemVirtualFrame{procmemFrameGoMemory, procmemFrameRuntime, procmemFrameProfilingBuckets}},
+ {m.MemoryClassesOther, []procmemVirtualFrame{procmemFrameGoMemory, procmemFrameRuntime, procmemFrameOtherRuntime}},
}
for _, f := range fixed {
emitSample(int64(f.value), f.path, nil, 0)
}
- livePath := []rssVirtualFrame{rssFrameGoMemory, rssFrameHeap, rssFrameLiveHeap}
- deadPath := []rssVirtualFrame{rssFrameGoMemory, rssFrameHeap, rssFrameDeadHeap}
+ livePath := []procmemVirtualFrame{procmemFrameGoMemory, procmemFrameHeap, procmemFrameLiveHeap}
+ deadPath := []procmemVirtualFrame{procmemFrameGoMemory, procmemFrameHeap, procmemFrameDeadHeap}
goMemory := m.MemoryClassesTotal - m.MemoryClassesHeapReleased
heapLive := int64(m.HeapLive)
if heapLive == 0 {
@@ -204,8 +204,8 @@ func writeProcmemProto(w io.Writer, p []profilerecord.MemProfileRecord, rate int
emitSample(heapDead, deadPath, nil, 0)
}
- emitSample(int64(m.MemoryClassesHeapUnused), []rssVirtualFrame{rssFrameGoMemory, rssFrameHeap, rssFrameUnusedHeap}, nil, 0)
- emitSample(int64(m.MemoryClassesHeapFree), []rssVirtualFrame{rssFrameGoMemory, rssFrameHeap, rssFrameFreeHeap}, nil, 0)
+ emitSample(int64(m.MemoryClassesHeapUnused), []procmemVirtualFrame{procmemFrameGoMemory, procmemFrameHeap, procmemFrameUnusedHeap}, nil, 0)
+ emitSample(int64(m.MemoryClassesHeapFree), []procmemVirtualFrame{procmemFrameGoMemory, procmemFrameHeap, procmemFrameFreeHeap}, nil, 0)
// Distribute each heap total in proportion to the sampled weights.
// In words: The sampled values sum to W, and we want to scale them to
@@ -256,16 +256,16 @@ func writeProcmemProto(w io.Writer, p []profilerecord.MemProfileRecord, rate int
// mapped but that may not be resident, so the estimate can come
// out negative. As in the RSS < goMemory case below, we leave a
// comment rather than shrink measured values to fit RSS.
- emitSample(int64(m.RSSShared), []rssVirtualFrame{rssFrameNonGoMemory, rssFrameFileShared}, nil, 0)
+ emitSample(int64(m.RSSShared), []procmemVirtualFrame{procmemFrameNonGoMemory, procmemFrameFileShared}, nil, 0)
if anon := m.RSS - m.RSSShared; anon >= goMemory {
- emitSample(int64(anon-goMemory), []rssVirtualFrame{rssFrameNonGoMemory, rssFrameAnonymous}, nil, 0)
+ emitSample(int64(anon-goMemory), []procmemVirtualFrame{procmemFrameNonGoMemory, procmemFrameAnonymous}, nil, 0)
} else {
b.pb.int64(tagProfile_Comment, b.stringIndex(fmt.Sprintf("Some Go Memory is not resident: Go Memory (%d bytes) > Anonymous RSS (%d bytes). Anonymous Non-Go Memory not shown.", goMemory, anon)))
}
case m.RSS < goMemory:
b.pb.int64(tagProfile_Comment, b.stringIndex(fmt.Sprintf("Some Go Memory is not resident: Go Memory (%d bytes) > RSS (%d bytes). Non-Go Memory not shown.", goMemory, m.RSS)))
default:
- emitSample(int64(m.RSS-goMemory), []rssVirtualFrame{rssFrameNonGoMemory}, nil, 0)
+ emitSample(int64(m.RSS-goMemory), []procmemVirtualFrame{procmemFrameNonGoMemory}, nil, 0)
}
return b.build()
}
diff --git a/src/runtime/pprof/procmem_test.go b/src/runtime/pprof/procmem_test.go
index 761a297f1c..bdc60b41d1 100644
--- a/src/runtime/pprof/procmem_test.go
+++ b/src/runtime/pprof/procmem_test.go
@@ -94,30 +94,30 @@ func TestProcmemProfileStructure(t *testing.T) {
// Every traceback in the profile should have one of these prefixes
virtualPrefixes := []string{
- rssPath(rssFrameGoMemory, rssFrameStacks, rssFrameGoroutineStacks),
- rssPath(rssFrameGoMemory, rssFrameStacks, rssFrameOSStacks),
- rssPath(rssFrameGoMemory, rssFrameRuntime, rssFrameMetadata, rssFrameMSpan, rssFrameInUseMSpans),
- rssPath(rssFrameGoMemory, rssFrameRuntime, rssFrameMetadata, rssFrameMSpan, rssFrameFreeMSpans),
- rssPath(rssFrameGoMemory, rssFrameRuntime, rssFrameMetadata, rssFrameMCache, rssFrameInUseMCaches),
- rssPath(rssFrameGoMemory, rssFrameRuntime, rssFrameMetadata, rssFrameMCache, rssFrameFreeMCaches),
- rssPath(rssFrameGoMemory, rssFrameRuntime, rssFrameMetadata, rssFrameOtherMetadata),
- rssPath(rssFrameGoMemory, rssFrameRuntime, rssFrameProfilingBuckets),
- rssPath(rssFrameGoMemory, rssFrameRuntime, rssFrameOtherRuntime),
- rssPath(rssFrameGoMemory, rssFrameHeap, rssFrameLiveHeap),
- rssPath(rssFrameGoMemory, rssFrameHeap, rssFrameDeadHeap),
- rssPath(rssFrameGoMemory, rssFrameHeap, rssFrameUnusedHeap),
- rssPath(rssFrameGoMemory, rssFrameHeap, rssFrameFreeHeap),
+ procmemPath(procmemFrameGoMemory, procmemFrameStacks, procmemFrameGoroutineStacks),
+ procmemPath(procmemFrameGoMemory, procmemFrameStacks, procmemFrameOSStacks),
+ procmemPath(procmemFrameGoMemory, procmemFrameRuntime, procmemFrameMetadata, procmemFrameMSpan, procmemFrameInUseMSpans),
+ procmemPath(procmemFrameGoMemory, procmemFrameRuntime, procmemFrameMetadata, procmemFrameMSpan, procmemFrameFreeMSpans),
+ procmemPath(procmemFrameGoMemory, procmemFrameRuntime, procmemFrameMetadata, procmemFrameMCache, procmemFrameInUseMCaches),
+ procmemPath(procmemFrameGoMemory, procmemFrameRuntime, procmemFrameMetadata, procmemFrameMCache, procmemFrameFreeMCaches),
+ procmemPath(procmemFrameGoMemory, procmemFrameRuntime, procmemFrameMetadata, procmemFrameOtherMetadata),
+ procmemPath(procmemFrameGoMemory, procmemFrameRuntime, procmemFrameProfilingBuckets),
+ procmemPath(procmemFrameGoMemory, procmemFrameRuntime, procmemFrameOtherRuntime),
+ procmemPath(procmemFrameGoMemory, procmemFrameHeap, procmemFrameLiveHeap),
+ procmemPath(procmemFrameGoMemory, procmemFrameHeap, procmemFrameDeadHeap),
+ procmemPath(procmemFrameGoMemory, procmemFrameHeap, procmemFrameUnusedHeap),
+ procmemPath(procmemFrameGoMemory, procmemFrameHeap, procmemFrameFreeHeap),
}
if runtime.GOOS == "linux" {
virtualPrefixes = append(virtualPrefixes,
- rssPath(rssFrameNonGoMemory, rssFrameFileShared),
- rssPath(rssFrameNonGoMemory, rssFrameAnonymous))
+ procmemPath(procmemFrameNonGoMemory, procmemFrameFileShared),
+ procmemPath(procmemFrameNonGoMemory, procmemFrameAnonymous))
} else {
- virtualPrefixes = append(virtualPrefixes, rssPath(rssFrameNonGoMemory))
+ virtualPrefixes = append(virtualPrefixes, procmemPath(procmemFrameNonGoMemory))
}
- livePrefix := rssPath(rssFrameGoMemory, rssFrameHeap, rssFrameLiveHeap)
- deadPrefix := rssPath(rssFrameGoMemory, rssFrameHeap, rssFrameDeadHeap)
+ livePrefix := procmemPath(procmemFrameGoMemory, procmemFrameHeap, procmemFrameLiveHeap)
+ deadPrefix := procmemPath(procmemFrameGoMemory, procmemFrameHeap, procmemFrameDeadHeap)
seenPrefixes := make(map[string]bool)
var goMemory, heap int64
for _, s := range p.Sample {
@@ -160,10 +160,10 @@ func TestProcmemProfileStructure(t *testing.T) {
}
break
}
- if strings.HasPrefix(prefix, rssPath(rssFrameGoMemory)) {
+ if strings.HasPrefix(prefix, procmemPath(procmemFrameGoMemory)) {
goMemory += s.Value[0]
}
- if strings.HasPrefix(prefix, rssPath(rssFrameGoMemory, rssFrameHeap)) {
+ if strings.HasPrefix(prefix, procmemPath(procmemFrameGoMemory, procmemFrameHeap)) {
heap += s.Value[0]
}
}
@@ -182,23 +182,23 @@ func TestProcmemProfileStructure(t *testing.T) {
}
}
-const rssProfileCycleAllocationSize = 50 << 20
+const procmemProfileCycleAllocationSize = 50 << 20
-var rssProfileCycleSink []byte
+var procmemProfileCycleSink []byte
//go:noinline
-func allocateRSSProfileLive() []byte {
- return make([]byte, rssProfileCycleAllocationSize)
+func allocateProcmemProfileLive() []byte {
+ return make([]byte, procmemProfileCycleAllocationSize)
}
//go:noinline
-func allocateRSSProfileStale() {
- rssProfileCycleSink = make([]byte, rssProfileCycleAllocationSize)
+func allocateProcmemProfileStale() {
+ procmemProfileCycleSink = make([]byte, procmemProfileCycleAllocationSize)
}
//go:noinline
-func allocateRSSProfileLatest() {
- rssProfileCycleSink = make([]byte, rssProfileCycleAllocationSize)
+func allocateProcmemProfileLatest() {
+ procmemProfileCycleSink = make([]byte, procmemProfileCycleAllocationSize)
}
func TestProcmemProfileHeapSamples(t *testing.T) {
@@ -211,24 +211,24 @@ func TestProcmemProfileHeapSamples(t *testing.T) {
defer func() { runtime.MemProfileRate = oldRate }()
// Keep a live allocation through the profile snapshot.
- live := allocateRSSProfileLive()
+ live := allocateProcmemProfileLive()
runtime.GC()
// The procmem profile should show the state of the heap as of the latest
// complete garbage collection, so we shouldn't see these.
for range 3 {
- allocateRSSProfileStale()
- rssProfileCycleSink = nil
+ allocateProcmemProfileStale()
+ procmemProfileCycleSink = nil
runtime.GC()
}
- allocateRSSProfileLatest()
- rssProfileCycleSink = nil
+ allocateProcmemProfileLatest()
+ procmemProfileCycleSink = nil
runtime.GC()
- const liveName = "runtime/pprof.allocateRSSProfileLive"
- const stale = "runtime/pprof.allocateRSSProfileStale"
- const latest = "runtime/pprof.allocateRSSProfileLatest"
+ const liveName = "runtime/pprof.allocateProcmemProfileLive"
+ const stale = "runtime/pprof.allocateProcmemProfileStale"
+ const latest = "runtime/pprof.allocateProcmemProfileLatest"
checkProfile := func(wantDead bool) {
t.Helper()
var buf bytes.Buffer
@@ -243,20 +243,20 @@ func TestProcmemProfileHeapSamples(t *testing.T) {
var liveSpace, staleDead, latestDead int64
for _, sample := range p.Sample {
- if rssSampleHasFrame(sample, string(rssFrameLiveHeap)) && rssSampleHasFrame(sample, liveName) {
+ if procmemSampleHasFrame(sample, string(procmemFrameLiveHeap)) && procmemSampleHasFrame(sample, liveName) {
liveSpace += sample.Value[0]
}
- if rssSampleHasFrame(sample, string(rssFrameDeadHeap)) {
- if rssSampleHasFrame(sample, stale) {
+ if procmemSampleHasFrame(sample, string(procmemFrameDeadHeap)) {
+ if procmemSampleHasFrame(sample, stale) {
staleDead += sample.Value[0]
}
- if rssSampleHasFrame(sample, latest) {
+ if procmemSampleHasFrame(sample, latest) {
latestDead += sample.Value[0]
}
}
}
if liveSpace == 0 {
- t.Error("no [Live Heap] space attributed to allocateRSSProfileLive")
+ t.Error("no [Live Heap] space attributed to allocateProcmemProfileLive")
}
if staleDead != 0 {
t.Errorf("[Dead Heap] space attributed to allocations freed in earlier GC cycles = %d, want 0", staleDead)
@@ -335,7 +335,7 @@ func TestProcmemProfileRuntimeLeafFrames(t *testing.T) {
}
}
-func rssSampleHasFrame(sample *profile.Sample, name string) bool {
+func procmemSampleHasFrame(sample *profile.Sample, name string) bool {
for _, loc := range sample.Location {
for _, line := range loc.Line {
if line.Function.Name == name {
@@ -355,9 +355,9 @@ func TestProcmemProfileNonGoBreakdown(t *testing.T) {
MemoryClassesOther: 40,
MemoryClassesTotal: 100,
}
- fileShared := rssPath(rssFrameNonGoMemory, rssFrameFileShared)
- anonymous := rssPath(rssFrameNonGoMemory, rssFrameAnonymous)
- nonGo := rssPath(rssFrameNonGoMemory)
+ fileShared := procmemPath(procmemFrameNonGoMemory, procmemFrameFileShared)
+ anonymous := procmemPath(procmemFrameNonGoMemory, procmemFrameAnonymous)
+ nonGo := procmemPath(procmemFrameNonGoMemory)
for _, tc := range []struct {
name string
@@ -433,7 +433,7 @@ func TestProcmemProfileNonGoBreakdown(t *testing.T) {
}
}
-func rssPath(frames ...rssVirtualFrame) string {
+func procmemPath(frames ...procmemVirtualFrame) string {
parts := make([]string, len(frames))
for i, f := range frames {
parts[i] = string(f)