Commit a7186dc3 authored by Dmitriy Vyukov's avatar Dmitriy Vyukov

runtime: improve scheduler trace

Output number of spinning threads,
this is useful to understanding whether the scheduler
is in a steady state or not.

R=golang-codereviews, khr
CC=golang-codereviews, rsc
https://golang.org/cl/103540045
parent 548dece8
...@@ -2730,12 +2730,12 @@ runtime·schedtrace(bool detailed) ...@@ -2730,12 +2730,12 @@ runtime·schedtrace(bool detailed)
starttime = now; starttime = now;
runtime·lock(&runtime·sched); runtime·lock(&runtime·sched);
runtime·printf("SCHED %Dms: gomaxprocs=%d idleprocs=%d threads=%d idlethreads=%d runqueue=%d", runtime·printf("SCHED %Dms: gomaxprocs=%d idleprocs=%d threads=%d spinningthreads=%d idlethreads=%d runqueue=%d",
(now-starttime)/1000000, runtime·gomaxprocs, runtime·sched.npidle, runtime·sched.mcount, (now-starttime)/1000000, runtime·gomaxprocs, runtime·sched.npidle, runtime·sched.mcount,
runtime·sched.nmidle, runtime·sched.runqsize); runtime·sched.nmspinning, runtime·sched.nmidle, runtime·sched.runqsize);
if(detailed) { if(detailed) {
runtime·printf(" gcwaiting=%d nmidlelocked=%d nmspinning=%d stopwait=%d sysmonwait=%d\n", runtime·printf(" gcwaiting=%d nmidlelocked=%d stopwait=%d sysmonwait=%d\n",
runtime·sched.gcwaiting, runtime·sched.nmidlelocked, runtime·sched.nmspinning, runtime·sched.gcwaiting, runtime·sched.nmidlelocked,
runtime·sched.stopwait, runtime·sched.sysmonwait); runtime·sched.stopwait, runtime·sched.sysmonwait);
} }
// We must be careful while reading data from P's, M's and G's. // We must be careful while reading data from P's, M's and G's.
......
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