From: Nicolas Hillegeer Date: Thu, 12 Dec 2024 16:49:03 +0000 (-0800) Subject: runtime: print pp.schedtick in scheddetail even when !detailed X-Git-Tag: go1.25rc1~1001 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=5295722238446f09197adb2c5a8ba27fe1076973;p=gostls13.git runtime: print pp.schedtick in scheddetail even when !detailed Provides, on one line, an approximation of P scheduling throughput: how many times execute() was called for a given P. Said another way: how many RUNNABLE to RUNNING transitions have happened for this P. This allows discerning whether a P actually did anything, and how it compares to other periods of a processes operation. This should be useful to analyze (kernel) scheduler hiccups. Investigators will want to subtract the tick values from subsequent schedtrace lines to get a rate of schedulings. I've opted to add a space around the first and last element as well to make it more uniform to do the proposed subtracting with tools like AWK. Change-Id: I69d6dae1509ad285d43799f38bcaa3aa0fb2352e Reviewed-on: https://go-review.googlesource.com/c/go/+/635636 Reviewed-by: Michael Pratt LUCI-TryBot-Result: Go LUCI Auto-Submit: Nicolas Hillegeer --- diff --git a/src/runtime/proc.go b/src/runtime/proc.go index c9d04edd07..98e135ff2a 100644 --- a/src/runtime/proc.go +++ b/src/runtime/proc.go @@ -6404,18 +6404,28 @@ func schedtrace(detailed bool) { print(" runqsize=", t-h, " gfreecnt=", pp.gFree.n, " timerslen=", len(pp.timers.heap), "\n") } else { // In non-detailed mode format lengths of per-P run queues as: - // [len1 len2 len3 len4] + // [ len1 len2 len3 len4 ] print(" ") if i == 0 { - print("[") + print("[ ") } print(t - h) if i == len(allp)-1 { - print("]\n") + print(" ]") } } } + if !detailed { + // Format per-P schedticks as: schedticks=[ tick1 tick2 tick3 tick4 ]. + print(" schedticks=[ ") + for _, pp := range allp { + print(pp.schedtick) + print(" ") + } + print("]\n") + } + if !detailed { unlock(&sched.lock) return