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

34
LINES

< > BotCompany Repo | #1022108 // Swing Latency Watchdog [clear print logs when triggered]

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

Libraryless. Click here for Pure Java version (8919L/64K).

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  
  enhanceFrame {
13  
    internalFrameTitleMenuItem(f, "Clear logs now", rThread dm_clearAllPrintLogs);
14  
  }
15  
  
16  
  void testIt {
17  
    long time = sysNow();
18  
    swing {}
19  
    time = sysNow()-time;
20  
    setValue(time + " ms");
21  
    if (time >= maxValue) {
22  
      logQuotedWithDate(javaxDataDir("Swing Latency Log.txt"), "TRIGGERED. " + time + " ms");
23  
      trigger();
24  
    }
25  
  }
26  
  
27  
  void testTrigger { trigger(); }
28  
  
29  
  void trigger {
30  
    print("TRIGGERED, CLEARING PRINT LOGS");
31  
    triggered = true;
32  
    dm_clearAllPrintLogs();
33  
  }
34  
}

Author comment

Began life as a copy of #1018092

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1022108
Snippet name: Swing Latency Watchdog [clear print logs when triggered]
Eternal ID of this version: #1022108/3
Text MD5: 7b6f264ae86bc60d1db827aedc67e440
Transpilation MD5: ee142ce1e6404f67ab60dad56e7b3b30
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-09 23:56:49
Source code size: 726 bytes / 34 lines
Pitched / IR pitched: No / No
Views / Downloads: 289 / 10141
Version history: 2 change(s)
Referenced in: [show references]