mirror of https://github.com/sbt/sbt.git
fix: Improve GCMonitor warning message clarity
Add 'seconds' unit to GC time and clarify that the percentage represents cumulative GC pause time across all collectors. Fixes #8002
This commit is contained in:
parent
ba43e99b93
commit
1b2bc53bcf
|
|
@ -62,8 +62,10 @@ class GCMonitor(logger: Logger) extends GCMonitorBase with AutoCloseable {
|
|||
|
||||
override protected def emitWarning(total: Long, over: Option[Long]): Unit = {
|
||||
val totalSeconds = total / 1000.0
|
||||
val amountMsg = over.fold(s"$totalSeconds seconds") { d =>
|
||||
"In the last " + (d / 1000.0).ceil.toInt + f" seconds, $totalSeconds (${total.toDouble / d * 100}%.1f%%)"
|
||||
val amountMsg = over.fold(f"$totalSeconds%.3f seconds") { d =>
|
||||
val dSeconds = (d / 1000.0).ceil.toInt
|
||||
val percentage = total.toDouble / d * 100
|
||||
f"In the last $dSeconds seconds, $totalSeconds%.3f seconds ($percentage%.1f%%) of GC pause"
|
||||
}
|
||||
val msg = s"$amountMsg were spent in GC. " +
|
||||
s"[Heap: ${gbString(runtime.freeMemory())} free " +
|
||||
|
|
|
|||
Loading…
Reference in New Issue