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

11
LINES

< > BotCompany Repo | #1025490 // maxExecutionGap - are we constantly getting CPU time?

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (89L/1K).

1  
// result is in nanoseconds
2  
// runs for one second
3  
static long maxExecutionGap() {
4  
  long time = nanoTime(), end = nanoTime()+oneBillion(), max = 0;
5  
  while (time < end) {
6  
    long time2 = nanoTime();
7  
    max = max(max, time2-time);
8  
    time = time2;
9  
  }
10  
  ret max;
11  
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1025490
Snippet name: maxExecutionGap - are we constantly getting CPU time?
Eternal ID of this version: #1025490/2
Text MD5: 5f129c4947baecf9baa3fe94501c240b
Transpilation MD5: 0c19cb82b4cf0133fb1e32848ae56bda
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-08-01 14:15:19
Source code size: 277 bytes / 11 lines
Pitched / IR pitched: No / No
Views / Downloads: 160 / 236
Version history: 1 change(s)
Referenced in: [show references]