CPU飙高测试
public class HighCpuLoad {public static void main(String[] args) {final int numThreads = 10; // 要使用的线程数for (int i = 0; i < numThreads; i++) {Thread thread = new Thread(new CpuIntensiveTask());thread.start();}}static class CpuIntensiveTask implements Runnable {@Overridepublic void run() {while (true) {// 进行一些密集计算操作double result = 0;for (int i = 0; i < 1000000; i++) {result += Math.sqrt(i) * Math.pow(i, 2) / Math.log(i + 1);}}}}
}

本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!
