ÎļþÃû´Ó wgcloud-agent/src/main/java/com/wgcloud/OshiUtil.java ÐÞ¸Ä |
| | |
| | | package com.wgcloud; |
| | | package se.wgcloud; |
| | | |
| | | import com.wgcloud.entity.*; |
| | | import se.wgcloud.entity.*; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import oshi.hardware.CentralProcessor; |
| | |
| | | /** |
| | | * @version v3.3 |
| | | * @ClassName: OshiUtil |
| | | * @author: http://www.wgstart.com |
| | | * @author: |
| | | * @date: 2021å¹´11æ19æ¥ |
| | | * @Description: Oshiå·¥å
·ç±» |
| | | * @Copyright: 2017-2024 wgcloud. All rights reserved. |
| | | * @Copyright: |
| | | */ |
| | | public class OshiUtil { |
| | | |
| | |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public static com.wgcloud.entity.SystemInfo os(CentralProcessor processor, OperatingSystem os) throws Exception { |
| | | com.wgcloud.entity.SystemInfo systemInfo = new com.wgcloud.entity.SystemInfo(); |
| | | public static SystemInfo os(CentralProcessor processor, OperatingSystem os) throws Exception { |
| | | SystemInfo systemInfo = new SystemInfo(); |
| | | systemInfo.setHostname(commonConfig.getBindIp()); |
| | | systemInfo.setCpuCoreNum(processor.getLogicalProcessorCount() + ""); |
| | | String cpuInfo = processor.toString(); |
| | |
| | | * |
| | | * @return |
| | | */ |
| | | public static SysLoadState getLoadState(com.wgcloud.entity.SystemInfo systemInfo, CentralProcessor processor) throws Exception { |
| | | public static SysLoadState getLoadState(SystemInfo systemInfo, CentralProcessor processor) throws Exception { |
| | | SysLoadState sysLoadState = new SysLoadState(); |
| | | if (systemInfo == null) { |
| | | return null; |