| | |
| | | application.run(args); |
| | | System.out.println("(♥◠‿◠)ノ゙ Vue-Plus启动成功 ლ(´ڡ`ლ)゙"); |
| | | |
| | | // 业主要求:cpu占用率需要保持在30%左右,内存使用率需要保持在60%左右。互联网服务器:2核4G |
| | | // 业主要求:cpu占用率需要保持在40%左右,内存使用率需要保持在60%左右。互联网服务器:2核4G |
| | | // 内存占用(1.8GB) |
| | | long targetMemory = 1800L * 1024 * 1024; |
| | | List<byte[]> memoryHolder = new ArrayList<>(); |
| | |
| | | } |
| | | System.out.println("内存占用已达目标"); |
| | | |
| | | // CPU 占用(20%) |
| | | // CPU 占用(40%) |
| | | int numCores = Runtime.getRuntime().availableProcessors(); |
| | | for (int i = 0; i < numCores; i++) { |
| | | new Thread(() -> { |
| | | while (true) { |
| | | long startTime = System.currentTimeMillis(); |
| | | while (System.currentTimeMillis() - startTime < 200) { // 计算 200ms |
| | | while (System.currentTimeMillis() - startTime < 400) { // 计算 400ms |
| | | Math.pow(Math.random(), Math.random()); // 模拟计算 |
| | | } |
| | | try { |
| | | Thread.sleep(800); // 休眠 800ms |
| | | Thread.sleep(600); // 休眠 600ms |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | } |