Current location - Music Encyclopedia - Chinese History - How does eclipse check how long it takes to compile?
How does eclipse check how long it takes to compile?
Record a start time and an end time, and the subtraction between them is the running time of the program. The code is as follows

Dragon? Start? =? system . current time millis(); //? Record start time

Try it? {

thread . sleep(5000); //? The thread sleeps for 5 seconds, which makes the running time not so short.

}? Catch? (Interrupt exception? e)? {

e . printstacktrace();

}

Dragon? End? =? system . current time millis(); //? Record end time

System.out.println (end-start); //? Subtract to get the running time

The unit is milliseconds.