@@ -53,11 +53,7 @@ final class DebugStats {
5353 sb.append(formatTimeLine(" materialize_time" , materializeTimeNs))
5454 sb.append(formatTimeLine(" total_time" , totalTimeNs))
5555
56- val rt = Runtime .getRuntime
57- val usedBytes = rt.totalMemory() - rt.freeMemory()
58- val maxBytes = rt.maxMemory()
59- sb.append(formatBytesLine(" heap_used" , usedBytes))
60- sb.append(formatBytesLine(" heap_max" , maxBytes))
56+ Platform .appendMemoryStats(sb)
6157
6258 sb.toString
6359 }
@@ -68,22 +64,12 @@ final class DebugStats {
6864 private def formatTimeLine (label : String , ns : Long ): String =
6965 f " $label%-25s ${formatNs(ns)}%s%n "
7066
71- private def formatBytesLine (label : String , bytes : Long ): String =
72- f " $label%-25s ${formatBytes(bytes)}%s%n "
73-
7467 private def formatNs (ns : Long ): String = {
7568 if (ns < 1000L ) s " ${ns}ns "
7669 else if (ns < 1000000L ) f " ${ns / 1000.0 }%.1fμs "
7770 else if (ns < 1000000000L ) f " ${ns / 1000000.0 }%.1fms "
7871 else f " ${ns / 1000000000.0 }%.3fs "
7972 }
80-
81- private def formatBytes (bytes : Long ): String = {
82- if (bytes < 1024L ) s " ${bytes}B "
83- else if (bytes < 1024L * 1024 ) f " ${bytes / 1024.0 }%.1fKB "
84- else if (bytes < 1024L * 1024 * 1024 ) f " ${bytes / (1024.0 * 1024 )}%.1fMB "
85- else f " ${bytes / (1024.0 * 1024 * 1024 )}%.2fGB "
86- }
8773}
8874
8975/**
0 commit comments