From fca3bfcfee8b04ae2ce2bc9e87fe4b40bec8967c Mon Sep 17 00:00:00 2001 From: Vladislav Eliseev Date: Fri, 17 Jun 2016 16:43:00 +0300 Subject: [PATCH] SRADA-688: removed CustomData charts and related functionality These charts already deprecated and not supported by latest SWAP and protocol versions and not planned to be. Conflicts: org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/logparser/CustomLogParser.java Change-Id: Idbeaf62a6a72fe600700c9b17eef025c7836a4f5 --- .../protocol/ProtocolConstants.java | 5 + .../swap/model/data/CustomData.java | 108 ----------- .../swap/model/data/LogDataFactory.java | 6 - .../ui/timeline/CustomDataDBTable.java | 100 ---------- .../ui/timeline/common/TimelineChartManager.java | 27 --- .../ui/timeline/logparser/CustomLogParser.java | 211 --------------------- 6 files changed, 5 insertions(+), 452 deletions(-) delete mode 100644 org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/model/data/CustomData.java delete mode 100644 org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/CustomDataDBTable.java delete mode 100644 org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/logparser/CustomLogParser.java diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/protocol/ProtocolConstants.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/protocol/ProtocolConstants.java index 4597feb..c024d15 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/protocol/ProtocolConstants.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/protocol/ProtocolConstants.java @@ -81,6 +81,11 @@ public class ProtocolConstants { public static final int MSG_PROBE_SCREENSHOT = 0x0106; public static final int MSG_PROBE_SCENE = 0x0107; public static final int MSG_PROBE_THREAD = 0x0108; + + /** + * @deprecated Not supported by swap, protocol and DA GUI already + */ + @Deprecated public static final int MSG_PROBE_CUSTOM = 0x0109; public static final int MSG_PROBE_SYNC = 0x0110; public static final int MSG_PROBE_NETWORK = 0x0111; diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/model/data/CustomData.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/model/data/CustomData.java deleted file mode 100644 index 3076206..0000000 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/model/data/CustomData.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Dynamic Analyzer - * - * Copyright (c) 2013 Samsung Electronics Co., Ltd. All rights reserved. - * - * Contact: - * Jungwook Ryu - * Jooyoul Lee - * Juyoung Kim - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Contributors: - * - S-Core Co., Ltd - * - */ -package org.tizen.dynamicanalyzer.swap.model.data; - -import org.tizen.dynamicanalyzer.model.DATime; - -public class CustomData extends ProbeCommonData { - - protected int handle = 0; // protocol 3.0 - protected int type = 0; // protocol 3.0 - protected String name = null; // protocol 3.0 - protected int color = 0; // protocol 3.0 - protected double value = 0; // protocol 3.0 - - public CustomData() { - } - - @Override - public CustomData clone() throws CloneNotSupportedException { - CustomData log = (CustomData) super.clone(); - log.handle = this.handle; - log.type = this.type; - log.name = this.name; - log.color = this.color; - log.value = this.value; - - return log; - } - - @Override - protected boolean parse(DATime startTime) { - super.parse(startTime); - - // start of protocol 3.0 - handle = getInt(); - type = getInt(); - name = getString(); - color = getInt(); - value = getDouble(); - // end of protocol 3.0 - - return true; - } - - public int getHandle() { - return handle; - } - - public void setHandle(int handle) { - this.handle = handle; - } - - public int getType() { - return type; - } - - public void setType(int type) { - this.type = type; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public int getColor() { - return color; - } - - public void setColor(int color) { - this.color = color; - } - - public double getValue() { - return value; - } - - public void setValue(double value) { - this.value = value; - } -} diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/model/data/LogDataFactory.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/model/data/LogDataFactory.java index ae1f37b..b726a80 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/model/data/LogDataFactory.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/model/data/LogDataFactory.java @@ -145,9 +145,6 @@ public class LogDataFactory { case ProtocolConstants.MSG_PROBE_SCENE: // protocol 3.0 output = new SceneData(); break; - case ProtocolConstants.MSG_PROBE_CUSTOM: // protocol 3.0 - output = new CustomData(); - break; default: // unknown message Logger.error("Unknown message ID(%d)", msgID); break; @@ -198,9 +195,6 @@ public class LogDataFactory { case ProtocolConstants.MSG_PROBE_THREAD: // protocol 3.0 formatName = "Thread"; break; - case ProtocolConstants.MSG_PROBE_CUSTOM: // protocol 3.0 - formatName = "CustomChart"; - break; case ProtocolConstants.MSG_PROBE_SYNC: // protocol 3.0 formatName = "Sync"; break; diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/CustomDataDBTable.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/CustomDataDBTable.java deleted file mode 100644 index f853224..0000000 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/CustomDataDBTable.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Dynamic Analyzer - * - * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. - * - * Contact: - * Jungwook Ryu - * Juyoung Kim - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Contributors: - * - S-Core Co., Ltd - * - */ - -package org.tizen.dynamicanalyzer.ui.timeline; - -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.List; - -import org.tizen.dynamicanalyzer.database.DBColumn; -import org.tizen.dynamicanalyzer.database.DBConstants; -import org.tizen.dynamicanalyzer.database.DBTable; -import org.tizen.dynamicanalyzer.util.Logger; - -public class CustomDataDBTable extends DBTable { - private static final String TABLENAME = "TIMELINE_CUSTOM_DATA"; - - public static enum COLUMN { - TIME, - CHART_HANDLE, - CHART_VALUE - } - - public static final String TIME = "TIME"; - public static final String CHART_HANDLE = "CHART_HANDLE"; - public static final String CHART_VALUE = "CHART_VALUE"; - - @Override - public String getTableName() { - return TABLENAME; - } - - public CustomDataDBTable() { - addColumn(new DBColumn(TIME, DBConstants.NOT_NULL, DBConstants.DBTYPE_LONG)); - addColumn(new DBColumn(CHART_HANDLE, DBConstants.NOT_NULL, DBConstants.DBTYPE_INT4)); - addColumn(new DBColumn(CHART_VALUE, DBConstants.NOT_NULL, DBConstants.DBTYPE_FLOAT)); - setIndexColumn(COLUMN.TIME.ordinal()); - } - - @Override - public boolean prepare(PreparedStatement prep, List rowData) { - boolean isPrepared = true; - - int columnsize = getColumnSize(); - if (columnsize != rowData.size()) { - isPrepared = false; - } else { - try { - prep.setLong(1, (Long) (rowData.get(COLUMN.TIME.ordinal()))); - prep.setInt(2, (Integer) (rowData.get(COLUMN.CHART_HANDLE.ordinal()))); - prep.setFloat(3, (Float) (rowData.get(COLUMN.CHART_VALUE.ordinal()))); - } catch (SQLException e) { - Logger.exception(e); - isPrepared = false; - } - } - - return isPrepared; - } - - @Override - public List extractDataFromResultSet(ResultSet rs) { - List row = new ArrayList(); - try { - row.add(Long.valueOf(rs.getLong(1))); - row.add(Integer.valueOf(rs.getInt(2))); - row.add(Float.valueOf(rs.getFloat(3))); - } catch (SQLException e) { - Logger.exception(e); - return null; - } - - return row; - } -} \ No newline at end of file diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/common/TimelineChartManager.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/common/TimelineChartManager.java index f27fcfd..08de273 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/common/TimelineChartManager.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/common/TimelineChartManager.java @@ -63,7 +63,6 @@ import org.tizen.dynamicanalyzer.ui.common.TimelineChartMouseEventListener; import org.tizen.dynamicanalyzer.ui.common.TimelineChartMouseTrackAdapter; import org.tizen.dynamicanalyzer.ui.info.screenshot.ScreenshotDataManager; import org.tizen.dynamicanalyzer.ui.memory.data.MemoryDataManager; -import org.tizen.dynamicanalyzer.ui.timeline.CustomDataDBTable; import org.tizen.dynamicanalyzer.ui.timeline.LifeCycleDBTable; import org.tizen.dynamicanalyzer.ui.timeline.SystemDataDBTable; import org.tizen.dynamicanalyzer.ui.timeline.TargetProcessDBTable; @@ -82,7 +81,6 @@ import org.tizen.dynamicanalyzer.ui.timeline.chart.SystemMemoryChart; import org.tizen.dynamicanalyzer.ui.timeline.chart.TimelineChart; import org.tizen.dynamicanalyzer.ui.timeline.chart.UIEventChart; import org.tizen.dynamicanalyzer.ui.timeline.chart.UserCustomChart; -import org.tizen.dynamicanalyzer.ui.timeline.logparser.CustomLogParser; import org.tizen.dynamicanalyzer.ui.timeline.logparser.LifecycleLogParser; import org.tizen.dynamicanalyzer.ui.toolbar.Toolbar; import org.tizen.dynamicanalyzer.util.Logger; @@ -105,12 +103,10 @@ public class TimelineChartManager extends PageDataManager implements IDAChartSer private HashMap customChartMap; private DAChartBoard chartBoard = null; - private CustomLogParser customLogParser = null; private final LifecycleLogParser lifecycleLogParser = LifecycleLogParser.getInstance(); private SystemDataDBTable systemDataTable = null; private UIEventDBTable uiEventDBTable = null; - private CustomDataDBTable customDataDBTable = null; private TargetProcessDBTable targetProcessDBTable = null; private LifeCycleDBTable lifeCycleDBTable = null; @@ -145,11 +141,9 @@ public class TimelineChartManager extends PageDataManager implements IDAChartSer systemDataTable = new SystemDataDBTable(); uiEventDBTable = new UIEventDBTable(); - customDataDBTable = new CustomDataDBTable(); targetProcessDBTable = new TargetProcessDBTable(); lifeCycleDBTable = new LifeCycleDBTable(); - customLogParser = new CustomLogParser(this, makeInserter(customDataDBTable)); systemDBInserter = makeInserter(systemDataTable); targetProcessDBInserter = makeInserter(targetProcessDBTable); uiEventDBInserter = makeInserter(uiEventDBTable); @@ -342,7 +336,6 @@ public class TimelineChartManager extends PageDataManager implements IDAChartSer chartList.clear(); loadSavedChartList(); customChartMap.clear(); - customLogParser.clear(); allocByteMap.clear(); libraryAllocByteMap.clear(); @@ -707,17 +700,6 @@ public class TimelineChartManager extends PageDataManager implements IDAChartSer } } - public List> getCustomDataFromDB(long start, long end) { - String where = "WHERE TIME BETWEEN " + start + " AND " + end + " ORDER BY TIME"; - List> result = customDataDBTable.selectAllColumnData(where); - - if (result != null) { - return result; - } else { - return new ArrayList>(); - } - } - public Map>> getTargetProcessDataFromDB(long start, long end, int targetPID) { Map>> processedResult = new HashMap>>(); @@ -781,7 +763,6 @@ public class TimelineChartManager extends PageDataManager implements IDAChartSer List> systemDBData = getSystemDataFromDB(startTime, endTime); List> uiEventDBData = getUIEventDataFromDB(startTime, endTime); List> screenShotDBData = getScreenShotDataFromDB(startTime, endTime); - List> customDBData = getCustomDataFromDB(startTime, endTime); int selectedPID = 0; if (Toolbar.INSTANCE != null) { @@ -822,10 +803,6 @@ public class TimelineChartManager extends PageDataManager implements IDAChartSer } } - /* - * 3. Make series of custom chart - */ - customLogParser.inputChartSeries(customDBData); } @Override @@ -839,10 +816,6 @@ public class TimelineChartManager extends PageDataManager implements IDAChartSer makeSystemDataTableData(systemLogs, memoryLogs); makeUIEventDBTableData(uiEventLogs); - Logs customLogs = pack.getLogs(ProtocolConstants.MSG_PROBE_CUSTOM); - if (customLogs != null && !customLogs.getRawLogs().isEmpty()) { - customLogParser.parseLogPackage(pack); - } Logs lifecycleLogs = pack.getLogs(ProtocolConstants.MSG_PROBE_LIFECYCLE); if (lifecycleLogs != null && !lifecycleLogs.getRawLogs().isEmpty()) { lifecycleLogParser.parseLogPackage(pack); diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/logparser/CustomLogParser.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/logparser/CustomLogParser.java deleted file mode 100644 index 9cf2521..0000000 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/logparser/CustomLogParser.java +++ /dev/null @@ -1,211 +0,0 @@ -/* - * Dynamic Analyzer - * - * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. - * - * Contact: - * Jungwook Ryu - * Sanghyun Lee - * Juyoung Kim - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Contributors: - * - S-Core Co., Ltd - * - */ - - -package org.tizen.dynamicanalyzer.ui.timeline.logparser; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.eclipse.swt.graphics.Color; -import org.tizen.dynamicanalyzer.database.DBInserter; -import org.tizen.dynamicanalyzer.protocol.ProtocolConstants; -import org.tizen.dynamicanalyzer.resources.ColorResources; -import org.tizen.dynamicanalyzer.swap.logparser.LogPackage; -import org.tizen.dynamicanalyzer.swap.logparser.Logs; -import org.tizen.dynamicanalyzer.swap.model.data.CustomData; -import org.tizen.dynamicanalyzer.swap.model.data.LogData; -import org.tizen.dynamicanalyzer.ui.timeline.CustomDataDBTable; -import org.tizen.dynamicanalyzer.ui.timeline.chart.UserCustomChart; -import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineChartManager; -import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants; -import org.tizen.dynamicanalyzer.util.Logger; -import org.tizen.dynamicanalyzer.widgets.chart.DAChartSeries; -import org.tizen.dynamicanalyzer.widgets.chart.DAChartSeriesItem; - - -public class CustomLogParser { - private static final String API_NAME_CREATE_CHART = "da_create_chart"; //$NON-NLS-1$ - private static final String API_NAME_CREATE_SERIES = "da_create_series"; //$NON-NLS-1$ - private static final String API_NAME_CREATE_DEFAULT_SERIES = "da_create_default_series"; //$NON-NLS-1$ - private static final String API_NAME_DA_LOG = "da_log"; //$NON-NLS-1$ - private static final String API_NAME_TIMER_THREAD = "timerThread"; //$NON-NLS-1$ - - private static final int CUSTOM_COLOR_AUTO = 0; - private static final int CUSTOM_COLOR_BLUE = 1; - private static final int CUSTOM_COLOR_GREEN = 2; - private static final int CUSTOM_COLOR_RED = 3; - private static final int CUSTOM_COLOR_BROWN = 4; - private static final int CUSTOM_COLOR_PURPLE = 5; - private static final int CUSTOM_COLOR_NAVY = 6; - private static final int CUSTOM_COLOR_CHOCOLATE = 7; - private static final int CUSTOM_COLOR_INDIGO = 8; - private static final int CUSTOM_COLOR_MAGNETA = 9; - private static final int CUSTOM_COLOR_TEAL = 10; - - private TimelineChartManager chartManager = null; - private Map customChartSeriesMap = new HashMap(); - - private DBInserter customDBInserter = null; - - public CustomLogParser(TimelineChartManager parent, DBInserter inserter) { - chartManager = parent; - - customDBInserter = inserter; - } - - public void parseLogPackage(LogPackage logPack) { - Logs logs = logPack.getLogs(ProtocolConstants.MSG_PROBE_CUSTOM); - List logList = logs.getRawLogs(); - - List> customDataList = new ArrayList>(); - for (LogData log : logList) { - parseLog((CustomData)log, customDataList); - } - - /* - * Add to CustomDataDB - */ - customDBInserter.pushData(customDataList); - } - - private void parseLog(CustomData log, List> customDataList) { - String apiName = log.getApiName(); - - if (apiName.equals(API_NAME_CREATE_CHART)) { - long chartHandle = Long.parseLong(log.getReturn()); - String chartName = log.getName(); - chartManager.addCustomChart(new UserCustomChart((int) chartHandle, chartName)); - } else if (apiName.equals(API_NAME_CREATE_SERIES)) { - int chartType = log.getHandle(); - UserCustomChart chart = (UserCustomChart) chartManager.getChartInstance(chartType); - if (chart == null) { - Logger.debug("CustomLogParser.java : unrecognized chart handle"); //$NON-NLS-1$ - return; - } - - long seriesHandle = Long.parseLong(log.getReturn()); - int seriesStyle = log.getType(); - String seriesName = log.getName(); - int colorIndex = log.getColor(); - if (colorIndex == CUSTOM_COLOR_AUTO) { - colorIndex = chart.getUnusedColorIndex(); - } - Color seriesColor = getCustomColor(colorIndex); - if (seriesColor == null) { - Logger.debug("CustomLogParser.java : undefined custom color"); //$NON-NLS-1$ - return; - } - - DAChartSeries series = new DAChartSeries(seriesName, seriesStyle, seriesColor); - chart.addTempSeries(series, colorIndex); - customChartSeriesMap.put(seriesHandle, series); - } else if (apiName.equals(API_NAME_CREATE_DEFAULT_SERIES)) { - int chartType = log.getType(); - UserCustomChart chart = (UserCustomChart) chartManager.getChartInstance(chartType); - if (chart == null) { - Logger.debug("unrecognized chart handle"); //$NON-NLS-1$ - return; - } - - long seriesHandle = Long.parseLong(log.getReturn()); - int colorIndex = chart.getUnusedColorIndex(); - String seriesName = log.getName(); - - DAChartSeries series = - new DAChartSeries(seriesName, DAChartSeries.SERIES_STYLE_LINE, - getCustomColor(colorIndex)); - chart.addTempSeries(series, colorIndex); - customChartSeriesMap.put(seriesHandle, series); - } else if (apiName.equals(API_NAME_DA_LOG) || apiName.equals(API_NAME_TIMER_THREAD)) { - long seriesHandle = log.getHandle(); - double time = - Double.parseDouble(Long.toString(log.getTime())) - / TimelineConstants.MEGA_DOUBLE; - double value = log.getValue(); - - /* - * Make data to insert CustomDB - */ - ArrayList dbCustomData = new ArrayList(); - dbCustomData.add(new Long(log.getTime())); - dbCustomData.add(new Integer(log.getHandle())); - dbCustomData.add(new Float(log.getValue())); - customDataList.add(dbCustomData); - - DAChartSeries series = customChartSeriesMap.get(seriesHandle); -// series.addSeriesItem(new DAChartSeriesItem(time, value, String.valueOf(value))); - } - } - - public void clear() { - customChartSeriesMap.clear(); - } - - private Color getCustomColor(int colorType) { - switch (colorType) { - case CUSTOM_COLOR_BLUE: - return ColorResources.BLUE; - case CUSTOM_COLOR_GREEN: - return ColorResources.GREEN; - case CUSTOM_COLOR_RED: - return ColorResources.RED; - case CUSTOM_COLOR_BROWN: - return ColorResources.BROWN; - case CUSTOM_COLOR_PURPLE: - return ColorResources.PURPLE; - case CUSTOM_COLOR_NAVY: - return ColorResources.NAVY; - case CUSTOM_COLOR_CHOCOLATE: - return ColorResources.CHOCOLATE; - case CUSTOM_COLOR_INDIGO: - return ColorResources.INDIGO; - case CUSTOM_COLOR_MAGNETA: - return ColorResources.MAGNETA; - case CUSTOM_COLOR_TEAL: - return ColorResources.TEAL; - default: - return null; - } - } - - public void inputChartSeries(List> customDBData) { - for (int i = 0; i < customDBData.size(); i++) { - List row = customDBData.get(i); - - double time = (Long)row.get(CustomDataDBTable.COLUMN.TIME.ordinal()) - / TimelineConstants.MEGA_DOUBLE; - long seriesHandle = (Integer)row.get(CustomDataDBTable.COLUMN.CHART_HANDLE.ordinal()); - double value = (Float)row.get(CustomDataDBTable.COLUMN.CHART_VALUE.ordinal()); - - DAChartSeries series = customChartSeriesMap.get(seriesHandle); - series.addSeriesItem(new DAChartSeriesItem(time, value, String.valueOf(value))); - } - } -} -- 2.7.4