]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: remove unused gcstats
authorAustin Clements <austin@google.com>
Fri, 23 Dec 2016 00:45:55 +0000 (17:45 -0700)
committerAustin Clements <austin@google.com>
Sat, 4 Mar 2017 02:56:35 +0000 (02:56 +0000)
The gcstats structure is no longer consumed by anything and no longer
tracks statistics that are particularly relevant to the concurrent
garbage collector. Remove it. (Having statistics is probably a good
idea, but these aren't the stats we need these days and we don't have
a way to get them out of the runtime.)

In preparation for #13613.

Change-Id: Ib63e2f9067850668f9dcbfd4ed89aab4a6622c3f
Reviewed-on: https://go-review.googlesource.com/34936
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Rick Hudson <rlh@golang.org>
src/runtime/heapdump.go
src/runtime/mgcwork.go
src/runtime/mstats.go
src/runtime/runtime2.go

index 780aeb5b681d97c054f26f21583cf30b6d8970d3..32e393db2bd20e94fcd6dc2f44126348ccc4bfa3 100644 (file)
@@ -653,7 +653,7 @@ func writeheapdump_m(fd uintptr) {
        // Update stats so we can dump them.
        // As a side effect, flushes all the MCaches so the MSpan.freelist
        // lists contain all the free objects.
-       updatememstats(nil)
+       updatememstats()
 
        // Set dump file.
        dumpfd = fd
index ef2453039f4f8e799039e7c4d007350964f3b270..6b0c4dccaa186ee0377d92eae183f022419763c7 100644 (file)
@@ -397,15 +397,11 @@ func getfull() *workbuf {
                if work.nwait == work.nproc && work.markrootNext >= work.markrootJobs {
                        return nil
                }
-               _g_ := getg()
                if i < 10 {
-                       _g_.m.gcstats.nprocyield++
                        procyield(20)
                } else if i < 20 {
-                       _g_.m.gcstats.nosyield++
                        osyield()
                } else {
-                       _g_.m.gcstats.nsleep++
                        usleep(100)
                }
        }
@@ -419,9 +415,6 @@ func handoff(b *workbuf) *workbuf {
        b.nobj -= n
        b1.nobj = n
        memmove(unsafe.Pointer(&b1.obj[0]), unsafe.Pointer(&b.obj[b.nobj]), uintptr(n)*unsafe.Sizeof(b1.obj[0]))
-       _g_ := getg()
-       _g_.m.gcstats.nhandoff++
-       _g_.m.gcstats.nhandoffcnt += uint64(n)
 
        // Put b on full list - let first half of b get stolen.
        putfull(b)
index 8fb34f724fd90cd15114777ebfa7d6fa3ab8c221..b34bbf9a67fa69996a697b6f9c5ecff7d8798c25 100644 (file)
@@ -452,7 +452,7 @@ func ReadMemStats(m *MemStats) {
 }
 
 func readmemstats_m(stats *MemStats) {
-       updatememstats(nil)
+       updatememstats()
 
        // The size of the trailing by_size array differs between
        // mstats and MemStats. NumSizeClasses was changed, but we
@@ -506,21 +506,7 @@ func readGCStats_m(pauses *[]uint64) {
 }
 
 //go:nowritebarrier
-func updatememstats(stats *gcstats) {
-       if stats != nil {
-               *stats = gcstats{}
-       }
-       for mp := allm; mp != nil; mp = mp.alllink {
-               if stats != nil {
-                       src := (*[unsafe.Sizeof(gcstats{}) / 8]uint64)(unsafe.Pointer(&mp.gcstats))
-                       dst := (*[unsafe.Sizeof(gcstats{}) / 8]uint64)(unsafe.Pointer(stats))
-                       for i, v := range src {
-                               dst[i] += v
-                       }
-                       mp.gcstats = gcstats{}
-               }
-       }
-
+func updatememstats() {
        memstats.mcache_inuse = uint64(mheap_.cachealloc.inuse)
        memstats.mspan_inuse = uint64(mheap_.spanalloc.inuse)
        memstats.sys = memstats.heap_sys + memstats.stacks_sys + memstats.mspan_sys +
index 5c05c20d940462a8d0402f33696a67373545ed56..7c1591994efefa82ab58aa21e1e879228bf5641f 100644 (file)
@@ -292,16 +292,6 @@ type sudog struct {
        c           *hchan // channel
 }
 
-type gcstats struct {
-       // the struct must consist of only uint64's,
-       // because it is casted to uint64[].
-       nhandoff    uint64
-       nhandoffcnt uint64
-       nprocyield  uint64
-       nosyield    uint64
-       nsleep      uint64
-}
-
 type libcall struct {
        fn   uintptr
        n    uintptr // number of parameters
@@ -436,7 +426,6 @@ type m struct {
        fflag         uint32      // floating point compare flags
        locked        uint32      // tracking for lockosthread
        nextwaitm     uintptr     // next m waiting for lock
-       gcstats       gcstats
        needextram    bool
        traceback     uint8
        waitunlockf   unsafe.Pointer // todo go func(*g, unsafe.pointer) bool