use of com.cubrid.cubridmanager.core.monitoring.model.DbStatDumpData in project cubrid-manager by CUBRID.
the class DatabaseDashboardEditor method getDbHitRationTaskValue.
/**
* Get update value
*
* @param startRun int
* @return Map<String, String>
*/
private TreeMap<String, String> getDbHitRationTaskValue(int startRun) {
final CommonQueryTask<DbStatDumpData> task = new CommonQueryTask<DbStatDumpData>(database.getServer().getServerInfo(), CommonSendMsg.getCommonDatabaseSendMsg(), diagStatusResult);
task.setDbName(database.getName());
task.execute();
TreeMap<String, String> resultMap = null;
if (startRun == 0) {
diagStatusResult = task.getResultModel();
return convertMapKey(diagStatusResult.getDiagStatusResultMap());
} else if (startRun == 1) {
lastSec = Calendar.getInstance();
diagOldOneStatusResult.copy_from(diagStatusResult);
diagStatusResult = task.getResultModel();
DbStatDumpData brokerDiagDataDelta = new DbStatDumpData();
brokerDiagDataDelta.getDelta(diagStatusResult, diagOldOneStatusResult);
return convertMapKey(brokerDiagDataDelta.getDiagStatusResultMap());
} else {
nowSec = Calendar.getInstance();
double interval = (double) (nowSec.getTimeInMillis() - lastSec.getTimeInMillis()) / 1000;
lastSec = nowSec;
diagOldTwoStatusResult.copy_from(diagOldOneStatusResult);
diagOldOneStatusResult.copy_from(diagStatusResult);
diagStatusResult = task.getResultModel();
DbStatDumpData diagStatusResultDelta = new DbStatDumpData();
diagStatusResultDelta.getDelta(diagStatusResult, diagOldOneStatusResult, diagOldTwoStatusResult, (float) interval);
resultMap = convertMapKey(diagStatusResultDelta.getDiagStatusResultMap());
//these filed user the data from task directly
resultMap.put("num_data_page_fetches", diagStatusResult.getNum_data_page_fetches());
resultMap.put("num_data_page_dirties", diagStatusResult.getNum_data_page_dirties());
resultMap.put("num_data_page_ioreads", diagStatusResult.getNum_file_ioreads());
resultMap.put("num_data_page_iowrites", diagStatusResult.getNum_file_iowrites());
}
task.finish();
return resultMap;
}
use of com.cubrid.cubridmanager.core.monitoring.model.DbStatDumpData in project cubrid-manager by CUBRID.
the class DbDashboardHistoryViewPart method loadDatabaseChart.
/**
* Load an instance of ChartCompositePart stand for database monitor info
*
* @param parent an instance of Composite
*/
private void loadDatabaseChart(Composite parent) {
dbStatComp = new Composite(parent, SWT.NULL);
dbStatComp.setLayout(new GridLayout());
dbStatComp.setLayoutData(new GridData(GridData.FILL_BOTH));
Group dbGrp = new Group(dbStatComp, SWT.NONE);
dbGrp.setText(Messages.dbDatabaseStatusSeriesGroupName);
GridLayout layoutGrp = new GridLayout();
layoutGrp.verticalSpacing = 0;
layoutGrp.horizontalSpacing = 0;
layoutGrp.marginLeft = 0;
layoutGrp.marginRight = 0;
layoutGrp.marginTop = 0;
layoutGrp.marginBottom = 0;
dbGrp.setLayout(layoutGrp);
GridData gridData = new GridData(GridData.FILL_BOTH);
dbGrp.setLayoutData(gridData);
DbStatDumpData dbStatDumpData = new DbStatDumpData();
TreeMap<String, String> map = convertMapKey(dbStatDumpData.getDiagStatusResultMap());
dbStatChartPart = new ChartCompositePart(dbGrp, map);
for (Map.Entry<String, String> entry : map.entrySet()) {
String key = entry.getKey();
ShowSetting showSetting = dbStatChartPart.getSettingMap().get(key);
ShowSettingMatching.match(key, showSetting, MonitorType.DATABASE);
}
dbStatChartPart.loadContent();
JFreeChart chart = (JFreeChart) dbStatChartPart.getChart();
chart.setBorderVisible(false);
XYPlot xyplot = (XYPlot) dbStatChartPart.getChart().getPlot();
DateAxis dateaxis = (DateAxis) xyplot.getDomainAxis();
dateaxis.setFixedAutoRange(300000d);
dateaxis.setLowerMargin(0.0D);
dateaxis.setUpperMargin(0.0D);
dateaxis.setVisible(true);
xyplot.getRangeAxis().setVisible(true);
XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) xyplot.getRenderer();
renderer.setURLGenerator(null);
renderer.setBaseToolTipGenerator(null);
}
use of com.cubrid.cubridmanager.core.monitoring.model.DbStatDumpData in project cubrid-manager by CUBRID.
the class DatabaseDashboardViewPart method loadDatabaseChart.
/**
* Load an instance of ChartCompositePart stand for database monitor info
*
* @param parent an instance of Composite
*/
private void loadDatabaseChart(Composite parent) {
dbStatComp = new Composite(parent, SWT.NULL);
dbStatComp.setLayout(new GridLayout());
dbStatComp.setLayoutData(new GridData(GridData.FILL_BOTH));
Group dbGrp = new Group(dbStatComp, SWT.NONE);
dbGrp.setText(Messages.dbDatabaseStatusSeriesGroupName);
GridLayout layoutGrp = new GridLayout();
layoutGrp.verticalSpacing = 0;
layoutGrp.horizontalSpacing = 0;
layoutGrp.marginLeft = 0;
layoutGrp.marginRight = 0;
layoutGrp.marginTop = 0;
layoutGrp.marginBottom = 0;
dbGrp.setLayout(layoutGrp);
GridData gridData = new GridData(GridData.FILL_BOTH);
dbGrp.setLayoutData(gridData);
DbStatDumpData dbStatDumpData = new DbStatDumpData();
TreeMap<String, String> map = convertMapKey(dbStatDumpData.getDiagStatusResultMap());
dbStatChartPart = new ChartCompositePart(dbGrp, map);
for (Map.Entry<String, String> entry : map.entrySet()) {
String key = entry.getKey();
ShowSetting showSetting = dbStatChartPart.getSettingMap().get(key);
ShowSettingMatching.match(key, showSetting, MonitorType.DATABASE);
}
dbStatChartPart.loadContent();
JFreeChart chart = (JFreeChart) dbStatChartPart.getChart();
chart.setBorderVisible(false);
XYPlot xyplot = (XYPlot) dbStatChartPart.getChart().getPlot();
DateAxis dateaxis = (DateAxis) xyplot.getDomainAxis();
dateaxis.setFixedAutoRange(300000d);
dateaxis.setLowerMargin(0.0D);
dateaxis.setUpperMargin(0.0D);
dateaxis.setVisible(false);
XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) xyplot.getRenderer();
renderer.setURLGenerator(null);
renderer.setBaseToolTipGenerator(null);
}
use of com.cubrid.cubridmanager.core.monitoring.model.DbStatDumpData in project cubrid-manager by CUBRID.
the class DatabaseDataProvider method performDbdumpTask.
/**
* Perform the task of dbdump
*
* @param updateMap an instance of Map
*/
public void performDbdumpTask(Map<IDiagPara, String> updateMap) {
DbStatDumpData dbStatDumpResult = dbStatDumptask == null ? null : dbStatDumptask.getResultModel();
if (dbStatDumpResult == null) {
return;
}
if (!dbStatDumpResult.getStatus()) {
String detailMsg = "can not get database dump information.";
showErrorMsg(dbStatDumpResult.getNote(), detailMsg);
return;
}
float inter = 0.0f;
if (dbdumpRequestCount == 0) {
dbStatDumpOldOneResult = new DbStatDumpData();
dbStatDumpOldTwoResult = new DbStatDumpData();
dbdumpRequestCount++;
dbStatDumpOldOneResult.copy_from(dbStatDumpResult);
} else if (dbdumpRequestCount == 1) {
lastSec = Calendar.getInstance();
DbStatDumpData dbStatDumpDataDelta = new DbStatDumpData();
dbStatDumpDataDelta.getDelta(dbStatDumpResult, dbStatDumpOldOneResult);
updateMap.putAll(dbStatDumpDataDelta.getDiagStatusResultMap());
dbdumpRequestCount++;
dbStatDumpOldTwoResult.copy_from(dbStatDumpOldOneResult);
dbStatDumpOldOneResult.copy_from(dbStatDumpResult);
} else {
nowSec = Calendar.getInstance();
double interval = (double) (nowSec.getTimeInMillis() - lastSec.getTimeInMillis()) / 1000;
inter = (float) interval;
lastSec = nowSec;
DbStatDumpData dbStatDumpDataDelta = new DbStatDumpData();
dbStatDumpDataDelta.getDelta(dbStatDumpResult, dbStatDumpOldOneResult, dbStatDumpOldTwoResult, inter);
updateMap.putAll(dbStatDumpDataDelta.getDiagStatusResultMap());
dbStatDumpOldTwoResult.copy_from(dbStatDumpOldOneResult);
dbStatDumpOldOneResult.copy_from(dbStatDumpResult);
}
}
use of com.cubrid.cubridmanager.core.monitoring.model.DbStatDumpData in project cubrid-manager by CUBRID.
the class DbStatusDumpMonitorViewPart method getUpdateValue.
/**
* Get update value
*
* @param startRun int
* @return Map<String, String>
*/
private TreeMap<String, String> getUpdateValue(int startRun) {
ServerInfo serverInfo = cubridNode.getServer().getServerInfo();
String dbName = dbCombo.getSelectedDb();
final CommonQueryTask<DbStatDumpData> task = new CommonQueryTask<DbStatDumpData>(serverInfo, CommonSendMsg.getCommonDatabaseSendMsg(), diagStatusResult);
task.setDbName(dbName);
task.execute();
TreeMap<String, String> resultMap = null;
float inter = 0.0f;
if (startRun == 0) {
diagStatusResult = task.getResultModel();
if (!diagStatusResult.getStatus()) {
if (interruptSameDbReq) {
if (this.dbName == null || this.dbName.equals(dbName)) {
return convertMapKey(diagStatusResult.getDiagStatusResultMap());
} else {
interruptSameDbReq = false;
}
} else {
showErrorMsg(diagStatusResult, dbName);
}
}
return convertMapKey(diagStatusResult.getDiagStatusResultMap());
} else if (startRun == 1) {
lastSec = Calendar.getInstance();
diagOldOneStatusResult.copy_from(diagStatusResult);
diagStatusResult = task.getResultModel();
if (!diagStatusResult.getStatus()) {
if (interruptSameDbReq) {
if (this.dbName == null || this.dbName.equals(dbName)) {
return convertMapKey(diagStatusResult.getDiagStatusResultMap());
} else {
interruptSameDbReq = false;
}
} else {
showErrorMsg(diagStatusResult, dbName);
}
}
DbStatDumpData brokerDiagDataDelta = new DbStatDumpData();
brokerDiagDataDelta.getDelta(diagStatusResult, diagOldOneStatusResult);
return convertMapKey(brokerDiagDataDelta.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));
lastSec = nowSec;
diagOldTwoStatusResult.copy_from(diagOldOneStatusResult);
diagOldOneStatusResult.copy_from(diagStatusResult);
diagStatusResult = task.getResultModel();
if (!diagStatusResult.getStatus()) {
if (interruptSameDbReq) {
if (this.dbName == null || this.dbName.equals(dbName)) {
return convertMapKey(diagStatusResult.getDiagStatusResultMap());
} else {
interruptSameDbReq = false;
}
} else {
showErrorMsg(diagStatusResult, dbName);
}
}
DbStatDumpData diagStatusResultDelta = new DbStatDumpData();
diagStatusResultDelta.getDelta(diagStatusResult, diagOldOneStatusResult, diagOldTwoStatusResult, inter);
resultMap = convertMapKey(diagStatusResultDelta.getDiagStatusResultMap());
}
return resultMap;
}
Aggregations