public class SystemUtils {
public static SystemType getStatus(SystemType st, List<SystemType> stList) {
try {
Sigar sigar = new Sigar();
// 初始化系统状态
st.setCpuInfos(sigar.getCpuInfoList());
st.setCpuPercs(sigar.getCpuPercList());
st.setMem(sigar.getMem());
st.setSwap(sigar.getSwap());
st.setSys(OperatingSystem.getInstance());
st.setUptime(sigar.getUptime().getUptime());
String netNames[] = sigar.getNetInterfaceList();
st.setNetNames(netNames);
Map<String, NetInterfaceConfig> netConfigs = new HashMap<String, NetInterfaceConfig>();
Map<String, NetInterfaceStat> netStats = new HashMap<String, NetInterfaceStat>();
Map<String, Double> netRxSpeed = new HashMap<String, Double>();
Map<String, Double> netTxSpeed = new HashMap<String, Double>();
SystemType stTemp = stList.get(stList.size() - 1);
for (int i = 0; i < netNames.length; i++) {
// if (netNames[i].toLowerCase().equals("lo")) {
// continue;
// }
NetInterfaceConfig netConfig = sigar
.getNetInterfaceConfig(netNames[i]);
NetInterfaceStat netStat = sigar
.getNetInterfaceStat(netNames[i]);
netConfigs.put(netNames[i], netConfig);
netStats.put(netNames[i], netStat);
double doubRx = 0.0;
double doubTx = 0.0;