!7 p { /*thread { }*/ bool first = true; repeat with sleep 1 { List gcBeans = ManagementFactory.getGarbageCollectorMXBeans(); long count = 0; long timeMillis = 0; for (GarbageCollectorMXBean gcBean : gcBeans) { if (first) print("Collector: " +gcBean.getName()); count += gcBean.getCollectionCount(); timeMillis += gcBean.getCollectionTime(); } first = false; print("GC count: " + count + ", time: " + formatDouble(toS(timeMillis), 3) + " s"; } }