import org.eclipse.swt.widgets.Listener;
import org.tizen.dynamicanalyzer.common.AnalyzerManager;
import org.tizen.dynamicanalyzer.common.DASelectionData;
-import org.tizen.dynamicanalyzer.constant.CommonConstants;
import org.tizen.dynamicanalyzer.nl.InformationViewLabels;
import org.tizen.dynamicanalyzer.project.Project;
import org.tizen.dynamicanalyzer.resources.ColorResources;
import org.tizen.dynamicanalyzer.resources.FontResources;
import org.tizen.dynamicanalyzer.resources.ImageResources;
-import org.tizen.dynamicanalyzer.sql.SqlManager;
import org.tizen.dynamicanalyzer.swap.logparser.DataManagerRegistry;
import org.tizen.dynamicanalyzer.swap.model.data.LogData;
-import org.tizen.dynamicanalyzer.swap.model.data.SystemData;
import org.tizen.dynamicanalyzer.ui.opengl.GLPage;
import org.tizen.dynamicanalyzer.ui.page.ScreenshotTabComposite;
+import org.tizen.dynamicanalyzer.ui.timeline.SystemDataDBTable;
+import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineChartManager;
import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea;
import org.tizen.dynamicanalyzer.ui.widgets.table.DATableComposite;
import org.tizen.dynamicanalyzer.ui.widgets.table.DATableDataFormat;
}
private void computeData() {
- LogData input = SqlManager.getInstance().getCpuRates(startTime, 1);
- if (null == input) {
- input = SqlManager.getInstance().getCpuRates(startTime, 2);
- if (null == input) {
- return;
- }
+ List<Object> row = TimelineChartManager.getInstance().getSystemDataFromDB(startTime);
+ if (row.isEmpty()) {
+ return;
}
- String[] cpuRates = ((SystemData) input).getCpuLoad().split(CommonConstants.COMMA);
- cpuUsage.clear();
- for (int i = 0; i < cpuRates.length; i++) {
- String cpu = cpuRates[i].trim();
- long value = (long) Float.parseFloat(cpu);
+
+ @SuppressWarnings("unchecked")
+ List<Object> cpuLoadList = (List<Object>) row.get(SystemDataDBTable.COLUMN.CPU_LOAD
+ .ordinal());
+ for (int ii = 0; ii < cpuLoadList.size(); ii++) {
+ double cpu = (Double)cpuLoadList.get(ii);
+ long value = (long)cpu;
cpuUsage.add(value);
}
-
+
long totalMem = AnalyzerManager.getProject().getDeviceStatusInfo().getSystemMemorySize();
maxMem = totalMem;
return new ArrayList<List<Object>>();
}
}
+
+ public List<Object> getSystemDataFromDB(long time) {
+ String where = "where TIME = (SELECT MAX(TIME) FROM TIMELINE_SYSTEM_DATA WHERE TIME <= " + time + ")";
+ List<List<Object>> result = systemDataTable.selectData(null, where);
+
+ if (result == null || result.isEmpty()) {
+ where = "where TIME = (SELECT MIN(time) FROM TIMELINE_SYSTEM_DATA)";
+ result = systemDataTable.selectData(null, where);
+ if (result == null || result.isEmpty()) {
+ return new ArrayList<Object>();
+ } else {
+ return result.get(0);
+ }
+ } else {
+ return result.get(0);
+ }
+ }
public List<List<Object>> getUIEventDataFromDB(long start, long end) {
String where = "where TIME BETWEEN " + start + " AND " + end + " ORDER BY " + UIEventDBTable.TIME;
@Override
public void updateView(DAViewData data) {
if (data instanceof DASelectionData) {
- timelineChartManager.makeChartSeries(AnalyzerUtil.translateSecToMicroSec(chartBoard.getVisibleStartTime()),
- AnalyzerUtil.translateSecToMicroSec(chartBoard.getVisibleEndTime()));
-
DASelectionData selData = (DASelectionData) data;
long start = selData.getStartTime();
DAChartPlotIntervalMarker intervalMarker = (DAChartPlotIntervalMarker) chartBoard
.getMarkers().get(UICommonConstants.SELECTION_MARKER_INDEX);
intervalMarker.setInterval(startTime, endTime);
+
+ timelineChartManager.makeChartSeries(AnalyzerUtil.translateSecToMicroSec(chartBoard.getVisibleStartTime()),
+ AnalyzerUtil.translateSecToMicroSec(chartBoard.getVisibleEndTime()));
}
}