Merge pull request #8 from elunez/master

sync
pull/729/head
caiming100 2022-07-01 13:32:18 +08:00 committed by GitHub
commit 28a328a339
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 4 deletions

View File

@ -1,4 +1,4 @@
/*
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -276,6 +276,7 @@ public class GenUtil {
// 主键存在字典
if (StringUtils.isNotBlank(column.getDictName())) {
genMap.put("hasDict", true);
if(!dicts.contains(column.getDictName()))
dicts.add(column.getDictName());
}

View File

@ -148,9 +148,15 @@ public class MonitorServiceImpl implements MonitorService {
cpuInfo.put("logic", processor.getLogicalProcessorCount() + "个逻辑CPU");
// CPU信息
long[] prevTicks = processor.getSystemCpuLoadTicks();
// 等待1秒...
Util.sleep(1000);
// 默认等待300毫秒...
long time = 300;
Util.sleep(time);
long[] ticks = processor.getSystemCpuLoadTicks();
while (Arrays.toString(prevTicks).equals(Arrays.toString(ticks)) && time < 1000){
time += 25;
Util.sleep(25);
ticks = processor.getSystemCpuLoadTicks();
}
long user = ticks[CentralProcessor.TickType.USER.getIndex()] - prevTicks[CentralProcessor.TickType.USER.getIndex()];
long nice = ticks[CentralProcessor.TickType.NICE.getIndex()] - prevTicks[CentralProcessor.TickType.NICE.getIndex()];
long sys = ticks[CentralProcessor.TickType.SYSTEM.getIndex()] - prevTicks[CentralProcessor.TickType.SYSTEM.getIndex()];