From 8161c04dd405ce1e059a738fa5f38e08d4c6f9dc Mon Sep 17 00:00:00 2001 From: chendaofei <857448963@qq.com> Date: Thu, 3 Apr 2025 11:37:01 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E7=AE=97=E6=B3=95=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=E5=86=85=E5=AD=98=E4=B8=B4=E6=97=B6=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/influxdb/InfluxdbDataVImpl.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/data-processing/data-processing-boot/src/main/java/com/njcn/dataProcess/service/impl/influxdb/InfluxdbDataVImpl.java b/data-processing/data-processing-boot/src/main/java/com/njcn/dataProcess/service/impl/influxdb/InfluxdbDataVImpl.java index bf893d0..9f0b987 100644 --- a/data-processing/data-processing-boot/src/main/java/com/njcn/dataProcess/service/impl/influxdb/InfluxdbDataVImpl.java +++ b/data-processing/data-processing-boot/src/main/java/com/njcn/dataProcess/service/impl/influxdb/InfluxdbDataVImpl.java @@ -420,6 +420,22 @@ public class InfluxdbDataVImpl extends MppServiceImpl result, InfluxQueryWrapper influxQueryWrapper, LineCountEvaluateParam lineParam) { List list = dataVMapper.selectByQueryWrapper(influxQueryWrapper); + Runtime runtime = Runtime.getRuntime(); + // 获取 JVM 最大可用内存(以字节为单位) + long maxMemory = runtime.maxMemory(); + // 获取 JVM 当前已分配的内存(以字节为单位) + long totalMemory = runtime.totalMemory(); + // 获取 JVM 当前空闲内存(以字节为单位) + long freeMemory = runtime.freeMemory(); + // 计算已使用的内存 + long usedMemory = totalMemory - freeMemory; + + System.out.println("最大可用内存: " + maxMemory / (1024 * 1024) + " MB"); + System.out.println("当前已分配的内存: " + totalMemory / (1024 * 1024) + " MB"); + System.out.println("当前空闲内存: " + freeMemory / (1024 * 1024) + " MB"); + System.out.println("已使用的内存: " + usedMemory / (1024 * 1024) + " MB"); + System.out.println("第二次分析结束-----------------------------------------"); + if (CollUtil.isNotEmpty(list)) { Map> lineMap = list.stream().collect(Collectors.groupingBy(DataV::getLineId)); //有异常数据