Download Jar. Libraryless. Click here for Pure Java version (6362L/43K).
!7 import javax.management.*; import javax.management.openmbean.CompositeData; import com.sun.management.GcInfo; import com.sun.management.GarbageCollectionNotificationInfo; sclass GCPause { long start, duration; S name, cause, action; toString { ret "GCPause duration=" + duration + " ms, start=" + start + " (VM time). " + renderStructs(+name, +cause, +action); } } static L<GCPause> pauses = synchroList(); p { onGCNotification(voidfunc(GarbageCollectionNotificationInfo info) { GcInfo gcInfo = info.getGcInfo(); GCPause pause = nu(GCPause, start := gcInfo.getStartTime(), duration := gcInfo.getDuration(), name := info.getGcName(), cause := info.getGcCause(), action := info.getGcAction()); pauses.add(pause); print("Have GC pause: " + pause); }); showButtons("Make some garbage", f makeSomeGarbage); }
Began life as a copy of #1013395
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: | #1013400 |
Snippet name: | Collect GC Pause Times |
Eternal ID of this version: | #1013400/16 |
Text MD5: | a70f5147436d3686108c9a5f3b4aed53 |
Transpilation MD5: | a8be6c857aa0e625e19cd7246737539b |
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 01:53:53 |
Source code size: | 908 bytes / 32 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 452 / 1159 |
Version history: | 15 change(s) |
Referenced in: | #1013407 - collectGCPauses |