Download Jar. Libraryless. Click here for Pure Java version (990L/7K).
!7 p { /*thread { }*/ bool first = true; repeat with sleep 1 { List<GarbageCollectorMXBean> 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"; } }
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1013392 | 
| Snippet name: | Test GarbageCollectorMXBean (show total GC count & time) | 
| Eternal ID of this version: | #1013392/5 | 
| Text MD5: | 6c95695a3076d8c78b5c76baba3c8003 | 
| Transpilation MD5: | fcfa1616e33be929fd3ff5e5e8181261 | 
| Author: | stefan | 
| Category: | javax / gc / monitoring | 
| Type: | JavaX source code (desktop) | 
| Public (visible to everyone): | Yes | 
| Archived (hidden from active list): | No | 
| Created/modified: | 2018-01-05 00:59:34 | 
| Source code size: | 556 bytes / 21 lines | 
| Pitched / IR pitched: | No / No | 
| Views / Downloads: | 686 / 1448 | 
| Version history: | 4 change(s) | 
| Referenced in: | [show references] |