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

22
LINES

< > BotCompany Repo | #1000800 // startTiming + stopTiming

JavaX fragment (include)

1  
static long stopTiming_defaultMin = 10;
2  
3  
static long startTiming_startTime;
4  
static void startTiming() {
5  
  startTiming_startTime = now();
6  
}
7  
8  
static void stopTiming() {
9  
  stopTiming(null);
10  
}
11  
12  
static void stopTiming(S text) {
13  
  stopTiming(text, stopTiming_defaultMin);
14  
}
15  
16  
static void stopTiming(S text, long minToPrint) {
17  
  long time = now()-startTiming_startTime;
18  
  if (time >= minToPrint) {
19  
    text = or2(text, "Time: ");
20  
    print(text + time + " ms");
21  
  }
22  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1000800
Snippet name: startTiming + stopTiming
Eternal ID of this version: #1000800/1
Text MD5: 5e58cc2be3cd51de2ababbab3240eafa
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-08-10 15:03:57
Source code size: 480 bytes / 22 lines
Pitched / IR pitched: No / No
Views / Downloads: 698 / 3316
Referenced in: [show references]