fix: Use 'CPU seconds' to clarify GC time can exceed wall clock

Address review feedback from eed3si9n to make it clearer that GC time
is cumulative CPU time across parallel collectors, which is why it can
exceed wall clock time.

Fixes #8002
This commit is contained in:
mkdev11
2026-01-10 22:23:05 +02:00
parent 1b2bc53bcf
commit 9be376973d
@@ -62,10 +62,10 @@ class GCMonitor(logger: Logger) extends GCMonitorBase with AutoCloseable {
override protected def emitWarning(total: Long, over: Option[Long]): Unit = { override protected def emitWarning(total: Long, over: Option[Long]): Unit = {
val totalSeconds = total / 1000.0 val totalSeconds = total / 1000.0
val amountMsg = over.fold(f"$totalSeconds%.3f seconds") { d => val amountMsg = over.fold(f"$totalSeconds%.3f CPU seconds") { d =>
val dSeconds = (d / 1000.0).ceil.toInt val dSeconds = (d / 1000.0).ceil.toInt
val percentage = total.toDouble / d * 100 val percentage = total.toDouble / d * 100
f"In the last $dSeconds seconds, $totalSeconds%.3f seconds ($percentage%.1f%%) of GC pause" f"In the last $dSeconds seconds, $totalSeconds%.3f CPU seconds ($percentage%.1f%%) of GC pause"
} }
val msg = s"$amountMsg were spent in GC. " + val msg = s"$amountMsg were spent in GC. " +
s"[Heap: ${gbString(runtime.freeMemory())} free " + s"[Heap: ${gbString(runtime.freeMemory())} free " +