public static void main(String[] args) {
long startTime = System.currentTimeMillis();
long endTime = startTime + 6000;
long index = 0;
while(true){
double x = Math.sqrt(index);
long now = System.currentTimeMillis();
if (now > endTime) {
break;
}
index++;
}
System.out.println(index+" Loops in 6 seconds");
}
CPU性能測試 java代碼
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.