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

35
LINES

< > BotCompany Repo | #1018092 // Swing Latency Watchdog [Dyn Module]

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

Libraryless. Click here for Pure Java version (5365L/36K).

!7

sclass SwingLatencyWatchdog > DynBigNumber {
  int maxValue = 10000;
  bool triggered;
  
  start {
    setDescription("LATENCY");
    doEvery(1000, r testIt);
  }
  
  void testIt {
    long time = sysNow();
    swing {}
    time = sysNow()-time;
    setValue(time + " ms");
    if (time >= maxValue) {
      logQuotedWithDate(javaxDataDir("Swing Latency Log.txt"), "TRIGGERED. " + time + " ms");
      trigger();
    }
  }
  
  void testTrigger { trigger(); }
  
  void trigger {
    if (!triggered) {
      print("TRIGGERED");
      triggered = true;
      dm_hideAllModules();
    } else {
      print("ULTRA TRIGGERED, RESTARTING");
      dm_restartOS();
    }
  }
}

Author comment

Began life as a copy of #1017750

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, yanjaxplzisb

No comments. add comment

Snippet ID: #1018092
Snippet name: Swing Latency Watchdog [Dyn Module]
Eternal ID of this version: #1018092/4
Text MD5: f3e5f83da6c6120ad3e9199033e09151
Transpilation MD5: 9d1debeaacef950486ede7631538de11
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-09-01 00:49:02
Source code size: 709 bytes / 35 lines
Pitched / IR pitched: No / No
Views / Downloads: 247 / 16457
Version history: 3 change(s)
Referenced in: [show references]