Uses 911K of libraries. Click here for Pure Java version (3727L/19K).
1 | !7 |
2 | |
3 | // uses advancedOSMXBean(), not OSHI |
4 | |
5 | cmodule ProcessCPUPercentage > DynBigNumber { |
6 | transient FixedRateTimer mainTimer; |
7 | transient double loadRelativeToAllCores, recentLoad; |
8 | transient RollingAverage avg = new(5); // =10 seconds |
9 | |
10 | start { |
11 | setDescription("PROCESS CPU %"); |
12 | setToolTip("Percentage is per core (total: " + n2(numberOfCores(), "core") + ")"); |
13 | mainTimer = doEvery(2.0, r actualUpdate); |
14 | } |
15 | |
16 | void actualUpdate { |
17 | recentLoad = processCPULoad(); |
18 | avg.add(recentLoad); |
19 | loadRelativeToAllCores = avg!; |
20 | setValue(toIntPercent_ceil(loadRelativeToAllCores*numberOfCores()) + " %"); |
21 | } |
22 | } |
Began life as a copy of #1016652
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, whxojlpjdney
No comments. add comment
Snippet ID: | #1018523 |
Snippet name: | Process CPU % [Dyn Module] |
Eternal ID of this version: | #1018523/12 |
Text MD5: | 25d91206ada0df8a0a829ef0ea101818 |
Transpilation MD5: | 752458b35e3387dc6785d380fd36fb73 |
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:33:40 |
Source code size: | 650 bytes / 22 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 427 / 262665 |
Version history: | 11 change(s) |
Referenced in: | [show references] |