aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/runtime/malloc.h
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2010-03-23 20:48:23 -0700
committerRuss Cox <rsc@golang.org>2010-03-23 20:48:23 -0700
commit596c16e0458060aec0c81cccaef3070a1d6daf81 (patch)
treeee543d5e212770ff8586f549e40803c644327594 /src/pkg/runtime/malloc.h
parent72bc37c1220088994649bb032316a42d2cd8ece7 (diff)
downloadgo-596c16e0458060aec0c81cccaef3070a1d6daf81.tar.xz
runtime: add memory profiling, disabled.
no way to get the data out yet. add prototype for runtime.Callers, missing from last CL. R=r CC=golang-dev https://golang.org/cl/713041
Diffstat (limited to 'src/pkg/runtime/malloc.h')
-rw-r--r--src/pkg/runtime/malloc.h18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/pkg/runtime/malloc.h b/src/pkg/runtime/malloc.h
index ae6b70b141..67e7d42eb1 100644
--- a/src/pkg/runtime/malloc.h
+++ b/src/pkg/runtime/malloc.h
@@ -227,6 +227,7 @@ struct MCache
MCacheList list[NumSizeClasses];
uint64 size;
int64 local_alloc; // bytes allocated (or freed) since last lock of heap
+ int32 next_sample; // trigger heap sample after allocating this many bytes
};
void* MCache_Alloc(MCache *c, int32 sizeclass, uintptr size, int32 zeroed);
@@ -321,7 +322,7 @@ MSpan* MHeap_Lookup(MHeap *h, PageID p);
MSpan* MHeap_LookupMaybe(MHeap *h, PageID p);
void MGetSizeClassInfo(int32 sizeclass, int32 *size, int32 *npages, int32 *nobj);
-void* mallocgc(uintptr size, uint32 flag, int32 dogc, int32 zeroed);
+void* mallocgc(uintptr size, uint32 flag, int32 dogc, int32 zeroed, int32 skip_depth);
int32 mlookup(void *v, byte **base, uintptr *size, MSpan **s, uint32 **ref);
void gc(int32 force);
@@ -342,4 +343,19 @@ enum
RefFinalize, // ready to be finalized
RefNoPointers = 0x80000000U, // flag - no pointers here
RefHasFinalizer = 0x40000000U, // flag - has finalizer
+ RefProfiled = 0x20000000U, // flag - is in profiling table
+ RefNoProfiling = 0x10000000U, // flag - must not profile
+ RefFlags = 0xFFFF0000U,
};
+
+void MProf_Malloc(int32, void*, uintptr);
+void MProf_Free(void*, uintptr);
+
+// Malloc profiling settings.
+// Must match definition in extern.go.
+enum {
+ MProf_None = 0,
+ MProf_Sample = 1,
+ MProf_All = 2,
+};
+extern int32 malloc_profile;