.get(index).getY();
double xVal = series.getSeriesItemList()
.get(index).getX();
- text = series.getName() + ":" + yVal
- + series.getSeriesUnit();
+// text = series.getName() + ":" + yVal
+// + series.getSeriesUnit();
+ text = series.getName() + " : " + series.getSeriesItemList()
+ .get(index).getTooltipText();
+// System.out.println(series.getName()+" yVal : " + yVal);
gc.setForeground(tooltip.getLineColor());
gc.setLineStyle(SWT.LINE_DOT);
private double barWidth = SERIES_DEFAULT_BAR_WIDTH;
private double maxX = 0;
private double maxY = 0;
- private String seriesUnit = "";
public DACustomChartSeries(String name, int chartStyle) {
this.name = name;
public double getMaxY() {
return maxY;
}
-
- public String getSeriesUnit() {
- return seriesUnit;
- }
-
- public void setSeriesUnit(String seriesUnit) {
- this.seriesUnit = seriesUnit;
- }
public int getPrevIndexByXvalue(double x){
int current;
private double y = 0;
private double barWidth = -1;
private Color eventColor = null;
+ private String tooltipText;
public DACustomChartSeriesItem(double x, double y) {
- this.setX(x);
- this.setY(y);
+ this.x = x;
+ this.y = y;
}
public DACustomChartSeriesItem(double x, double y, Color eventColor) {
- this.setX(x);
- this.setY(y);
- this.setEventColor(eventColor);
+ this.x = x;
+ this.y = y;
+ this.eventColor = eventColor;
+ }
+
+ public DACustomChartSeriesItem(double x, double y, String tooltipText) {
+ this.x = x;
+ this.y = y;
+ this.tooltipText = tooltipText;
+ }
+
+ public DACustomChartSeriesItem(double x, double y, Color eventColor, String tooltipText) {
+ this.x = x;
+ this.y = y;
+ this.eventColor = eventColor;
+ this.tooltipText = tooltipText;
}
public double getX() {
public void setEventColor(Color eventColor) {
this.eventColor = eventColor;
}
+
+ public String getTooltipText() {
+ return tooltipText;
+ }
+
+ public void setTooltipText(String tooltipText) {
+ this.tooltipText = tooltipText;
+ }
}
public static String TIMELINE_TICK_ADD;
+ public static String UNIT_PERCENTAGE;
+ public static String UNIT_GHZ;
+ public static String UNIT_MB;
+ public static String UNIT_BYTE;
+
+
static {
// initialize resource bundle
NLS.initializeMessages(BUNDLE_NAME, TimelineChartLabels.class);
TIMELINE_MASTER_TERMINATED=Terminated
TIMELINE_TICK_ADD=Add
+UNIT_PERCENTAGE=%
+UNIT_GHZ=GHz
+UNIT_MB=MB
+UNIT_BYTE=Byte
appLoadSeries = new DACustomChartSeries(
TimelineChartLabels.CPU_CHART_SERIES_NAME_APP_LOAD,
- DACustomChartSeries.SERIES_STYLE_LINE,
+ DACustomChartSeries.SERIES_STYLE_AREA,
ColorResources.SERIESE_COLOR_CPU_SYSTEM);
totalLoadSeries = new DACustomChartSeries(
TimelineChartLabels.CPU_CHART_SERIES_NAME_TOTAL_LOAD,
}
appLoadSeries.addSeriesItem(new DACustomChartSeriesItem(time,
- appCpuRate));
+ appCpuRate, String.valueOf(appCpuRate)
+ + TimelineChartLabels.UNIT_PERCENTAGE));
// FIXME
/* for file chart */
e.printStackTrace();
}
- // totalLoadInfo.newXYDataItems.add(new XYDataItem(time,
- // systemAvgLoad));
totalLoadSeries.addSeriesItem(new DACustomChartSeriesItem(time,
- systemAvgLoad));
+ systemAvgLoad, String.valueOf(systemAvgLoad)
+ + TimelineChartLabels.UNIT_PERCENTAGE));
}
}
public DACPUCoreChart() {
chartName = TimelineChartLabels.CPU_CORE_CHART_TITLE;
- /*core 0*/
+ /* core 0 */
coreChartSeriesList.add(new DACustomChartSeries(
TimelineChartLabels.CPU_CORE_CHART_SERIES_NAME_CORE0,
DACustomChartSeries.SERIES_STYLE_LINE,
ColorResources.SERIESE_COLOR_CPUCORE_CORE0));
- /*core 1*/
+ /* core 1 */
coreChartSeriesList.add(new DACustomChartSeries(
TimelineChartLabels.CPU_CORE_CHART_SERIES_NAME_CORE1,
DACustomChartSeries.SERIES_STYLE_LINE,
ColorResources.SERIESE_COLOR_CPUCORE_CORE1));
- /*core 2*/
+ /* core 2 */
coreChartSeriesList.add(new DACustomChartSeries(
TimelineChartLabels.CPU_CORE_CHART_SERIES_NAME_CORE2,
DACustomChartSeries.SERIES_STYLE_LINE,
ColorResources.SERIESE_COLOR_CPUCORE_CORE2));
- /*core 3*/
+ /* core 3 */
coreChartSeriesList.add(new DACustomChartSeries(
TimelineChartLabels.CPU_CORE_CHART_SERIES_NAME_CORE3,
DACustomChartSeries.SERIES_STYLE_LINE,
@Override
public DACustomChart createDAChart(Composite parent) {
chart = new DACustomChart(parent, chartName);
-
- if(null == coreChartSeriesList || coreChartSeriesList.size() != DEFAULT_CORE_SIZE){
+
+ if (null == coreChartSeriesList
+ || coreChartSeriesList.size() != DEFAULT_CORE_SIZE) {
return null;
}
-
- for(int i=0; i<DEFAULT_CORE_SIZE; i++){
+
+ for (int i = 0; i < DEFAULT_CORE_SIZE; i++) {
chart.addSeries(coreChartSeriesList.get(i));
}
-
+
setChartStyle();
chart.getPlot().setAutoHeightRange(false);
chart.getPlot().setAxisRangeY(0, 101);
@Override
public void clear() {
- if(null == coreChartSeriesList){
+ if (null == coreChartSeriesList) {
return;
}
-
- for(int i=0; i<coreChartSeriesList.size(); i++){
+
+ for (int i = 0; i < coreChartSeriesList.size(); i++) {
coreChartSeriesList.get(i).clear();
}
}
// TODO Auto-generated method stub
}
+
private void parsingLog(List<String> log) {
if (null == log || 0 > log.size()) {
return;
}
-
- if (!log.get(LogCenterConstants.DEVICE_SYSTEM_CPU_USAGE_INDEX).isEmpty()) {
+
+ if (!log.get(LogCenterConstants.DEVICE_SYSTEM_CPU_USAGE_INDEX)
+ .isEmpty()) {
long time = 0;
-
+
try {
- time = TimelineUtils.transformLogTimeIntoTimelineTime(Double.parseDouble(log.get(LogCenterConstants.DEVICE_TIME_INDEX))) / TimelineConstants.TIME_US_TO_MS / TimelineConstants.TIME_US_TO_MS;
- String[] cpuRates = log.get(LogCenterConstants.DEVICE_SYSTEM_CPU_USAGE_INDEX).split(","); //$NON-NLS-1$
- if(coreSize == TempConstants.NOT_INITED) {
+ time = TimelineUtils.transformLogTimeIntoTimelineTime(Double
+ .parseDouble(log
+ .get(LogCenterConstants.DEVICE_TIME_INDEX)))
+ / TimelineConstants.TIME_US_TO_MS
+ / TimelineConstants.TIME_US_TO_MS;
+ String[] cpuRates = log.get(
+ LogCenterConstants.DEVICE_SYSTEM_CPU_USAGE_INDEX)
+ .split(","); //$NON-NLS-1$
+ double value = 0;
+ if (coreSize == TempConstants.NOT_INITED) {
coreSize = cpuRates.length - 1;
}
-
- for(int i = 0; i < coreSize; i++) {
- coreChartSeriesList.get(i).addSeriesItem(new DACustomChartSeriesItem(time, Double.parseDouble(cpuRates[i])));
+
+ for (int i = 0; i < coreSize; i++) {
+ value = Double.parseDouble(cpuRates[i]);
+ coreChartSeriesList.get(i).addSeriesItem(
+ new DACustomChartSeriesItem(time, value, String
+ .valueOf(value)
+ + TimelineChartLabels.UNIT_PERCENTAGE));
}
} catch (NumberFormatException ne) {
ne.printStackTrace();
}
}
}
+
@Override
public void parsingLogPackage(LogPackage logPack, int probeType) {
if (!isAbleToParse(logPack, probeType)) {
parsingLog(logs.get(i));
}
}
-
+
public int getCoreSize() {
return coreSize;
}
import org.eclipse.swt.widgets.Composite;
import org.jfree.data.xy.XYSeries;
import org.tizen.dynamicanalyzer.ColorResources;
+import org.tizen.dynamicanalyzer.constants.LogCenterConstants;
import org.tizen.dynamicanalyzer.constants.TimelineConstants;
import org.tizen.dynamicanalyzer.model.LogPackage;
+import org.tizen.dynamicanalyzer.model.Logs;
import org.tizen.dynamicanalyzer.nl.TimelineChartLabels;
+import org.tizen.dynamicanalyzer.utils.TimelineUtils;
import org.tizen.dynamicanalyzer.widgets.chart.DACustomChart;
import org.tizen.dynamicanalyzer.widgets.chart.DACustomChartSeries;
+import org.tizen.dynamicanalyzer.widgets.chart.DACustomChartSeriesItem;
public class DACPUFrequencyChart extends DATimelineChart {
private static DACPUFrequencyChart instance = null;
chart = new DACustomChart(parent, chartName);
chart.addSeries(frequencySeries);
-
+
setChartStyle();
-
+
return chart;
}
@Override
public void parsingLogPackage(LogPackage logPack, int probeType) {
- // TODO Auto-generated method stub
+ if (!isAbleToParse(logPack, probeType)) {
+ return;
+ }
+ Logs logs = logPack.getLogs(probeType);
+ List<List<String>> logList = logs.getLogs();
+ for (int i = 0; i < logList.size(); i++) {
+ parsingLog(logList.get(i));
+ }
}
+ private void parsingLog(List<String> log) {
+ if (null == log || 0 > log.size()) {
+ return;
+ }
+
+ if (!log.get(LogCenterConstants.DEVICE_CPU_FREQUENCY_INDEX).isEmpty()) {
+ long time = 0;
+ double freq0 = 0;
+
+ try {
+ time = TimelineUtils.transformLogTimeIntoTimelineTime(Double
+ .parseDouble(log
+ .get(LogCenterConstants.DEVICE_TIME_INDEX)))
+ / TimelineConstants.TIME_US_TO_MS
+ / TimelineConstants.TIME_US_TO_MS;
+ String[] cpuFreqs = log.get(
+ LogCenterConstants.DEVICE_CPU_FREQUENCY_INDEX).split(
+ ","); //$NON-NLS-1$
+
+ freq0 = Double
+ .parseDouble(String.format(
+ "%.2f",
+ Double.parseDouble(cpuFreqs[0])
+ / (double) (TimelineConstants.BYTE_TO_KBYTE * TimelineConstants.BYTE_TO_KBYTE)));
+ } catch (NumberFormatException ne) {
+ ne.printStackTrace();
+ } catch (NullPointerException ne) {
+ ne.printStackTrace();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ frequencySeries
+ .addSeriesItem(new DACustomChartSeriesItem(time, freq0,
+ String.valueOf(freq0)
+ + TimelineChartLabels.UNIT_GHZ));
+
+ }
+ }
}
public class DAFileChart extends DATimelineChart {
private static DAFileChart instance = null;
-
+
private DACustomChartSeries readSeries;
private DACustomChartSeries writeSeries;
private DACustomChartSeries fdCountSeries;
-
+
public static DAFileChart getInstance() {
if (instance == null) {
instance = new DAFileChart();
return instance;
}
-
+
private DAFileChart() {
chartType = TimelineConstants.CHART_TYPE_FILE;
chartName = TimelineChartLabels.FILE_CHART_TITLE;
-
+
readSeries = new DACustomChartSeries(
TimelineChartLabels.FILE_CHART_SERIES_NAME_READ,
DACustomChartSeries.SERIES_STYLE_BAR,
TimelineChartLabels.FILE_CHART_SERIES_NAME_FD_COUNT,
DACustomChartSeries.SERIES_STYLE_LINE,
ColorResources.SERIESE_COLOR_FILE_FD);
+
}
-
+
@Override
public DACustomChart createDAChart(Composite parent) {
chart = new DACustomChart(parent, chartName);
package org.tizen.dynamicanalyzer.timeline.chart;
import java.awt.Color;
+import java.util.HashMap;
import java.util.List;
import org.eclipse.swt.widgets.Composite;
import org.jfree.data.xy.XYSeries;
import org.tizen.dynamicanalyzer.ColorResources;
+import org.tizen.dynamicanalyzer.constants.LogCenterConstants;
import org.tizen.dynamicanalyzer.constants.TimelineConstants;
import org.tizen.dynamicanalyzer.model.LogPackage;
+import org.tizen.dynamicanalyzer.model.Logs;
import org.tizen.dynamicanalyzer.nl.TimelineChartLabels;
+import org.tizen.dynamicanalyzer.utils.TimelineUtils;
import org.tizen.dynamicanalyzer.widgets.chart.DACustomChart;
import org.tizen.dynamicanalyzer.widgets.chart.DACustomChartSeries;
+import org.tizen.dynamicanalyzer.widgets.chart.DACustomChartSeriesItem;
public class DAHeapChart extends DATimelineChart {
private static DAHeapChart instance = null;
-
+ private final String NIL = "(nil)"; //$NON-NLS-1$
+
private DACustomChartSeries totalAllocationSeries;
private DACustomChartSeries userAllocationSeries;
-
+ private double allocByte = 0;
+ private HashMap<String, Double> allocationSeriesDataSetMap = new HashMap<String, Double>();
+
public static DAHeapChart getInstance() {
if (instance == null) {
instance = new DAHeapChart();
return instance;
}
-
+
private DAHeapChart() {
chartType = TimelineConstants.CHART_TYPE_HEAP;
chartName = TimelineChartLabels.HEAP_CHART_TITLE;
DACustomChartSeries.SERIES_STYLE_AREA,
ColorResources.SERIESE_COLOR_HEAP_USER);
}
-
+
@Override
public DACustomChart createDAChart(Composite parent) {
chart = new DACustomChart(parent, chartName);
@Override
public void parsingLogPackage(LogPackage logPack, int probeType) {
- // TODO Auto-generated method stub
+ if (!isAbleToParse(logPack, probeType)) {
+ return;
+ }
+
+ Logs memoryLogs = logPack.getLogs(LogCenterConstants.LOG_MEMORY);
+ Logs deviceLogs = logPack.getLogs(LogCenterConstants.LOG_DEVICE);
+
+ List<List<String>> memoryLogList = memoryLogs == null ? null
+ : memoryLogs.getLogs();
+ List<List<String>> deviceLogList = deviceLogs == null ? null
+ : deviceLogs.getLogs();
+
+ parsingLog(memoryLogList, deviceLogList);
+ }
+
+ private void parsingLog(List<List<String>> memoryLogList,
+ List<List<String>> deviceLogList) {
+ boolean isUserAllocUpdated = false;
+
+ /* user alloc */
+ if (memoryLogList != null) {
+ int size = memoryLogList.size();
+ for (int i = 0; i < size; i++) {
+ List<String> log = memoryLogList.get(i);
+ if (log != null && log.size() > 0) {
+ int memApiType = 0;
+ int internalFlag = 0;
+ int errorNo = 0;
+
+ try {
+ memApiType = Integer.parseInt(log
+ .get(LogCenterConstants.MEMORY_APITYPE_INDEX));
+ internalFlag = Integer.parseInt(log
+ .get(LogCenterConstants.INTERNAL_FLAG_INDEX));
+ errorNo = Integer.parseInt(log
+ .get(LogCenterConstants.ERROR_INDEX));
+ } catch (NumberFormatException ne) {
+ ne.printStackTrace();
+ }
+
+ if (errorNo == 0
+ && TimelineConstants.MEM_USER == internalFlag) {
+ if (TimelineConstants.MEM_API_TYPE_ALLOC == memApiType
+ || TimelineConstants.MEM_API_TYPE_FREE == memApiType
+ || TimelineConstants.MEM_API_TYPE_MANAGE == memApiType) {
+ long time = 0;
+ try {
+ time = TimelineUtils
+ .transformLogTimeIntoTimelineTime(Double.parseDouble(log
+ .get(LogCenterConstants.TIME_INDEX)))
+ / TimelineConstants.TIME_US_TO_MS
+ / TimelineConstants.TIME_US_TO_MS;
+ } catch (NumberFormatException ne) {
+ ne.printStackTrace();
+ } catch (NullPointerException ne) {
+ ne.printStackTrace();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ isUserAllocUpdated = addNewSeriesUserAllocData(
+ memApiType, time, log);
+ }
+ }
+ }
+ }
+ }
+
+ /* total alloc */
+ if (deviceLogList != null) {
+ int size = deviceLogList.size();
+ for (int i = 0; i < size; i++) {
+ List<String> log = deviceLogList.get(i);
+ if (log != null && log.size() > 0) {
+ if (!log.get(
+ LogCenterConstants.DEVICE_ALLOCATION_SIZE_INDEX)
+ .isEmpty()) {
+ long time = 0;
+ double value = 0;
+ double valueTooltip = 0;
+
+ try {
+ time = TimelineUtils
+ .transformLogTimeIntoTimelineTime(Double.parseDouble(log
+ .get(LogCenterConstants.DEVICE_TIME_INDEX)))
+ / TimelineConstants.TIME_US_TO_MS
+ / TimelineConstants.TIME_US_TO_MS;
+ value = Double
+ .parseDouble(String.format(
+ "%.2f",
+ (Double.parseDouble(log
+ .get(LogCenterConstants.DEVICE_SYSTEM_USED_MEMORY_INDEX)) - allocByte)));
+ valueTooltip = Double
+ .parseDouble(String.format(
+ "%.2f",
+ (Double.parseDouble(log
+ .get(LogCenterConstants.DEVICE_SYSTEM_USED_MEMORY_INDEX)) - allocByte)
+ / (double) (TimelineConstants.BYTE_TO_KBYTE * TimelineConstants.BYTE_TO_KBYTE)));
+ } catch (NumberFormatException ne) {
+ ne.printStackTrace();
+ } catch (NullPointerException ne) {
+ ne.printStackTrace();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ totalAllocationSeries
+ .addSeriesItem(new DACustomChartSeriesItem(
+ time, value, String
+ .valueOf(valueTooltip)
+ + TimelineChartLabels.UNIT_MB));
+ // totalAllocationSeriesDataSet.newXYDataItems.add(new
+ // XYDataItem(time, value));
+
+ if (!isUserAllocUpdated) {
+ // userAllocationSeriesDataSet.newXYDataItems.add(new
+ // XYDataItem(time, allocByte));
+ userAllocationSeries
+ .addSeriesItem(new DACustomChartSeriesItem(
+ time,
+ allocByte,
+ String.valueOf(allocByte)
+ + TimelineChartLabels.UNIT_BYTE));
+ }
+ }
+ }
+ }
+ }
}
+ private boolean addNewSeriesUserAllocData(int fdApiType, long time,
+ List<String> log) {
+ double size = 0;
+
+ String addressString = log.get(LogCenterConstants.MEMORY_ADDR_INDEX);
+ if (addressString.equals(NIL)) {
+ return false;
+ }
+
+ if (TimelineConstants.MEM_API_TYPE_ALLOC == fdApiType) {
+ if (log.get(LogCenterConstants.MEMORY_SIZE_INDEX).isEmpty()) {
+ return false;
+ }
+
+ try {
+ size = Double.parseDouble(log
+ .get(LogCenterConstants.MEMORY_SIZE_INDEX));
+ } catch (NumberFormatException ne) {
+ ne.printStackTrace();
+ }
+
+ allocByte += size;
+ allocationSeriesDataSetMap.put(addressString, size);
+ } else if (TimelineConstants.MEM_API_TYPE_FREE == fdApiType) {
+ if (!allocationSeriesDataSetMap.containsKey(addressString)) {
+ return false;
+ }
+ size = allocationSeriesDataSetMap.get(addressString);
+
+ allocByte -= size;
+ }
+ userAllocationSeries.addSeriesItem(new DACustomChartSeriesItem(time,
+ allocByte, String.valueOf(allocByte)
+ + TimelineChartLabels.UNIT_BYTE));
+ // userAllocationSeriesDataSet.newXYDataItems.add(new XYDataItem(time,
+ // allocByte));
+
+ return true;
+ }
}
import org.eclipse.swt.widgets.Composite;
import org.jfree.data.xy.XYSeries;
import org.tizen.dynamicanalyzer.ColorResources;
+import org.tizen.dynamicanalyzer.constants.LogCenterConstants;
import org.tizen.dynamicanalyzer.constants.TimelineConstants;
import org.tizen.dynamicanalyzer.model.LogPackage;
+import org.tizen.dynamicanalyzer.model.Logs;
import org.tizen.dynamicanalyzer.nl.TimelineChartLabels;
+import org.tizen.dynamicanalyzer.utils.TimelineUtils;
import org.tizen.dynamicanalyzer.widgets.chart.DACustomChart;
import org.tizen.dynamicanalyzer.widgets.chart.DACustomChartSeries;
+import org.tizen.dynamicanalyzer.widgets.chart.DACustomChartSeriesItem;
public class DAProcessMemoryChart extends DATimelineChart {
private static DAProcessMemoryChart instance = null;
-
+
private DACustomChartSeries VSSMemorySeries;
private DACustomChartSeries RSSMemorySeries;
private DACustomChartSeries PSSMemorySeries;
-
+
public static DAProcessMemoryChart getInstance() {
if (instance == null) {
instance = new DAProcessMemoryChart();
return instance;
}
-
+
private DAProcessMemoryChart() {
chartType = TimelineConstants.CHART_TYPE_PROCESS_MEMORY;
chartName = TimelineChartLabels.PROCESS_MEMORY_CHART_TITLE;
-
- VSSMemorySeries = new DACustomChartSeries(
+
+ VSSMemorySeries = new DACustomChartSeries(
TimelineChartLabels.PROCESS_MEMORY_CHART_VSS,
DACustomChartSeries.SERIES_STYLE_AREA,
ColorResources.SERIESE_COLOR_PROCESS_VSS);
- RSSMemorySeries = new DACustomChartSeries(
+ RSSMemorySeries = new DACustomChartSeries(
TimelineChartLabels.PROCESS_MEMORY_CHART_RSS,
DACustomChartSeries.SERIES_STYLE_AREA,
ColorResources.SERIESE_COLOR_PROCESS_RSS);
- PSSMemorySeries = new DACustomChartSeries(
+ PSSMemorySeries = new DACustomChartSeries(
TimelineChartLabels.PROCESS_MEMORY_CHART_PSS,
DACustomChartSeries.SERIES_STYLE_AREA,
ColorResources.SERIESE_COLOR_PROCESS_PSS);
}
-
+
@Override
public DACustomChart createDAChart(Composite parent) {
chart = new DACustomChart(parent, chartName);
@Override
public void parsingLogPackage(LogPackage logPack, int probeType) {
- // TODO Auto-generated method stub
+ if (!isAbleToParse(logPack, probeType)) {
+ return;
+ }
+ Logs logs = logPack.getLogs(probeType);
+ List<List<String>> logList = logs.getLogs();
+ for (int i = 0; i < logList.size(); i++) {
+ parsingLog(logList.get(i));
+ }
}
+ private void parsingLog(List<String> log) {
+ if (null == log || 0 > log.size()) {
+ return;
+ }
+
+ /* VSS */
+ if (!log.get(LogCenterConstants.DEVICE_VSS_MEMORY_INDEX).isEmpty()) {
+ long time = 0;
+ double value = 0;
+
+ try {
+ time = TimelineUtils.transformLogTimeIntoTimelineTime(Double
+ .parseDouble(log
+ .get(LogCenterConstants.DEVICE_TIME_INDEX)))
+ / TimelineConstants.TIME_US_TO_MS
+ / TimelineConstants.TIME_US_TO_MS;
+ value = Double
+ .parseDouble(String.format(
+ "%.2f",
+ Double.parseDouble(log
+ .get(LogCenterConstants.DEVICE_VSS_MEMORY_INDEX))
+ / (double) (TimelineConstants.BYTE_TO_KBYTE * TimelineConstants.BYTE_TO_KBYTE)));
+ } catch (NumberFormatException ne) {
+ ne.printStackTrace();
+ } catch (NullPointerException ne) {
+ ne.printStackTrace();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ VSSMemorySeries
+ .addSeriesItem(new DACustomChartSeriesItem(time, value,
+ String.valueOf(value) + TimelineChartLabels.UNIT_MB));
+
+ }
+
+ /* RSS */
+ if (!log.get(LogCenterConstants.DEVICE_RSS_MEMORY_INDEX).isEmpty()) {
+ long time = 0;
+ double value = 0;
+
+ try {
+ time = Long.parseLong(log
+ .get(LogCenterConstants.DEVICE_TIME_INDEX))
+ / TimelineConstants.TIME_US_TO_MS
+ / TimelineConstants.TIME_US_TO_MS;
+ value = Double
+ .parseDouble(String.format(
+ "%.2f",
+ Double.parseDouble(log
+ .get(LogCenterConstants.DEVICE_RSS_MEMORY_INDEX))
+ / (double) (TimelineConstants.BYTE_TO_KBYTE * TimelineConstants.BYTE_TO_KBYTE)));
+ } catch (NumberFormatException ne) {
+ ne.printStackTrace();
+ } catch (NullPointerException ne) {
+ ne.printStackTrace();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ RSSMemorySeries
+ .addSeriesItem(new DACustomChartSeriesItem(time, value,
+ String.valueOf(value) + TimelineChartLabels.UNIT_MB));
+ }
+
+ /* PSS */
+ if (!log.get(LogCenterConstants.DEVICE_PSS_MEMORY_INDEX).isEmpty()) {
+ long time = 0;
+ double value = 0;
+
+ try {
+ time = Long.parseLong(log
+ .get(LogCenterConstants.DEVICE_TIME_INDEX))
+ / TimelineConstants.TIME_US_TO_MS
+ / TimelineConstants.TIME_US_TO_MS;
+ value = Double
+ .parseDouble(String.format(
+ "%.2f",
+ Double.parseDouble(log
+ .get(LogCenterConstants.DEVICE_PSS_MEMORY_INDEX))
+ / (double) (TimelineConstants.BYTE_TO_KBYTE * TimelineConstants.BYTE_TO_KBYTE)));
+ } catch (NumberFormatException ne) {
+ ne.printStackTrace();
+ } catch (NullPointerException ne) {
+ ne.printStackTrace();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ PSSMemorySeries
+ .addSeriesItem(new DACustomChartSeriesItem(time, value,
+ String.valueOf(value) + TimelineChartLabels.UNIT_MB));
+ }
+ }
}
import org.eclipse.swt.widgets.Composite;
import org.jfree.data.xy.XYSeries;
import org.tizen.dynamicanalyzer.ColorResources;
+import org.tizen.dynamicanalyzer.constants.LogCenterConstants;
import org.tizen.dynamicanalyzer.constants.TimelineConstants;
import org.tizen.dynamicanalyzer.model.LogPackage;
+import org.tizen.dynamicanalyzer.model.Logs;
import org.tizen.dynamicanalyzer.nl.TimelineChartLabels;
+import org.tizen.dynamicanalyzer.timeline.TempConstants;
+import org.tizen.dynamicanalyzer.utils.TimelineUtils;
import org.tizen.dynamicanalyzer.widgets.chart.DACustomChart;
import org.tizen.dynamicanalyzer.widgets.chart.DACustomChartSeries;
+import org.tizen.dynamicanalyzer.widgets.chart.DACustomChartSeriesItem;
public class DASystemMemoryChart extends DATimelineChart {
private static DASystemMemoryChart instance = null;
-
+
private DACustomChartSeries processSeries;
private DACustomChartSeries systemSeries;
private DACustomChartSeries totalSeries;
-
+
public static DASystemMemoryChart getInstance() {
if (instance == null) {
instance = new DASystemMemoryChart();
return instance;
}
-
+
private DASystemMemoryChart() {
chartType = TimelineConstants.CHART_TYPE_SYSTEM_MEMORY;
chartName = TimelineChartLabels.SYSTEM_MEMORY_CHART_TITLE;
-
+
processSeries = new DACustomChartSeries(
TimelineChartLabels.SYSTEM_MEMORY_CHART_SERIES_NAME_PROC_RESIDENT,
DACustomChartSeries.SERIES_STYLE_AREA,
DACustomChartSeries.SERIES_STYLE_AREA,
ColorResources.SERIESE_COLOR_MEMORY_SYS_MAX);
}
-
+
@Override
public DACustomChart createDAChart(Composite parent) {
chart = new DACustomChart(parent, chartName);
- chart.addSeries(processSeries);
- chart.addSeries(systemSeries);
chart.addSeries(totalSeries);
+ chart.addSeries(systemSeries);
+ chart.addSeries(processSeries);
setChartStyle();
-
+
return chart;
}
@Override
public void parsingLogPackage(LogPackage logPack, int probeType) {
- // TODO Auto-generated method stub
+ if (!isAbleToParse(logPack, probeType)) {
+ return;
+ }
+ Logs logs = logPack.getLogs(probeType);
+ List<List<String>> logList = logs.getLogs();
+ for (int i = 0; i < logList.size(); i++) {
+ parsingLog(logList.get(i));
+ }
}
+ private void parsingLog(List<String> log) {
+ if (null == log || 0 > log.size()) {
+ return;
+ }
+
+ /* process */
+ if (!log.get(LogCenterConstants.DEVICE_RSS_MEMORY_INDEX).isEmpty()) {
+ long time = 0;
+ double usage = 0;
+
+ try {
+ time = TimelineUtils.transformLogTimeIntoTimelineTime(Double
+ .parseDouble(log
+ .get(LogCenterConstants.DEVICE_TIME_INDEX)))
+ / TimelineConstants.TIME_US_TO_MS
+ / TimelineConstants.TIME_US_TO_MS;
+ usage = Double
+ .parseDouble(String.format(
+ "%.2f",
+ Double.parseDouble(log
+ .get(LogCenterConstants.DEVICE_RSS_MEMORY_INDEX))
+ / (double) (TimelineConstants.BYTE_TO_KBYTE * TimelineConstants.BYTE_TO_KBYTE)));
+ } catch (NumberFormatException ne) {
+ ne.printStackTrace();
+ } catch (NullPointerException ne) {
+ ne.printStackTrace();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ processSeries
+ .addSeriesItem(new DACustomChartSeriesItem(time, usage,
+ String.valueOf(usage) + TimelineChartLabels.UNIT_MB));
+ }
+
+ /* system & total */
+ if (!log.get(LogCenterConstants.DEVICE_SYSTEM_USED_MEMORY_INDEX)
+ .isEmpty()) {
+ long time = 0;
+ double usage = 0;
+ double total = 0;
+ try {
+ time = TimelineUtils.transformLogTimeIntoTimelineTime(Double
+ .parseDouble(log
+ .get(LogCenterConstants.DEVICE_TIME_INDEX)))
+ / TimelineConstants.TIME_US_TO_MS
+ / TimelineConstants.TIME_US_TO_MS;
+
+ usage = Double
+ .parseDouble(String.format(
+ "%.2f",
+ Double.parseDouble(log
+ .get(LogCenterConstants.DEVICE_SYSTEM_USED_MEMORY_INDEX))
+ / (double) (TimelineConstants.BYTE_TO_KBYTE * TimelineConstants.BYTE_TO_KBYTE)));
+ total = Double
+ .parseDouble(String
+ .format("%.2f",
+ ((double) TempConstants.TOTAL_MEMORY / (double) (1024 * 1024))));
+
+ } catch (NumberFormatException ne) {
+ ne.printStackTrace();
+ } catch (NullPointerException ne) {
+ ne.printStackTrace();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ systemSeries.addSeriesItem(new DACustomChartSeriesItem(time, usage,
+ String.valueOf(usage) + TimelineChartLabels.UNIT_MB));
+ totalSeries.addSeriesItem(new DACustomChartSeriesItem(time, total,
+ String.valueOf(total) + TimelineChartLabels.UNIT_MB));
+ }
+ }
}
import org.tizen.dynamicanalyzer.nl.InformationViewLabels;
import org.tizen.dynamicanalyzer.nl.TimelineChartLabels;
import org.tizen.dynamicanalyzer.timeline.TimelineChartManager;
+import org.tizen.dynamicanalyzer.timeline.TimelineItemManager;
import org.tizen.dynamicanalyzer.timeline.TimelineItemsProvider;
import org.tizen.dynamicanalyzer.timeline.chart.TimelineChart;
import org.tizen.dynamicanalyzer.ui.widgets.DATable.DATableComposite;
table.removeAll();
insertStartEndTime();
- List<TimelineChart> pItem = TimelineItemsProvider.getInstance().getSelectedChartList();
- List<XYSeries> xySeries = null;
- List<XYDataItem> xyDataItem = null;
- double xVal;
- double min = 0;
- double max = 0;
- double sum = 0;
- double avr = 0;
- double count = 0;
- double start = 0;
- double end = 0;
- double val;
- int itemID;
-
- for (int i = 0; i < pItem.size(); i++) {
- itemID = pItem.get(i).getChartType();
- //FIXME : chart
- switch(itemID){
- case TimelineConstants.CHART_TYPE_CPU:
- continue;
- }
- xySeries = chartManager.getChartSeriesList(itemID);
-
- if (null == xySeries)
- continue;
+ if(false == TimelineItemManager.bCustomChart){
+ List<TimelineChart> pItem = TimelineItemsProvider.getInstance().getSelectedChartList();
+ List<XYSeries> xySeries = null;
+ List<XYDataItem> xyDataItem = null;
+ double xVal;
+ double min = 0;
+ double max = 0;
+ double sum = 0;
+ double avr = 0;
+ double count = 0;
+ double start = 0;
+ double end = 0;
+ double val;
+ int itemID;
- for (int xySeriesCount = 0; xySeriesCount < xySeries.size(); xySeriesCount++) {
- XYSeries xys = xySeries.get(xySeriesCount);
- if (null == xys) {
+ for (int i = 0; i < pItem.size(); i++) {
+ itemID = pItem.get(i).getChartType();
+ //FIXME : chart
+ switch(itemID){
+ case TimelineConstants.CHART_TYPE_CPU:
continue;
}
- xyDataItem = xys.getItems();
- if (null == xyDataItem) {
+ xySeries = chartManager.getChartSeriesList(itemID);
+
+ if (null == xySeries)
continue;
- }
- int startIndex = -1;
+ for (int xySeriesCount = 0; xySeriesCount < xySeries.size(); xySeriesCount++) {
+ XYSeries xys = xySeries.get(xySeriesCount);
+ if (null == xys) {
+ continue;
+ }
+ xyDataItem = xys.getItems();
+ if (null == xyDataItem) {
+ continue;
+ }
- if (true == isIncludeRangeSet(itemID)) {
- startIndex = getSelectionStartIndex(xyDataItem);
- }
+ int startIndex = -1;
- if (-1 == startIndex)
- continue;
+ if (true == isIncludeRangeSet(itemID)) {
+ startIndex = getSelectionStartIndex(xyDataItem);
+ }
- for (int j = startIndex; j < xyDataItem.size(); j++) {
- xVal = (xyDataItem.get(j).getX().doubleValue());
+ if (-1 == startIndex)
+ continue;
- if (j == startIndex) {
- val = xyDataItem.get(j).getY().doubleValue();
- min = val;
- max = val;
- sum = val;
- start = val;
- end = val;
- count = 1;
- } else if (xVal * 1000000 > endTime)
- break;
- else {
- val = xyDataItem.get(j).getY().doubleValue();
+ for (int j = startIndex; j < xyDataItem.size(); j++) {
+ xVal = (xyDataItem.get(j).getX().doubleValue());
- if (val < min)
+ if (j == startIndex) {
+ val = xyDataItem.get(j).getY().doubleValue();
min = val;
- if (val > max)
max = val;
- sum += val;
- end = val;
- count++;
+ sum = val;
+ start = val;
+ end = val;
+ count = 1;
+ } else if (xVal * 1000000 > endTime)
+ break;
+ else {
+ val = xyDataItem.get(j).getY().doubleValue();
+
+ if (val < min)
+ min = val;
+ if (val > max)
+ max = val;
+ sum += val;
+ end = val;
+ count++;
+ }
}
- }
- if (count != 0)
- avr = (double) sum / (double) count;
+ if (count != 0)
+ avr = (double) sum / (double) count;
- String title = getTitleName(itemID, xys);
- if (null != title) {
- switch (itemID) {
- case TimelineConstants.CHART_TYPE_CPU:
- insertRangeItem(title,
- Formatter.toPercentageFormat(start),
- Formatter.toPercentageFormat(end),
- Formatter.toPercentageFormat(avr),
- Formatter.toPercentageFormat(min),
- Formatter.toPercentageFormat(max));
- break;
- case TimelineConstants.CHART_TYPE_CPU_CORE:
- insertRangeItem(title,
- Formatter.toPercentageFormat(start),
- Formatter.toPercentageFormat(end),
- Formatter.toPercentageFormat(avr),
- Formatter.toPercentageFormat(min),
- Formatter.toPercentageFormat(max));
- break;
- case TimelineConstants.CHART_TYPE_CPU_FREQUENCY:
- insertRangeItem(title,
- Formatter.toHzFormat(start),
- Formatter.toHzFormat(end),
- Formatter.toHzFormat(avr),
- Formatter.toHzFormat(min),
- Formatter.toHzFormat(max));
- break;
- case TimelineConstants.CHART_TYPE_HEAP:
- insertRangeItem(title, Formatter.toByteFormat(start),
- Formatter.toByteFormat(end),
- Formatter.toByteFormat(avr),
- Formatter.toByteFormat(min),
- Formatter.toByteFormat(max));
- break;
- case TimelineConstants.CHART_TYPE_PROCESS_MEMORY:
- insertRangeItem(title, Formatter.toByteFormat(start),
- Formatter.toByteFormat(end),
- Formatter.toByteFormat((avr)),
- Formatter.toByteFormat(min),
- Formatter.toByteFormat(max));
- break;
- case TimelineConstants.CHART_TYPE_ENERGY:
- insertRangeItem(title, Formatter.toNumberFormat(start),
- Formatter.toNumberFormat(end),
- Formatter.toNumberFormat(avr),
- Formatter.toNumberFormat(min),
- Formatter.toNumberFormat(max));
- break;
- case TimelineConstants.CHART_TYPE_FILE:
- // File Count
- if (xys.getKey().equals(TimelineChartLabels.FILE_CHART_SERIES_NAME_FD_COUNT)) {
+ String title = getTitleName(itemID, xys);
+ if (null != title) {
+ switch (itemID) {
+ case TimelineConstants.CHART_TYPE_CPU:
insertRangeItem(title,
- Formatter.toNumberFormat(start),
- Formatter.toNumberFormat(end),
- Formatter.toDoubleFormat1(String
- .valueOf(avr)),
- Formatter.toNumberFormat(min),
- Formatter.toNumberFormat(max));
- }
- // File read, write
- else {
+ Formatter.toPercentageFormat(start),
+ Formatter.toPercentageFormat(end),
+ Formatter.toPercentageFormat(avr),
+ Formatter.toPercentageFormat(min),
+ Formatter.toPercentageFormat(max));
+ break;
+ case TimelineConstants.CHART_TYPE_CPU_CORE:
+ insertRangeItem(title,
+ Formatter.toPercentageFormat(start),
+ Formatter.toPercentageFormat(end),
+ Formatter.toPercentageFormat(avr),
+ Formatter.toPercentageFormat(min),
+ Formatter.toPercentageFormat(max));
+ break;
+ case TimelineConstants.CHART_TYPE_CPU_FREQUENCY:
insertRangeItem(title,
- Formatter.toByteFormat(start),
+ Formatter.toHzFormat(start),
+ Formatter.toHzFormat(end),
+ Formatter.toHzFormat(avr),
+ Formatter.toHzFormat(min),
+ Formatter.toHzFormat(max));
+ break;
+ case TimelineConstants.CHART_TYPE_HEAP:
+ insertRangeItem(title, Formatter.toByteFormat(start),
+ Formatter.toByteFormat(end),
+ Formatter.toByteFormat(avr),
+ Formatter.toByteFormat(min),
+ Formatter.toByteFormat(max));
+ break;
+ case TimelineConstants.CHART_TYPE_PROCESS_MEMORY:
+ insertRangeItem(title, Formatter.toByteFormat(start),
Formatter.toByteFormat(end),
- Formatter.toBpsFormat(sum, startTime,
- endTime),
+ Formatter.toByteFormat((avr)),
Formatter.toByteFormat(min),
Formatter.toByteFormat(max));
+ break;
+ case TimelineConstants.CHART_TYPE_ENERGY:
+ insertRangeItem(title, Formatter.toNumberFormat(start),
+ Formatter.toNumberFormat(end),
+ Formatter.toNumberFormat(avr),
+ Formatter.toNumberFormat(min),
+ Formatter.toNumberFormat(max));
+ break;
+ case TimelineConstants.CHART_TYPE_FILE:
+ // File Count
+ if (xys.getKey().equals(TimelineChartLabels.FILE_CHART_SERIES_NAME_FD_COUNT)) {
+ insertRangeItem(title,
+ Formatter.toNumberFormat(start),
+ Formatter.toNumberFormat(end),
+ Formatter.toDoubleFormat1(String
+ .valueOf(avr)),
+ Formatter.toNumberFormat(min),
+ Formatter.toNumberFormat(max));
+ }
+ // File read, write
+ else {
+ insertRangeItem(title,
+ Formatter.toByteFormat(start),
+ Formatter.toByteFormat(end),
+ Formatter.toBpsFormat(sum, startTime,
+ endTime),
+ Formatter.toByteFormat(min),
+ Formatter.toByteFormat(max));
+ }
+ break;
+ default:
+ break;
}
- break;
- default:
- break;
}
+ avr = count = min = max = sum = 0;
}
- avr = count = min = max = sum = 0;
}
}
-
+ else{
+ }
isTimelineSelectedChange = false;
}