Libraryless. Click here for Pure Java version (14445L/100K).
1 | !7 |
2 | |
3 | sclass ThreadMemoryAllocationRates extends DynModule { |
4 | transient SimpleLiveValue<S> lv = stringLiveValue(); |
5 | |
6 | JComponent visualize() { |
7 | ret jLiveValueTypeWriterTextArea(lv); |
8 | } |
9 | |
10 | void start { |
11 | doEveryAndNow(1.0, r doIt); |
12 | } |
13 | |
14 | void doIt { |
15 | temp enter(); |
16 | if (!threadAllocatedMemoryEnabled()) |
17 | ret with lv.set("Thread memory allocation not monitored"); |
18 | |
19 | com.sun.management.ThreadMXBean bean = advancedThreadMXBean(); |
20 | L<Thread> threads = allThreads_fast(); |
21 | long[] values = bean.getThreadAllocatedBytes(threadIDs_array(threads)); |
22 | new L<S> lines; |
23 | for i over values: |
24 | if (values[i] != 0) |
25 | lines.add((padLeft(str(toK(values[i])), 9) + "K: " + threads.get(i).getName()); |
26 | lv.set(lines(reverseSorted(lines))); |
27 | } |
28 | } |
Began life as a copy of #1016398
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: | #1016748 |
Snippet name: | Thread Memory Allocated Bytes [Dyn Module] |
Eternal ID of this version: | #1016748/7 |
Text MD5: | 6aaad6a0c22d887b0e2229d3bb36bd6e |
Transpilation MD5: | 6193c2461189429c159bcc2fd55dea3c |
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-07-19 13:09:46 |
Source code size: | 808 bytes / 28 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 421 / 558 |
Version history: | 6 change(s) |
Referenced in: | [show references] |