测试算法使用内存临时提交

This commit is contained in:
2025-04-03 11:37:01 +08:00
parent 33ba61d4a2
commit 8161c04dd4

View File

@@ -420,6 +420,22 @@ public class InfluxdbDataVImpl extends MppServiceImpl<RStatDataVRelationMapper,
private void quality(List<DataV> result, InfluxQueryWrapper influxQueryWrapper, LineCountEvaluateParam private void quality(List<DataV> result, InfluxQueryWrapper influxQueryWrapper, LineCountEvaluateParam
lineParam) { lineParam) {
List<DataV> list = dataVMapper.selectByQueryWrapper(influxQueryWrapper); List<DataV> 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)) { if (CollUtil.isNotEmpty(list)) {
Map<String, List<DataV>> lineMap = list.stream().collect(Collectors.groupingBy(DataV::getLineId)); Map<String, List<DataV>> lineMap = list.stream().collect(Collectors.groupingBy(DataV::getLineId));
//有异常数据 //有异常数据