Libraryless. Click here for Pure Java version (14464L/100K).
!7 sclass ThreadMemoryAllocationRates extends DynModule { transient SimpleLiveValue<S> lv = stringLiveValue(); transient Map<Long> lastValues; transient long lastTime; JComponent visualize() { ret jLiveValueTypeWriterTextArea(lv); } start { doEveryAndNow(5.0, r doIt); } void doIt { temp enter(); if (!threadAllocatedMemoryEnabled()) ret with lv.set("Thread memory allocation not monitored"); com.sun.management.ThreadMXBean bean = advancedThreadMXBean(); L<Thread> threads = allThreads_fast(); long[] values = bean.getThreadAllocatedBytes(threadIDs_array(threads)); new Map<Long> map; new Map<Long, S> names; for i over values: { Thread t = threads.get(i); long id = t.getId(); map.put(id, values[i]); names.put(id, t.getName()); } long diffTime = sysNow()-lastTime; lastTime = sysNow(); if (lastValues != null) { new L<S> lines; for (Long id, value : map) { long diff = value - or(lastValues.get(id), 0L); diff = diff*1000/diffTime; if (diff != 0) lines.add(padLeft(str(toK(diff)), 9) + " K/s: " + names.get(id)); } lv.set(lines(reverseSorted(lines))); } lastValues = map; } }
Began life as a copy of #1016748
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1017372 |
| Snippet name: | Thread Memory Allocation Rates [Dyn Module] |
| Eternal ID of this version: | #1017372/7 |
| Text MD5: | ce5bcbda5c84e0786588cc08c33e2cb6 |
| Transpilation MD5: | 53d3055170cb76fc8984d7d3bd23e1ff |
| Author: | stefan |
| Category: | javax / stefan's os |
| Type: | JavaX source code (Dynamic Module) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2018-11-13 05:39:34 |
| Source code size: | 1316 bytes / 47 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 817 / 1128 |
| Version history: | 6 change(s) |
| Referenced in: | [show references] |