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

29
LINES

< > BotCompany Repo | #1016146 // Profiler [Dyn Module]

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

Libraryless. Click here for Pure Java version (14538L/101K).

1  
!7
2  
3  
sclass Profiler extends DynBigNumber {
4  
  transient new PerSecondCounter counter;
5  
  transient int interval = 100;
6  
  
7  
  void enhanceFrame(JInternalFrame frame) {
8  
    internalFrameTitlePopupMenu(frame,
9  
      "Start", r startTimer,
10  
      "Stop", r stopAllTimers);
11  
  }
12  
  
13  
  void start {
14  
    setDescription("Java Cores Load");
15  
    startTimer();
16  
  }
17  
  
18  
  void startTimer { singleTimer(doEvery(interval, r sample)); }
19  
20  
  void sample {
21  
    Map<Thread, StackTraceElement[]> threads = runnableThreadsWithStackTraces();
22  
    print(renderAllThreadsWithStackTraces(threads));
23  
    counter.inc(print(l(threads)));
24  
    double value = counter.getLast()*interval/1000;
25  
    //setValue(formatDouble(value*100, 2) + " %");
26  
    //setValue(formatDoubleFull(value/numberOfCores(), 2));
27  
    setValue(formatDoubleFull(value, 1));
28  
  }
29  
}

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: #1016146
Snippet name: Profiler [Dyn Module]
Eternal ID of this version: #1016146/18
Text MD5: ac3b96a4dabfce94c3bc2626258de0cc
Transpilation MD5: 6b78a8c1637005fb225d3cc085743dc4
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-06-08 18:34:47
Source code size: 839 bytes / 29 lines
Pitched / IR pitched: No / No
Views / Downloads: 394 / 13150
Version history: 17 change(s)
Referenced in: [show references]