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).

!7

sclass Profiler extends DynBigNumber {
  transient new PerSecondCounter counter;
  transient int interval = 100;
  
  void enhanceFrame(JInternalFrame frame) {
    internalFrameTitlePopupMenu(frame,
      "Start", r startTimer,
      "Stop", r stopAllTimers);
  }
  
  void start {
    setDescription("Java Cores Load");
    startTimer();
  }
  
  void startTimer { singleTimer(doEvery(interval, r sample)); }

  void sample {
    Map<Thread, StackTraceElement[]> threads = runnableThreadsWithStackTraces();
    print(renderAllThreadsWithStackTraces(threads));
    counter.inc(print(l(threads)));
    double value = counter.getLast()*interval/1000;
    //setValue(formatDouble(value*100, 2) + " %");
    //setValue(formatDoubleFull(value/numberOfCores(), 2));
    setValue(formatDoubleFull(value, 1));
  }
}

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: 395 / 13150
Version history: 17 change(s)
Referenced in: #1016416 - 10 Second Profiler [Dyn Module]