Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

28
LINES

< > BotCompany Repo | #1016748 // Thread Memory Allocated Bytes [Dyn Module]

JavaX source code (Dynamic Module) [tags: use-pretranspiled] - run with: Stefan's OS

Libraryless. Click here for Pure Java version (14445L/100K).

!7

sclass ThreadMemoryAllocationRates extends DynModule {
  transient SimpleLiveValue<S> lv = stringLiveValue();
  
  JComponent visualize() {
    ret jLiveValueTypeWriterTextArea(lv);
  }
  
  void start {
    doEveryAndNow(1.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 L<S> lines;
    for i over values:
      if (values[i] != 0)
        lines.add((padLeft(str(toK(values[i])), 9) + "K: " + threads.get(i).getName());
    lv.set(lines(reverseSorted(lines)));
  }
}

Author comment

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: 422 / 560
Version history: 6 change(s)
Referenced in: #1017372 - Thread Memory Allocation Rates [Dyn Module]