/* custom log */
public static final int CUSTOM_HANDLE = 11;
- public static final int CUSTOM_TEXT = 12;
+ public static final int CUSTOM_TYPE = 12;
+ public static final int CUSTOM_TEXT = 13;
+ public static final int CUSTOM_COLOR = 14;
+ public static final int CUSTOM_VALUE = 15;
/* Common Column Size */
package org.tizen.dynamicanalyzer.timeline;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
+import org.eclipse.swt.graphics.Color;
+import org.tizen.dynamicanalyzer.ColorResources;
import org.tizen.dynamicanalyzer.constants.LogCenterConstants;
import org.tizen.dynamicanalyzer.model.LogPackage;
import org.tizen.dynamicanalyzer.model.Logs;
import org.tizen.dynamicanalyzer.timeline.chart.UserCustomChart;
+import org.tizen.dynamicanalyzer.widgets.chart.DACustomChartSeries;
+import org.tizen.dynamicanalyzer.widgets.chart.DACustomChartSeriesItem;
public class CustomLogParser {
private static final String API_NAME_CREATE_CHART = "da_create_chart"; //$NON-NLS-1$
private static final String API_NAME_TIMER_THREAD = "timerThread"; //$NON-NLS-1$
private static TimelineChartManager chartManager = TimelineChartManager.getInstance();
+ private static Map<Integer, DACustomChartSeries> customChartSeriesMap = new HashMap<Integer, DACustomChartSeries>();
public static void parsingLogPackage(LogPackage logPack) {
if(!isAbleToParse(logPack, LogCenterConstants.LOG_CUSTOM)) {
String apiName = log.get(LogCenterConstants.APINAME_INDEX);
if(apiName.equals(API_NAME_CREATE_CHART)) {
- int chartHandle = Integer.parseInt(log.get(LogCenterConstants.CUSTOM_HANDLE));
+ int chartHandle = Integer.parseInt(log.get(LogCenterConstants.RETURN_INDEX));
String chartName = log.get(LogCenterConstants.CUSTOM_TEXT);
chartManager.addCustomChart(new UserCustomChart(chartHandle, chartName));
+ } else if(apiName.equals(API_NAME_CREATE_SERIES)) {
+ int chartType = Integer.parseInt(log.get(LogCenterConstants.CUSTOM_HANDLE));
+ UserCustomChart chart = (UserCustomChart)chartManager.getChartInstance(chartType);
+ if(chart.getSeriesNum() >= 4) {
+ return;
}
- }
+
+ int seriesHandle = Integer.parseInt(log.get(LogCenterConstants.RETURN_INDEX));
+ int seriesType = Integer.parseInt(log.get(LogCenterConstants.CUSTOM_TYPE));
+ String seriesName = log.get(LogCenterConstants.CUSTOM_TEXT);
+ Color seriesColor = getCustomColor(Integer.parseInt(log.get(LogCenterConstants.CUSTOM_COLOR)));
+ DACustomChartSeries series = new DACustomChartSeries(seriesName, seriesType, seriesColor);
+
+ chart.addSeries(series);
+ customChartSeriesMap.put(seriesHandle, series);
+ } else if(apiName.equals(API_NAME_DA_LOG)) {
+ int seriesHandle = Integer.parseInt(log.get(LogCenterConstants.CUSTOM_HANDLE));
+ long time = Integer.parseInt(log.get(LogCenterConstants.TIME_INDEX));
+ double value = Integer.parseInt(log.get(LogCenterConstants.CUSTOM_VALUE));
+ DACustomChartSeries series = customChartSeriesMap.get(seriesHandle);
+ series.addSeriesItem(new DACustomChartSeriesItem(time, value, series.getName() + " : " + value));
+ }
+ }
private static boolean isAbleToParse(LogPackage logPack, int probeType) {
Logs logList = logPack.getLogs(probeType);
return true;
}
+
+ public static void clear() {
+ customChartSeriesMap.clear();
+ }
+
+ private static Color getCustomColor(int colorType) {
+ switch(colorType) {
+ case 1:
+ return ColorResources.GOLDENROD;
+ case 2:
+ return ColorResources.TURQUOISE;
+ case 3:
+ return ColorResources.VIOLET;
+ case 4:
+ return ColorResources.SLATEBLUE;
+ case 5:
+ return ColorResources.ORANGE;
+ case 6:
+ return ColorResources.YELLOWGREEN;
+ case 7:
+ return ColorResources.SKYBLUE;
+ case 8:
+ return ColorResources.ORCHID;
+ case 9:
+ return ColorResources.SANDYBROWN;
+ case 10:
+ return ColorResources.MEDIUMPURPLE;
+ default:
+ return ColorResources.RED;
+ }
+ }
}
import org.tizen.dynamicanalyzer.timeline.chart.SystemMemoryChart;
import org.tizen.dynamicanalyzer.timeline.chart.TimelineChart;
import org.tizen.dynamicanalyzer.timeline.chart.UserCustomChart;
+import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
import org.tizen.dynamicanalyzer.widgets.chart.DACustomChart;
return chart;
}
- // FIXME this must be removed
public int getChartType(String string) {
if (string.equals(getChartName(TimelineConstants.CHART_TYPE_CPU))) {
return TimelineConstants.CHART_TYPE_CPU;
return TimelineConstants.CHART_TYPE_FILE;
}
else {
- return NOT_DEFAULT_CHART; // FIXME custom?
+ return NOT_DEFAULT_CHART;
}
}
if(!customChartMap.containsKey(chartType)) {
customChartMap.put(chartType, customChart);
chartList.add(customChart);
+ selectedChartList.add(customChart);
+
+
+ StringBuffer strSaveChartNameList = new StringBuffer(""); //$NON-NLS-1$
+ StringBuffer strSaveSelectedChartNameList = new StringBuffer(""); //$NON-NLS-1$
+
+ for (int i = 0; i < chartList.size(); i++) {
+ strSaveChartNameList.append(chartList.get(i).getChartName());
+ strSaveChartNameList.append(","); //$NON-NLS-1$
+ }
+
+ for(int i = 0; i < selectedChartList.size(); i++) {
+ strSaveSelectedChartNameList.append(selectedChartList.get(i).getChartName());
+ strSaveSelectedChartNameList.append(","); //$NON-NLS-1$
+ }
+
+ TimelineComposite timelineComposite = AnalyzerUtil.getTimelineComposite();
+ timelineComposite.resetItems();
+ TimelineMaster.getInstance().redrawTimeTickCanvas();
+
+ ConfigureManager.getInstance().setValue(ConfigureManager.CONFIGUREMANAGER_CHART_AVAILABLE_ITEM_LIST, strSaveChartNameList.toString());
+ ConfigureManager.getInstance().setValue(ConfigureManager.CONFIGUREMANAGER_CHART_SELECTED_ITEM_LIST, strSaveSelectedChartNameList.toString());
}
}
//FIXME chart manager
for (int i = 0; i < chartList.size(); i++) {
- updateChartDataSet(logPack, chartList.get(i).getChartType());
+ int probeType = TimelineUtils.getProbeID(chartList.get(i).getChartType());
+
+ DATimelineChart timelineChart = (DATimelineChart)chartList.get(i);
+ timelineChart.parsingLogPackage(logPack, probeType);
+
}
+
+ logList = logPack.getLogs(LogCenterConstants.LOG_CUSTOM);
+ if(logList == null || logList.getLogs() == null || logList.getLogs().size() <= 0) {
+ return;
+ } else {
+ List<List<String>> customLogs = logList.getLogs();
+ for (List<String> customLog : customLogs) {
+ if (null == customLog || 0 >= customLog.size()) {
+ return;
+ }
+ }
+ }
+
+ System.out.println("logs : " + logPack.getLogs(LogCenterConstants.LOG_CUSTOM).getLogs());
CustomLogParser.parsingLogPackage(logPack);
- }
-
- private void updateChartDataSet(LogPackage logPack, int chartType) {
- int probeType = TimelineUtils.getProbeID(chartType);
- DATimelineChart timelineChart = (DATimelineChart)TimelineChartManager.getInstance().getChartInstance(chartType);
- timelineChart.parsingLogPackage(logPack, probeType);
}
@Override
timelineMaster.clearSelectionMarker();
timelineMaster.clearSnapshot();
SnapshotData.getInstance().clear();
+ CustomLogParser.clear();
}
}
@Override
public void handleClickEvent(DACustomButton button) {
- chartManager.addCustomChart(new UserCustomChart(55, "This is message from H.O.T"));
+ //FIXME test
+ chartManager.addCustomChart(new UserCustomChart(55, "This is a message from H.O.T."));
shell.dispose();
}
};
import org.tizen.dynamicanalyzer.widgets.chart.DACustomChartSeries;
public class UserCustomChart extends DATimelineChart {
- private DACustomChartSeries userSeries0 = null;
- private DACustomChartSeries userSeries1 = null;
- private DACustomChartSeries userSeries2 = null;
- private DACustomChartSeries userSeries3 = null;
-
public UserCustomChart(int chartType, String chartName) {
this.chartType = chartType;
this.chartName = chartName;
@Override
public List<XYSeries> getBaseSeriesList() {
- // TODO Auto-generated method stub
return null;
}
// TODO Auto-generated method stub
}
+
+ public void addSeries(DACustomChartSeries series) {
+ chart.addSeries(series);
+ }
+
+ public int getSeriesNum() {
+ return chart.getSeriesList().size();
+ }
}