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

1  
!7
2  
3  
sclass SwingLatencyWatchdog > DynBigNumber {
4  
  int maxValue = 10000;
5  
  bool triggered;
6  
  
7  
  start {
8  
    setDescription("LATENCY");
9  
    doEvery(1000, r testIt);
10  
  }
11  
  
12  
  void testIt {
13  
    long time = sysNow();
14  
    swing {}
15  
    time = sysNow()-time;
16  
    setValue(time + " ms");
17  
    if (time >= maxValue) {
18  
      logQuotedWithDate(javaxDataDir("Swing Latency Log.txt"), "TRIGGERED. " + time + " ms");
19  
      trigger();
20  
    }
21  
  }
22  
  
23  
  void testTrigger { trigger(); }
24  
  
25  
  void trigger {
26  
    if (!triggered) {
27  
      print("TRIGGERED");
28  
      triggered = true;
29  
      dm_hideAllModules();
30  
    } else {
31  
      print("ULTRA TRIGGERED, RESTARTING");
32  
      dm_restartOS();
33  
    }
34  
  }
35  
}

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: 250 / 16464
Version history: 3 change(s)
Referenced in: [show references]