Commit ed7db89b authored by Dmitriy Vyukov's avatar Dmitriy Vyukov

runtime: output number of goroutines in GC trace

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
parent a2910958
...@@ -1401,11 +1401,13 @@ gc(struct gc_args *args) ...@@ -1401,11 +1401,13 @@ gc(struct gc_args *args)
stats.nsleep += work.markfor->nsleep; stats.nsleep += work.markfor->nsleep;
runtime·printf("gc%d(%d): %D+%D+%D+%D us, %D -> %D MB, %D (%D-%D) objects," 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/%d sweeps,"
" %D(%D) handoff, %D(%D) steal, %D/%D/%D yields\n", " %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, mstats.numgc, work.nproc, (t1-t0)/1000, (t2-t1)/1000, (t3-t2)/1000, (t4-t3)/1000,
heap0>>20, heap1>>20, obj, heap0>>20, heap1>>20, obj,
mstats.nmalloc, mstats.nfree, mstats.nmalloc, mstats.nfree,
runtime·gcount(),
work.nspan, runtime·sweep.nbgsweep, runtime·sweep.npausesweep, work.nspan, runtime·sweep.nbgsweep, runtime·sweep.npausesweep,
stats.nhandoff, stats.nhandoffcnt, stats.nhandoff, stats.nhandoffcnt,
work.markfor->nsteal, work.markfor->nstealcnt, work.markfor->nsteal, work.markfor->nstealcnt,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment