diff options
| author | Michael Anthony Knyszek <mknyszek@google.com> | 2025-03-04 19:02:48 +0000 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2025-04-23 08:00:33 -0700 |
| commit | 528bafa0498bb26a3b3961fa5bf50d02bd7101bb (patch) | |
| tree | eb72406f4a0ce690d368b2377e2df031457775ca /src/runtime/export_test.go | |
| parent | ecdd429a3be7abde6e169b79da13bffdba064cb4 (diff) | |
| download | go-528bafa0498bb26a3b3961fa5bf50d02bd7101bb.tar.xz | |
runtime: move sizeclass defs to new package internal/runtime/gc
We will want to reference these definitions from new generator programs,
and this is a good opportunity to cleanup all these old C-style names.
Change-Id: Ifb06f0afc381e2697e7877f038eca786610c96de
Reviewed-on: https://go-review.googlesource.com/c/go/+/655275
Auto-Submit: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Diffstat (limited to 'src/runtime/export_test.go')
| -rw-r--r-- | src/runtime/export_test.go | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/runtime/export_test.go b/src/runtime/export_test.go index 8da4ece881..572f62c2f9 100644 --- a/src/runtime/export_test.go +++ b/src/runtime/export_test.go @@ -11,6 +11,7 @@ import ( "internal/goarch" "internal/goos" "internal/runtime/atomic" + "internal/runtime/gc" "internal/runtime/sys" "unsafe" ) @@ -363,7 +364,7 @@ func ReadMemStatsSlow() (base, slow MemStats) { slow.Mallocs = 0 slow.Frees = 0 slow.HeapReleased = 0 - var bySize [_NumSizeClasses]struct { + var bySize [gc.NumSizeClasses]struct { Mallocs, Frees uint64 } @@ -391,11 +392,11 @@ func ReadMemStatsSlow() (base, slow MemStats) { // Collect per-sizeclass free stats. var smallFree uint64 - for i := 0; i < _NumSizeClasses; i++ { + for i := 0; i < gc.NumSizeClasses; i++ { slow.Frees += m.smallFreeCount[i] bySize[i].Frees += m.smallFreeCount[i] bySize[i].Mallocs += m.smallFreeCount[i] - smallFree += m.smallFreeCount[i] * uint64(class_to_size[i]) + smallFree += m.smallFreeCount[i] * uint64(gc.SizeClassToSize[i]) } slow.Frees += m.tinyAllocCount + m.largeFreeCount slow.Mallocs += slow.Frees |
