内存利用率数据优化
This commit is contained in:
@@ -5,6 +5,7 @@ import com.tongran.agent.client.core.vo.SystemVO;
|
||||
import com.tongran.agent.client.service.SystemService;
|
||||
import com.tongran.agent.client.utils.AgentDataUtil;
|
||||
import com.tongran.agent.client.utils.AgentUtil;
|
||||
import com.tongran.agent.client.utils.AssertLog;
|
||||
import org.springframework.stereotype.Service;
|
||||
import oshi.SystemInfo;
|
||||
import oshi.hardware.CentralProcessor;
|
||||
@@ -165,6 +166,7 @@ public class SystemServiceImpl implements SystemService {
|
||||
// long buffers = memInfo.getOrDefault("Buffers", 0L);
|
||||
// double actualUsage = (double)(total - available - cached - buffers) / total * 100;
|
||||
double actualUsage = (double)(total - available) / total * 100;
|
||||
AssertLog.info("memoryUtilizationCollect,内存使用率:{}",actualUsage);
|
||||
System.out.printf("实际内存使用率: %.2f%%\n", actualUsage);
|
||||
return actualUsage;
|
||||
} catch (IOException e) {
|
||||
|
||||
Reference in New Issue
Block a user