]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: output number of goroutines in GC trace
authorDmitriy Vyukov <dvyukov@google.com>
Thu, 18 Sep 2014 03:38:50 +0000 (20:38 -0700)
committerDmitriy Vyukov <dvyukov@google.com>
Thu, 18 Sep 2014 03:38:50 +0000 (20:38 -0700)
Example output:
gc26(1): 1+0+1038+0 us, 0 -> 1 MB, 19074 (88777-69703) objects, 5 gs, 184/0/0 sweeps, 0(0) handoff, 0(0) steal, 0/0/0 yields
It's useful to understand long scan times,
because goroutine traceback is slow.

LGTM=khr
R=golang-codereviews, khr
CC=golang-codereviews, rsc
https://golang.org/cl/136310044

src/runtime/mgc0.c

index 4e901726f65db69a99dd215695f27b5d923b358f..88c8d0f3c993430e120518bdf900f60491083ee1 100644 (file)
@@ -1401,11 +1401,13 @@ gc(struct gc_args *args)
                stats.nsleep += work.markfor->nsleep;
 
                runtime·printf("gc%d(%d): %D+%D+%D+%D us, %D -> %D MB, %D (%D-%D) objects,"
+                               " %d goroutines,"
                                " %d/%d/%d sweeps,"
                                " %D(%D) handoff, %D(%D) steal, %D/%D/%D yields\n",
                        mstats.numgc, work.nproc, (t1-t0)/1000, (t2-t1)/1000, (t3-t2)/1000, (t4-t3)/1000,
                        heap0>>20, heap1>>20, obj,
                        mstats.nmalloc, mstats.nfree,
+                       runtime·gcount(),
                        work.nspan, runtime·sweep.nbgsweep, runtime·sweep.npausesweep,
                        stats.nhandoff, stats.nhandoffcnt,
                        work.markfor->nsteal, work.markfor->nstealcnt,