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

22
LINES

< > BotCompany Repo | #1024201 // Java + HotSpot Compilation CPU % [Dyn Module]

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

Libraryless. Click here for Pure Java version (10137L/72K).

1  
!7
2  
3  
sclass JavaPlusHotSpotCPUPercentage extends DynBigNumber {
4  
  transient O cpuMonitor;
5  
  transient RollingAverage avg = new(5); // =10 seconds
6  
  transient double recentValue;
7  
  
8  
  start {
9  
    setDescription("JAVA + HOTSPOT CPU %");
10  
    setToolTip("Percentage is per core");
11  
    cpuMonitor = runDependent(#1001405);
12  
    ownTimer(doEvery(2.0, r actualUpdate));
13  
  }
14  
  
15  
  void actualUpdate {
16  
    recentValue =
17  
      (double) call(cpuMonitor, 'getInProcessCPU) +
18  
      (double) get(cpuMonitor, 'compilationPercentage);
19  
    avg.add(recentValue);
20  
    setValue(iceil(avg!) + " %");
21  
  }
22  
}

Author comment

Began life as a copy of #1016652

download  show line numbers  debug dex  old transpilations   

Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1024201
Snippet name: Java + HotSpot Compilation CPU % [Dyn Module]
Eternal ID of this version: #1024201/3
Text MD5: 03205f577e6db6307a5da23d08d94e92
Transpilation MD5: bdb0cd47a9708b57c8a4401d848a1853
Author: stefan
Category: javax / modules
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-08-18 11:35:28
Source code size: 602 bytes / 22 lines
Pitched / IR pitched: No / No
Views / Downloads: 257 / 139908
Version history: 2 change(s)
Referenced in: [show references]