Download Jar. Libraryless. Click here for Pure Java version (6362L/43K).
1 | !7 |
2 | |
3 | import javax.management.*; |
4 | import javax.management.openmbean.CompositeData; |
5 | import com.sun.management.GcInfo; |
6 | import com.sun.management.GarbageCollectionNotificationInfo; |
7 | |
8 | sclass GCPause {
|
9 | long start, duration; |
10 | S name, cause, action; |
11 | |
12 | toString {
|
13 | ret "GCPause duration=" + duration + " ms, start=" + start + " (VM time). " + renderStructs(+name, +cause, +action); |
14 | } |
15 | } |
16 | |
17 | static L<GCPause> pauses = synchroList(); |
18 | |
19 | p {
|
20 | onGCNotification(voidfunc(GarbageCollectionNotificationInfo info) {
|
21 | GcInfo gcInfo = info.getGcInfo(); |
22 | GCPause pause = nu(GCPause, |
23 | start := gcInfo.getStartTime(), |
24 | duration := gcInfo.getDuration(), |
25 | name := info.getGcName(), |
26 | cause := info.getGcCause(), |
27 | action := info.getGcAction()); |
28 | pauses.add(pause); |
29 | print("Have GC pause: " + pause);
|
30 | }); |
31 | showButtons("Make some garbage", f makeSomeGarbage);
|
32 | } |
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: | 702 / 1714 |
| Version history: | 15 change(s) |
| Referenced in: | [show references] |