diff options
| author | Russ Cox <rsc@golang.org> | 2010-03-29 13:06:26 -0700 |
|---|---|---|
| committer | Russ Cox <rsc@golang.org> | 2010-03-29 13:06:26 -0700 |
| commit | 3e6f4ce5aa0e07a8f1c7644b5ba0ff39109b8eba (patch) | |
| tree | 40d39bf8a417fec879597482abd81def99b712aa /src/pkg/runtime/malloc.cgo | |
| parent | 248f40a7171a458ff13c524fea0f05e6854748ec (diff) | |
| download | golang-3e6f4ce5aa0e07a8f1c7644b5ba0ff39109b8eba.tar.gz | |
runtime: more malloc statistics
expvar: default publishings for cmdline, memstats
godoc: import expvar
R=r
CC=golang-dev
http://codereview.appspot.com/815041
Diffstat (limited to 'src/pkg/runtime/malloc.cgo')
| -rw-r--r-- | src/pkg/runtime/malloc.cgo | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/pkg/runtime/malloc.cgo b/src/pkg/runtime/malloc.cgo index fed8e037c..2e7818a39 100644 --- a/src/pkg/runtime/malloc.cgo +++ b/src/pkg/runtime/malloc.cgo @@ -234,7 +234,12 @@ mlookup(void *v, byte **base, uintptr *size, MSpan **sp, uint32 **ref) MCache* allocmcache(void) { - return FixAlloc_Alloc(&mheap.cachealloc); + MCache *c; + + c = FixAlloc_Alloc(&mheap.cachealloc); + mstats.mcache_inuse = mheap.cachealloc.inuse; + mstats.mcache_sys = mheap.cachealloc.sys; + return c; } void @@ -289,6 +294,8 @@ stackalloc(uint32 n) throw("stackalloc"); } v = FixAlloc_Alloc(&stacks); + mstats.stacks_inuse = stacks.inuse; + mstats.stacks_sys = stacks.sys; unlock(&stacks); return v; } @@ -305,6 +312,8 @@ stackfree(void *v) if(m->mallocing || m->gcing) { lock(&stacks); FixAlloc_Free(&stacks, v); + mstats.stacks_inuse = stacks.inuse; + mstats.stacks_sys = stacks.sys; unlock(&stacks); return; } |
