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

20
LINES

< > TinyBrain | #1001981 - "time {" (JavaX translator, time a code fragment and print result to System.out)

JavaX translator [tags: use-pretranspiled]

Transpiled version (280L) is out of date.

// Syntax: time { doFunnyStuff(); }


!752

p {
  L<S> tok = tokMainJava();
  
  tok = replaceKeywordBlock(tok,
    // keyword to match
    "time",
    
    // beginning of replacement block
    "{ long __time_startTime = now(); try { ",
    
    // end of replacement block
    "} finally { __time_startTime = now()-__time_startTime; saveTiming(__time_startTime); } }"); 
    
  saveMainJava(tok);
}

Author comment

Began life as a copy of #1001897

download  show line numbers  debug dex   

Travelled to 9 computer(s): aoiabmzegqzx, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, mqqgnosmbjvj, onxytkatvevr, tslmcundralx, tvejysmllsmz

No comments. add comment

Snippet ID: #1001981
Snippet name: "time {" (JavaX translator, time a code fragment and print result to System.out)
Eternal ID of this version: #1001981/1
Text MD5: 2e90b042ccae1731cf13b28b7943b049
Author: stefan
Category:
Type: JavaX translator
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-01-01 17:01:22
Source code size: 419 bytes / 20 lines
Pitched / IR pitched: No / Yes
Views / Downloads: 216 / 313
Referenced in: [show]