use of com.cubrid.cubridmanager.core.monitoring.task.GetDiagdataTask in project cubrid-manager by CUBRID.
the class StatusMonitorViewPart method getUpdateValue.
/**
* Get update value
*
* @param startRun int
* @return Map<String, String>
*/
private Map<String, String> getUpdateValue(int startRun) {
GetDiagdataTask task = new GetDiagdataTask(site);
if (dbName.trim().length() > 0) {
task.setDbname(dbName);
}
List<String> monitorNameList = new ArrayList<String>();
for (TargetConfig tc : monitorList) {
monitorNameList.add(tc.getMonitorName());
}
task.buildMsg(monitorNameList);
task.setUsingSpecialDelimiter(true);
task.execute();
Map<String, String> resultMap = null;
if (!task.isSuccess()) {
return null;
}
float inter = 0.0f;
if (startRun == 0) {
diagStatusResult = task.getResult();
return diagStatusResult.getDiagStatusResultMap();
} else if (startRun == 1) {
lastSec = Calendar.getInstance();
diagOldOneStatusResult.copy_from(diagStatusResult);
diagStatusResult = task.getResult();
DiagStatusResult diagStatusResultDelta = new DiagStatusResult();
diagStatusResultDelta.getDelta(diagStatusResult, diagOldOneStatusResult);
return diagStatusResultDelta.getDiagStatusResultMap();
} else {
nowSec = Calendar.getInstance();
double interval = (double) (nowSec.getTimeInMillis() - lastSec.getTimeInMillis()) / 1000;
NumberFormat nf = NumberFormat.getInstance();
nf.setMaximumFractionDigits(3);
inter = Float.parseFloat(nf.format(interval));
LOGGER.debug("monitorTimes =" + monitorTimes);
LOGGER.debug("lastSec time =" + lastSec.getTimeInMillis());
LOGGER.debug("nowSec time =" + nowSec.getTimeInMillis());
LOGGER.debug("inter =" + inter);
lastSec = nowSec;
diagOldTwoStatusResult.copy_from(diagOldOneStatusResult);
diagOldOneStatusResult.copy_from(diagStatusResult);
diagStatusResult = task.getResult();
DiagStatusResult diagStatusResultDelta = new DiagStatusResult();
diagStatusResultDelta.getDelta(diagStatusResult, diagOldOneStatusResult, diagOldTwoStatusResult, inter);
resultMap = diagStatusResultDelta.getDiagStatusResultMap();
}
return resultMap;
}
Aggregations