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

!7

srecord Info(S computerID, S load, S reactionTime) {}

set flag DynModule. // use global transpiler

compact module GatherSystemLoads > DynObjectTable<Info> {
  transient Map<S, Info> map = expiringMap(3600.0); // key = computerID
  
  start {
    doEvery(1.0, 10.0, r gather);
  }
  
  void gather enter {
    time "Gather System Loads" {
      new L<Info> l;
      for (S computerID : dm_onlineComputers()) pcall-short {
        long time = sysNow();
        S doubleLoad = str(dm_evalOnOtherMachine_optimizeIfMe(computerID, "systemCPULoad()",
          updateControllableFlag := false));
        S load = startsWithDigit(doubleLoad) ? toPercent(parseDouble(doubleLoad)) + " %" : "?";
        S reactionTime = elapsedMS(time) + " ms";
        if (mapPut_trueIfChanged(map, computerID, nu(Info, +computerID, +load, +reactionTime)))
          makeList();
      }
    }
  }
  
  void makeList() {
    setData(valuesList(map));
    addRowSorter_desc(table, 1);
    rowSorter_setComparatorForAllColumns(table, alphaNumComparator());
  }
}

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: 294 / 1729
Version history: 22 change(s)
Referenced in: [show references]