Search in sources :

Example 1 with DbStatDumpData

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;
}
Also used : DbStatDumpData(com.cubrid.cubridmanager.core.monitoring.model.DbStatDumpData) CommonQueryTask(com.cubrid.cubridmanager.core.common.task.CommonQueryTask)

Example 2 with DbStatDumpData

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);
}
Also used : Group(org.eclipse.swt.widgets.Group) DateAxis(org.jfree.chart.axis.DateAxis) Composite(org.eclipse.swt.widgets.Composite) HistoryComposite(com.cubrid.cubridmanager.ui.monitoring.editor.internal.HistoryComposite) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) DbStatDumpData(com.cubrid.cubridmanager.core.monitoring.model.DbStatDumpData) XYLineAndShapeRenderer(org.jfree.chart.renderer.xy.XYLineAndShapeRenderer) JFreeChart(org.jfree.chart.JFreeChart) GridLayout(org.eclipse.swt.layout.GridLayout) XYPlot(org.jfree.chart.plot.XYPlot) GridData(org.eclipse.swt.layout.GridData) ShowSetting(com.cubrid.cubridmanager.ui.monitoring.editor.internal.ShowSetting) ChartCompositePart(com.cubrid.cubridmanager.ui.monitoring.editor.internal.ChartCompositePart) Map(java.util.Map) TreeMap(java.util.TreeMap)

Example 3 with DbStatDumpData

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);
}
Also used : Group(org.eclipse.swt.widgets.Group) DateAxis(org.jfree.chart.axis.DateAxis) Composite(org.eclipse.swt.widgets.Composite) HistoryComposite(com.cubrid.cubridmanager.ui.monitoring.editor.internal.HistoryComposite) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) DbStatDumpData(com.cubrid.cubridmanager.core.monitoring.model.DbStatDumpData) XYLineAndShapeRenderer(org.jfree.chart.renderer.xy.XYLineAndShapeRenderer) JFreeChart(org.jfree.chart.JFreeChart) GridLayout(org.eclipse.swt.layout.GridLayout) XYPlot(org.jfree.chart.plot.XYPlot) GridData(org.eclipse.swt.layout.GridData) ShowSetting(com.cubrid.cubridmanager.ui.monitoring.editor.internal.ShowSetting) ChartCompositePart(com.cubrid.cubridmanager.ui.monitoring.editor.internal.ChartCompositePart) Map(java.util.Map) HashMap(java.util.HashMap) TreeMap(java.util.TreeMap)

Example 4 with DbStatDumpData

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);
    }
}
Also used : DbStatDumpData(com.cubrid.cubridmanager.core.monitoring.model.DbStatDumpData)

Example 5 with DbStatDumpData

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;
}
Also used : DbStatDumpData(com.cubrid.cubridmanager.core.monitoring.model.DbStatDumpData) ServerInfo(com.cubrid.cubridmanager.core.common.model.ServerInfo) CommonQueryTask(com.cubrid.cubridmanager.core.common.task.CommonQueryTask) NumberFormat(java.text.NumberFormat)

Aggregations

DbStatDumpData (com.cubrid.cubridmanager.core.monitoring.model.DbStatDumpData)7 ChartCompositePart (com.cubrid.cubridmanager.ui.monitoring.editor.internal.ChartCompositePart)4 HistoryComposite (com.cubrid.cubridmanager.ui.monitoring.editor.internal.HistoryComposite)4 ShowSetting (com.cubrid.cubridmanager.ui.monitoring.editor.internal.ShowSetting)4 Map (java.util.Map)4 TreeMap (java.util.TreeMap)4 Composite (org.eclipse.swt.widgets.Composite)4 GridData (org.eclipse.swt.layout.GridData)3 GridLayout (org.eclipse.swt.layout.GridLayout)3 XYPlot (org.jfree.chart.plot.XYPlot)3 CommonQueryTask (com.cubrid.cubridmanager.core.common.task.CommonQueryTask)2 DatabaseInfo (com.cubrid.cubridmanager.core.cubrid.database.model.DatabaseInfo)2 ArrayList (java.util.ArrayList)2 IPath (org.eclipse.core.runtime.IPath)2 ScrolledComposite (org.eclipse.swt.custom.ScrolledComposite)2 Group (org.eclipse.swt.widgets.Group)2 JFreeChart (org.jfree.chart.JFreeChart)2 DateAxis (org.jfree.chart.axis.DateAxis)2 XYLineAndShapeRenderer (org.jfree.chart.renderer.xy.XYLineAndShapeRenderer)2 DbRunningType (com.cubrid.cubridmanager.core.common.model.DbRunningType)1