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

34
LINES

< > BotCompany Repo | #1019950 // Gather System Loads From All Online Computers

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

Uses 911K of libraries. Click here for Pure Java version (10114L/59K).

1  
!7
2  
3  
srecord Info(S computerID, S load, S reactionTime) {}
4  
5  
set flag DynModule. // use global transpiler
6  
7  
compact module GatherSystemLoads > DynObjectTable<Info> {
8  
  transient Map<S, Info> map = expiringMap(3600.0); // key = computerID
9  
  
10  
  start {
11  
    doEvery(1.0, 10.0, r gather);
12  
  }
13  
  
14  
  void gather enter {
15  
    time "Gather System Loads" {
16  
      new L<Info> l;
17  
      for (S computerID : dm_onlineComputers()) pcall-short {
18  
        long time = sysNow();
19  
        S doubleLoad = str(dm_evalOnOtherMachine_optimizeIfMe(computerID, "systemCPULoad()",
20  
          updateControllableFlag := false));
21  
        S load = startsWithDigit(doubleLoad) ? toPercent(parseDouble(doubleLoad)) + " %" : "?";
22  
        S reactionTime = elapsedMS(time) + " ms";
23  
        if (mapPut_trueIfChanged(map, computerID, nu(Info, +computerID, +load, +reactionTime)))
24  
          makeList();
25  
      }
26  
    }
27  
  }
28  
  
29  
  void makeList() {
30  
    setData(valuesList(map));
31  
    addRowSorter_desc(table, 1);
32  
    rowSorter_setComparatorForAllColumns(table, alphaNumComparator());
33  
  }
34  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 9 computer(s): bhatertpkbcr, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1019950
Snippet name: Gather System Loads From All Online Computers
Eternal ID of this version: #1019950/23
Text MD5: 4087514006fcf5703ce6e0645fb3d2cc
Transpilation MD5: 8eef68e9301d66d759756cab7900cf99
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: 2019-03-02 13:15:38
Source code size: 1072 bytes / 34 lines
Pitched / IR pitched: No / No
Views / Downloads: 358 / 1812
Version history: 22 change(s)
Referenced in: [show references]