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

!7

sclass SwingLatencyWatchdog > DynBigNumber {
  int maxValue = 10000;
  bool triggered;
  
  start {
    setDescription("LATENCY");
    doEvery(1000, r testIt);
  }
  
  enhanceFrame {
    internalFrameTitleMenuItem(f, "Clear logs now", rThread dm_clearAllPrintLogs);
  }
  
  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 {
    print("TRIGGERED, CLEARING PRINT LOGS");
    triggered = true;
    dm_clearAllPrintLogs();
  }
}

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: 209 / 10040
Version history: 2 change(s)
Referenced in: [show references]