Please enable Javascript to view the screen cast
The test class that is profiled in this screen cast is given below:
import java.util.Random;
public class MethodStatisticsTest {
private static Random random = new Random(0);
public static void main(String[] args) {
while (true) {
doCriticalTask();
}
}
private static void doCriticalTask() {
if (random.nextInt(1000) % 999 == 0) {
implOne();
} else {
implTwo();
}
}
private static void implOne() {
for (int i = 0; i < 100000; i++) {
Math.sqrt(i);
}
}
private static void implTwo() {
for (int i = 0; i < 1000; i++) {
Math.sqrt(i);
}
}
}
0 comments:
Post a Comment