diff options
Diffstat (limited to 'src/runtime/export_test.go')
-rw-r--r-- | src/runtime/export_test.go | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/runtime/export_test.go b/src/runtime/export_test.go index 5400c1d14e..438090842f 100644 --- a/src/runtime/export_test.go +++ b/src/runtime/export_test.go @@ -171,3 +171,19 @@ func SetTracebackEnv(level string) { setTraceback(level) traceback_env = traceback_cache } + +func CountPagesInUse() (pagesInUse, counted uintptr) { + stopTheWorld("CountPagesInUse") + + pagesInUse = uintptr(mheap_.pagesInUse) + + for _, s := range h_allspans { + if s.state == mSpanInUse { + counted += s.npages + } + } + + startTheWorld() + + return +} |