]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: update docs for MemStats.PauseNs
authorShenghou Ma <minux.ma@gmail.com>
Sun, 21 Oct 2012 17:08:13 +0000 (01:08 +0800)
committerShenghou Ma <minux.ma@gmail.com>
Sun, 21 Oct 2012 17:08:13 +0000 (01:08 +0800)
   PauseNs is a circular buffer of recent pause times, and the
most recent one is at [((NumGC-1)+256)%256].

   Also fix comments cross-linking the Go and C definition of
various structs.

R=golang-dev, rsc, bradfitz
CC=golang-dev
https://golang.org/cl/6657047

src/pkg/runtime/malloc.goc
src/pkg/runtime/malloc.h
src/pkg/runtime/mem.go
src/pkg/runtime/mprof.goc

index 9b74b1040e91420799896c5d05e21dfe85a4ea55..7507eb52d0112c6496aed3a220dc4a5afba898fa 100644 (file)
@@ -19,7 +19,7 @@ package runtime
 #pragma dataflag 16 /* mark mheap as 'no pointers', hiding from garbage collector */
 MHeap runtime·mheap;
 
-extern MStats mstats;  // defined in extern.go
+extern MStats mstats;  // defined in zruntime_def_$GOOS_$GOARCH.go
 
 extern volatile intgo runtime·MemProfileRate;
 
index f2e0c8b9ab1afebab769b0b4d6d3cf93483b43ff..3e696d066d3734749b0884a296bc29e1dd0806b5 100644 (file)
@@ -198,7 +198,7 @@ void        runtime·FixAlloc_Free(FixAlloc *f, void *p);
 
 
 // Statistics.
-// Shared with Go: if you edit this structure, also edit extern.go.
+// Shared with Go: if you edit this structure, also edit type MemStats in mem.go.
 struct MStats
 {
        // General statistics.
index 76680086cd471925690b6c77a8cc203afc9169ff..c943b7a2d2cfef705fd9b8d75d4f645f9499321f 100644 (file)
@@ -6,6 +6,9 @@ package runtime
 
 import "unsafe"
 
+// Note: the MemStats struct should be kept in sync with 
+// struct MStats in malloc.h
+
 // A MemStats records statistics about the memory allocator.
 type MemStats struct {
        // General statistics.
@@ -39,7 +42,7 @@ type MemStats struct {
        NextGC       uint64 // next run in HeapAlloc time (bytes)
        LastGC       uint64 // last run in absolute time (ns)
        PauseTotalNs uint64
-       PauseNs      [256]uint64 // most recent GC pause times
+       PauseNs      [256]uint64 // circular buffer of recent GC pause times, most recent at [(NumGC+255)%256]
        NumGC        uint32
        EnableGC     bool
        DebugGC      bool
index 89308076df69f788b0a9fd514da8b6d8f52cd1f9..893ff3032e6565219aed69756082cce3c6f821b2 100644 (file)
@@ -307,8 +307,7 @@ runtime·blockevent(int64 cycles, int32 skip)
        runtime·unlock(&proflock);
 }
 
-// Go interface to profile data.  (Declared in extern.go)
-// Assumes Go sizeof(int) == sizeof(int32)
+// Go interface to profile data.  (Declared in debug.go)
 
 // Must match MemProfileRecord in debug.go.
 typedef struct Record Record;