diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2012-02-09 08:19:58 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2012-02-09 08:19:58 +0000 |
commit | 94252f4bcc0a3f487b804ce535cb77b8bef4db83 (patch) | |
tree | 7ca86535c5a6b99d4cc432ba5cfddabc5ee4ea16 /libgo/go/runtime/mem.go | |
parent | cd6368115dbd75d9187877097c48a0d8d4c04fd4 (diff) | |
download | gcc-94252f4bcc0a3f487b804ce535cb77b8bef4db83.tar.gz |
libgo: Update to weekly.2012-02-07.
From-SVN: r184034
Diffstat (limited to 'libgo/go/runtime/mem.go')
-rw-r--r-- | libgo/go/runtime/mem.go | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/libgo/go/runtime/mem.go b/libgo/go/runtime/mem.go index 3f213062910..1301674c027 100644 --- a/libgo/go/runtime/mem.go +++ b/libgo/go/runtime/mem.go @@ -6,9 +6,9 @@ package runtime import "unsafe" -type MemStatsType struct { +// A MemStats records statistics about the memory allocator. +type MemStats struct { // General statistics. - // Not locked during update; approximate. Alloc uint64 // bytes allocated and still in use TotalAlloc uint64 // bytes allocated (even if freed) Sys uint64 // bytes obtained from system (should be sum of XxxSys below) @@ -43,7 +43,6 @@ type MemStatsType struct { DebugGC bool // Per-size allocation statistics. - // Not locked during update; approximate. // 61 is NumSizeClasses in the C code. BySize [61]struct { Size uint32 @@ -54,21 +53,17 @@ type MemStatsType struct { var Sizeof_C_MStats uintptr // filled in by malloc.goc +var VmemStats MemStats + func init() { - if Sizeof_C_MStats != unsafe.Sizeof(MemStats) { - println(Sizeof_C_MStats, unsafe.Sizeof(MemStats)) + if Sizeof_C_MStats != unsafe.Sizeof(VmemStats) { + println(Sizeof_C_MStats, unsafe.Sizeof(VmemStats)) panic("MStats vs MemStatsType size mismatch") } } -// MemStats holds statistics about the memory system. -// The statistics may be out of date, as the information is -// updated lazily from per-thread caches. -// Use UpdateMemStats to bring the statistics up to date. -var MemStats MemStatsType - -// UpdateMemStats brings MemStats up to date. -func UpdateMemStats() +// ReadMemStats populates m with memory allocator statistics. +func ReadMemStats(m *MemStats) // GC runs a garbage collection. func GC() |