From 50e1117b91b7f8fbd4084f5afeffdb6a9686e1f1 Mon Sep 17 00:00:00 2001 From: kamuru Date: Sun, 29 Sep 2013 15:38:21 +0900 Subject: [PATCH] [Title] apply swap [Desc.] [Issue] --- .../dynamicanalyzer/widgets/chart/DAChartPlot.java | 75 +- .../widgets/chart/DAChartRenderer.java | 163 ++- .../widgets/chartBoard/DAChartBoard.java | 152 ++- .../widgets/helper/ColorResources.java | 7 +- .../widgets/timeline/DATimeline.java | 43 +- .../widgets/timeline/DATimelineFrameRenderer.java | 121 ++ .../widgets/timeline/DATimelineRenderer.java | 107 +- .../widgets/timeline/DATimelineTimeRenderer.java | 132 ++ .../dynamicanalyzer/common/AnalyzerPaths.java | 3 + .../logparser/LogCenterConstants.java | 9 +- .../org/tizen/dynamicanalyzer/model/TreeInput.java | 15 + .../tizen/dynamicanalyzer/nl/AnalyzerLabels.java | 5 +- .../dynamicanalyzer/nl/AnalyzerLabels.properties | 7 + .../tizen/dynamicanalyzer/nl/ConfigureLabels.java | 2 + .../org/tizen/dynamicanalyzer/nl/GLPageLabels.java | 147 +++ .../dynamicanalyzer/nl/GLPageLabels.properties | 131 ++ .../dynamicanalyzer/resources/ColorResources.java | 72 +- .../dynamicanalyzer/resources/ImageResources.java | 6 +- .../dynamicanalyzer/shortcut/ShortCutManager.java | 30 +- .../tizen/dynamicanalyzer/sql/DBTableManager.java | 27 + .../swap/model/probe2/GLES20LogData.java | 74 ++ .../swap/model/probe2/SystemData.java | 1 - .../ui/common/ContextEndMenuItemClickListener.java | 4 +- .../ContextFromSelectionMenuItemClickListener.java | 4 +- .../common/ContextStartMenuItemClickListener.java | 4 +- .../ui/common/PopupEndMenuItemClickListener.java | 5 +- .../PopupFromSelectionMenuItemClickListener.java | 4 +- .../ui/common/PopupStartMenuItemClickListener.java | 4 +- .../ui/common/SetRangeMarkerMouseMoveListener.java | 16 +- .../ui/common/TimelineChartMouseEventListener.java | 170 +-- .../ui/common/UIEventChartContextMenuItem.java | 10 +- .../dynamicanalyzer/ui/file/FileApiListTable.java | 8 +- .../dynamicanalyzer/ui/file/FileChartData.java | 10 +- .../ui/file/FileChartDataEvent.java | 2 +- .../dynamicanalyzer/ui/file/FileChartView.java | 20 +- .../dynamicanalyzer/ui/file/FileDataMaker.java | 51 +- .../ui/network/NetworkApiListTable.java | 8 +- .../ui/network/NetworkChartData.java | 10 +- .../ui/network/NetworkChartDataEvent.java | 2 +- .../ui/network/NetworkChartView.java | 20 +- .../ui/network/NetworkDataMaker.java | 49 +- .../ui/network/NetworkTrafficChart.java | 2 +- .../dynamicanalyzer/ui/opengl/GLConstantMap.java | 166 +++ .../ui/opengl/GLES20ErrorInformation.java | 229 ++++ .../ui/opengl/data/CurrentContextValueList.java | 58 + .../ui/opengl/data/GLContextDBEnum.java | 129 ++ .../ui/opengl/data/GLContextTreeNodeData.java | 90 ++ .../ui/opengl/data/GLDataMaker.java | 990 ++++++++++++++ .../ui/opengl/data/GLSelectionData.java | 18 + .../data/inserter/GLContextDataInserter.java | 93 ++ .../opengl/data/inserter/GLContextDataQueue.java | 84 ++ .../ui/opengl/data/model/GLAPIData.java | 69 + .../ui/opengl/data/model/GLFrameData.java | 80 ++ .../eventListner/BoundLineEventListener.java | 245 ++++ .../GLFrameChartMouseEventListener.java | 176 +++ .../GLFramerateChartMouseEventListener.java | 264 ++++ .../ui/opengl/ui/GLDetailsView.java | 291 +++++ .../tizen/dynamicanalyzer/ui/opengl/ui/GLPage.java | 144 +++ .../ui/opengl/ui/apiList/GLAPIListTable.java | 365 ++++++ .../ui/opengl/ui/apiList/GLAPIListView.java | 102 ++ .../ui/opengl/ui/chart/GLChartView.java | 360 ++++++ .../ui/opengl/ui/chart/GLElapsedTimeChart.java | 68 + .../ui/opengl/ui/chart/GLFPSChart.java | 84 ++ .../ui/opengl/ui/chart/GLFrameRateChart.java | 109 ++ .../ui/opengl/ui/context/GLContextTreeTable.java | 1349 ++++++++++++++++++++ .../ui/opengl/ui/context/GLContextView.java | 77 ++ .../ui/thread/ThreadAPIListTable.java | 8 +- .../dynamicanalyzer/ui/thread/ThreadChartView.java | 36 +- .../ui/thread/sync/ThreadPageSyncDataManager.java | 48 +- .../thread/thread/ThreadPageThreadDataManager.java | 78 +- .../ui/timeline/calltrace/CallTraceTable.java | 8 +- .../ui/timeline/chart/CPUChart.java | 68 +- .../ui/timeline/chart/CPUCoreChart.java | 59 +- .../ui/timeline/chart/CPUFrequencyChart.java | 38 +- .../ui/timeline/chart/FileChart.java | 181 +-- .../ui/timeline/chart/HeapChart.java | 111 +- .../ui/timeline/chart/ProcessMemoryChart.java | 39 +- .../ui/timeline/chart/ScreenshotChart.java | 21 +- .../ui/timeline/chart/SystemMemoryChart.java | 34 +- .../ui/timeline/chart/TimelineChart.java | 49 +- .../ui/timeline/chart/UIEventChart.java | 78 +- .../ui/timeline/chart/UserCustomChart.java | 17 +- .../ui/timeline/common/TimelineConstants.java | 3 +- .../ui/timeline/common/TimelineView.java | 16 +- .../ui/timeline/logparser/CustomLogParser.java | 4 +- .../ui/timeline/logparser/LifecycleLogParser.java | 2 +- .../ui/timeline/uievent/UIEventListDialog.java | 12 +- .../ui/widgets/table/DATreeComposite.java | 6 +- .../dynamicanalyzer/utils/InternalLogManager.java | 529 ++++++++ 89 files changed, 7870 insertions(+), 947 deletions(-) create mode 100644 org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/timeline/DATimelineFrameRenderer.java create mode 100644 org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/timeline/DATimelineTimeRenderer.java create mode 100644 org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/GLPageLabels.java create mode 100644 org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/GLPageLabels.properties create mode 100644 org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/model/probe2/GLES20LogData.java create mode 100644 org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/GLConstantMap.java create mode 100644 org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/GLES20ErrorInformation.java create mode 100644 org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/data/CurrentContextValueList.java create mode 100644 org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/data/GLContextDBEnum.java create mode 100644 org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/data/GLContextTreeNodeData.java create mode 100644 org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/data/GLDataMaker.java create mode 100644 org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/data/GLSelectionData.java create mode 100644 org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/data/inserter/GLContextDataInserter.java create mode 100644 org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/data/inserter/GLContextDataQueue.java create mode 100644 org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/data/model/GLAPIData.java create mode 100644 org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/data/model/GLFrameData.java create mode 100644 org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/eventListner/BoundLineEventListener.java create mode 100644 org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/eventListner/GLFrameChartMouseEventListener.java create mode 100644 org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/eventListner/GLFramerateChartMouseEventListener.java create mode 100644 org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/ui/GLDetailsView.java create mode 100644 org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/ui/GLPage.java create mode 100644 org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/ui/apiList/GLAPIListTable.java create mode 100644 org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/ui/apiList/GLAPIListView.java create mode 100644 org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/ui/chart/GLChartView.java create mode 100644 org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/ui/chart/GLElapsedTimeChart.java create mode 100644 org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/ui/chart/GLFPSChart.java create mode 100644 org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/ui/chart/GLFrameRateChart.java create mode 100644 org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/ui/context/GLContextTreeTable.java create mode 100644 org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/ui/context/GLContextView.java create mode 100644 org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/utils/InternalLogManager.java diff --git a/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/chart/DAChartPlot.java b/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/chart/DAChartPlot.java index bd8a47e..c42948e 100644 --- a/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/chart/DAChartPlot.java +++ b/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/chart/DAChartPlot.java @@ -35,7 +35,15 @@ import org.tizen.dynamicanalyzer.widgets.helper.FontResources; public class DAChartPlot { public static enum UnitType { - DECIMAL, BINARY + DECIMAL, BINARY, GL_MS, GL_FPS + }; + + public static enum AutoRangeType { + MANUAL, SEMI_AUTO, AUTO + }; + + public static enum BoundType { + UPPER, UNDER }; private double visibleStartX = 0; @@ -44,7 +52,7 @@ public class DAChartPlot { private double visibleEndY = 0; private double validEndX = 0; private double validEndY = 0; - private boolean bAutoHeightRange = false; + private AutoRangeType autoRangeType = AutoRangeType.MANUAL; private boolean bSeriesHeightRange = false; private boolean bShowAxis = false; private Image backgroundImage = null; @@ -56,12 +64,34 @@ public class DAChartPlot { private String axisUnit; private String secondAxisUnit; private UnitType axisUnitType = UnitType.DECIMAL; - - public DAChartPlot(DAChart chart) { - this.chart = chart; + + private double underBoundValue; + public void setBoundValue(double value) { + underBoundValue = value; + } + public double getBoundValue() { + return underBoundValue; + } + + private BoundType boundType; + public void setBoundType(BoundType type) { + boundType = type; + } + public BoundType getBoundType() { + return boundType; + } + + //FIXME ?? + private boolean isBoundExpanded = false; + public void setBoundExpanded(boolean boundExpanded) { + isBoundExpanded = boundExpanded; } + public boolean isBounddExpdanded() { + return isBoundExpanded; + } + - public void setChart(DAChart chart) { + public DAChartPlot(DAChart chart) { this.chart = chart; } @@ -149,12 +179,12 @@ public class DAChartPlot { hasUpdate = true; } - public boolean isAutoHeightRange() { - return bAutoHeightRange; + public AutoRangeType getAutoHeightRange() { + return autoRangeType; } - public void setAutoHeightRange(boolean auto) { - bAutoHeightRange = auto; + public void setAutoHeightRange(AutoRangeType autoRangeType) { + this.autoRangeType = autoRangeType; hasUpdate = true; } @@ -201,33 +231,18 @@ public class DAChartPlot { return getXPixcelFromX(x, r); } - public int getYPixcelFromY(DAChartSeries series, double y, Rectangle r) { - double endY = 0; - if (true == bSeriesHeightRange) { - if (true == bAutoHeightRange) { - endY = series.getMaxY() * 1.1; - } else { - endY = series.getEndY() * 1.1; - } - } else { - endY = this.visibleEndY; - } - + public int getYPixcelFromY(double maxY, double y, Rectangle r) { double pixcelY; - if (visibleStartY == endY) { + if (visibleStartY == maxY) { pixcelY = 0; } else { pixcelY = ((double) r.height) * (y - visibleStartY) - / (endY - visibleStartY); + / (maxY - visibleStartY); } + return (int) (r.height - pixcelY); } - - public int getYPixcelFromY(DAChartSeries series, double y) { - Rectangle r = chart.getBounds(); - return getYPixcelFromY(series, y, r); - } - + public double getXFromXPixcel(int xPixcel, Rectangle r) { return (((visibleEndX - visibleStartX) * (double) xPixcel) / (double) r.width) + visibleStartX; diff --git a/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/chart/DAChartRenderer.java b/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/chart/DAChartRenderer.java index 6d5a473..15dcbce 100644 --- a/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/chart/DAChartRenderer.java +++ b/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/chart/DAChartRenderer.java @@ -37,6 +37,7 @@ import org.eclipse.swt.graphics.Image; import org.eclipse.swt.graphics.Point; import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.widgets.Display; +import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlot.AutoRangeType; import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoard; import org.tizen.dynamicanalyzer.widgets.helper.ColorResources; import org.tizen.dynamicanalyzer.widgets.helper.Formatter; @@ -93,7 +94,7 @@ public class DAChartRenderer { if (false == bInitialized) { initialize(gc, chart); } - this.plot = chart.getPlot(); + plot = chart.getPlot(); r = chart.getClientArea(); // draw background Image @@ -108,7 +109,8 @@ public class DAChartRenderer { int seriesSize = seriesList.size(); DAChartSeries series; - if (true == plot.isAutoHeightRange()) { + if (plot.getAutoHeightRange() == AutoRangeType.SEMI_AUTO || + plot.getAutoHeightRange() == AutoRangeType.AUTO) { double maxY = 0; for (int i = 0; i < seriesSize; i++) { double tempY = seriesList.get(i).getMaxY(); @@ -166,12 +168,14 @@ public class DAChartRenderer { break; } } - if (true == plot.isShowAxis()) { - if (true == plot.isSeriesHeightRange()) { + if (plot.isShowAxis()) { + if (plot.isSeriesHeightRange()) { for (int i = 0; i < seriesSize; i++) { series = seriesList.get(i); if (0 == i) { - drawAxis(gc, r, 0, series.getEndY(), true); +// drawAxis(gc, r, 0, series.getEndY(), true); + drawAxis(gc, r, plot.getVisibleStartY(), + plot.getVisibleEndY(), true); } else if (1 == i) { drawAxis(gc, r, 0, series.getEndY(), false); } else { @@ -234,7 +238,15 @@ public class DAChartRenderer { text = Formatter.toByteFormatConvertBinaryPrefix(min); } else if (plot.getAxisUnitType() == DAChartPlot.UnitType.DECIMAL) { text = Formatter.toByteFormatConvertDecimalPrefix(min); + } else if (plot.getAxisUnitType() == DAChartPlot.UnitType.GL_FPS) { + if(min != 0) { + text = "(" + Formatter.toByteFormatConvertDecimalPrefix((1000 / min)) + "ms)"; + } else { + text = ""; + } + text += Formatter.toByteFormatConvertDecimalPrefix(min); } + if (null != axisUnit) { text += axisUnit; } @@ -246,32 +258,54 @@ public class DAChartRenderer { } gc.drawText(text, textX, rt.height - textHeight, true); + // mid gc.drawLine(x1, rt.height / 2, x2, rt.height / 2); if (plot.getAxisUnitType() == DAChartPlot.UnitType.BINARY) { text = Formatter.toByteFormatConvertBinaryPrefix((min + max) / 2); } else if (plot.getAxisUnitType() == DAChartPlot.UnitType.DECIMAL) { text = Formatter.toByteFormatConvertDecimalPrefix((min + max) / 2); + } else if (plot.getAxisUnitType() == DAChartPlot.UnitType.GL_MS) { + text = "(" + Formatter.toByteFormatConvertDecimalPrefix(2000 / (min + max)) + "fps)"; + text += Formatter.toByteFormatConvertDecimalPrefix((min + max) / 2); + } else if (plot.getAxisUnitType() == DAChartPlot.UnitType.GL_FPS) { + if(max != 0) { + text = "(" + Formatter.toByteFormatConvertDecimalPrefix(2000 / (min + max)) + "ms)"; + } else { + text = ""; + } + text += Formatter.toByteFormatConvertDecimalPrefix((min + max) / 2); } if (null != axisUnit) { text += axisUnit; } textHeight = gc.textExtent(text).y; - if (true == bPosRight) { + if (bPosRight) { textX = x1 - gc.textExtent(text).x - AXIS_MARGIN - AXIS_LINE_WIDTH; } gc.drawText(text, textX, rt.height / 2 - textHeight / 2, true); + // max gc.drawLine(x1, 0, x2, 0); if (plot.getAxisUnitType() == DAChartPlot.UnitType.BINARY) { text = Formatter.toByteFormatConvertBinaryPrefix(max); } else if (plot.getAxisUnitType() == DAChartPlot.UnitType.DECIMAL) { text = Formatter.toByteFormatConvertDecimalPrefix(max); + } else if (plot.getAxisUnitType() == DAChartPlot.UnitType.GL_MS) { + text = "(" + Formatter.toByteFormatConvertDecimalPrefix(1000 / (max)) + "fps)"; + text += Formatter.toByteFormatConvertDecimalPrefix((max)); + } else if (plot.getAxisUnitType() == DAChartPlot.UnitType.GL_FPS) { + if(max != 0) { + text = "(" + Formatter.toByteFormatConvertDecimalPrefix((1000 / max)) + "ms)"; + } else { + text = ""; + } + text += Formatter.toByteFormatConvertDecimalPrefix(max); } if (null != axisUnit) { text += axisUnit; } - if (true == bPosRight) { + if (bPosRight) { textX = x1 - gc.textExtent(text).x - AXIS_MARGIN - AXIS_LINE_WIDTH; } gc.drawText(text, textX, 1, true); @@ -388,6 +422,37 @@ public class DAChartRenderer { return false; } + private double getMaxYToDraw(DAChartSeries series, + int startIndex) { + if(!plot.isSeriesHeightRange()) { + return plot.getVisibleEndY(); + } + + double maxY = 0; + AutoRangeType autoRangeType = plot.getAutoHeightRange(); + if ((autoRangeType == AutoRangeType.MANUAL)) { + maxY = series.getEndY(); + } else if ((autoRangeType == AutoRangeType.SEMI_AUTO)) { + maxY = series.getMaxY(); + } else if (autoRangeType == AutoRangeType.AUTO) { + List seriesItemList = series.getSeriesItemList(); + for (int i = startIndex; i < seriesItemList.size(); i++) { + DAChartSeriesItem seriesItem = seriesItemList.get(i); + if (seriesItem.getX() > plot.getVisibleEndX()) { + break; + } + + if (maxY < seriesItem.getY()) { + maxY = seriesItem.getY(); + } + } + } + + // FIXME + plot.setAxisEndY(maxY * 1.1); + return maxY * 1.1; + } + public void drawTooltip(GC gc) { if (plot instanceof DAScreenshotChartPlot) { return; @@ -443,8 +508,14 @@ public class DAChartRenderer { if (series.getStyle() == DAChartSeries.SERIES_STYLE_BAR || series.getStyle() == DAChartSeries.SERIES_STYLE_LINE || series.getStyle() == DAChartSeries.SERIES_STYLE_AREA) { - gc.drawLine(0, plot.getYPixcelFromY(series, yVal, r), - r.width, plot.getYPixcelFromY(series, yVal, r)); + int startIndex = series.getPrevIndexByXvalue(plot.getVisibleStartX()); + if (startIndex < 0) { + startIndex = 0; + } + double maxY = getMaxYToDraw(series, startIndex); + + gc.drawLine(0, plot.getYPixcelFromY(maxY, yVal, r), + r.width, plot.getYPixcelFromY(maxY, yVal, r)); } gc.drawLine(plot.getXPixcelFromX(xVal), 0, @@ -592,6 +663,9 @@ public class DAChartRenderer { if (index < 0) { index = 0; } + + double maxY = getMaxYToDraw(series, index); + double boundValue = plot.getBoundValue(); for (int i = index; i < seriesItemSize; i++) { seriesItem = seriesItems.get(i); @@ -605,8 +679,7 @@ public class DAChartRenderer { double currentX = seriesItem.getX(); int pixcelStartX = plot.getXPixcelFromX(seriesItem.getX(), r); - int pixcelStartY = plot.getYPixcelFromY(series, seriesItem.getY(), - r); + int pixcelStartY = plot.getYPixcelFromY(maxY, seriesItem.getY(), r); int barWidth = plot.getXPixcelFromX(currentX + barWidthTime, r) - pixcelStartX; @@ -628,14 +701,29 @@ public class DAChartRenderer { + r.height - pixcelStartY); gc.setBackground(series.getColor()); } else { + DAChartPlot.BoundType boundType = plot.getBoundType(); + if(boundType != null) { + if(boundType == DAChartPlot.BoundType.UNDER) { + if(seriesItem.getY() < boundValue) { + gc.setBackground(ColorResources.RED); + gc.setAlpha(100); + } + } else { + if(seriesItem.getY() > boundValue) { + gc.setBackground(ColorResources.RED); + gc.setAlpha(100); + } + } + } gc.fillRectangle(pixcelStartX, pixcelStartY, barWidth, r.y + r.height - pixcelStartY); + gc.setBackground(series.getColor()); + gc.setAlpha(250); } if (currentX > plot.getVisibleEndX()) { break; } } - gc.setAlpha(255); } private void drawMultyCheckBarSeries(GC gc, DAChartSeries series, @@ -717,9 +805,15 @@ public class DAChartRenderer { return; } + int index = series.getPrevIndexByXvalue(plot.getVisibleStartX()); + if (index < 0) { + index = 0; + } + double maxY = getMaxYToDraw(series, index); + DAChartSeriesItem seriesItem = seriesItems.get(0); int oldPixcelX = plot.getXPixcelFromX(seriesItem.getX(), r); - int oldPixcelY = plot.getYPixcelFromY(series, seriesItem.getY(), r); + int oldPixcelY = plot.getYPixcelFromY(maxY, seriesItem.getY(), r); if (seriesItemSize == 1) { if (oldPixcelX < r.x) { @@ -739,17 +833,11 @@ public class DAChartRenderer { gc.setLineStyle(SWT.LINE_SOLID); gc.setAntialias(SWT.ON); - int index = series.getPrevIndexByXvalue(plot.getVisibleStartX()); - if (index < 0) { - index = 0; - } - seriesItem = seriesItems.get(index); double currentX = seriesItem.getX(); int newPixcelX = plot.getXPixcelFromX(currentX, r); - - int newPixcelY = plot.getYPixcelFromY(series, seriesItem.getY(), r); + int newPixcelY = plot.getYPixcelFromY(maxY, seriesItem.getY(), r); for (int i = index; i < seriesItemSize; i++) { seriesItem = seriesItems.get(i); @@ -759,7 +847,7 @@ public class DAChartRenderer { oldPixcelY = newPixcelY; newPixcelX = plot.getXPixcelFromX(currentX, r); - newPixcelY = plot.getYPixcelFromY(series, seriesItem.getY(), r); + newPixcelY = plot.getYPixcelFromY(maxY, seriesItem.getY(), r); gc.drawLine(oldPixcelX, oldPixcelY, newPixcelX, newPixcelY); if (currentX > plot.getVisibleEndX()) { @@ -786,9 +874,15 @@ public class DAChartRenderer { return; } + int index = series.getPrevIndexByXvalue(plot.getVisibleStartX()); + if (index < 0) { + index = 0; + } + double maxY = getMaxYToDraw(series, index); + DAChartSeriesItem seriesItem = seriesItems.get(0); int oldPixcelX = plot.getXPixcelFromX(seriesItem.getX(), r); - int oldPixcelY = plot.getYPixcelFromY(series, seriesItem.getY(), r); + int oldPixcelY = plot.getYPixcelFromY(maxY, seriesItem.getY(), r); int baseY = r.y + r.height; if (seriesItemSize == 1) { @@ -809,16 +903,12 @@ public class DAChartRenderer { gc.setAlpha((int) (255 * 0.8)); gc.setForeground(color); gc.setBackground(color); - int index = series.getPrevIndexByXvalue(plot.getVisibleStartX()); - if (index < 0) { - index = 0; - } seriesItem = seriesItems.get(index); double currentX = seriesItem.getX(); int newPixcelX = plot.getXPixcelFromX(currentX, r); - int newPixcelY = plot.getYPixcelFromY(series, seriesItem.getY(), r); + int newPixcelY = plot.getYPixcelFromY(maxY, seriesItem.getY(), r); for (int i = index; i < seriesItemSize; i++) { seriesItem = seriesItems.get(i); @@ -828,7 +918,7 @@ public class DAChartRenderer { oldPixcelY = newPixcelY; newPixcelX = plot.getXPixcelFromX(currentX, r); - newPixcelY = plot.getYPixcelFromY(series, seriesItem.getY(), r); + newPixcelY = plot.getYPixcelFromY(maxY, seriesItem.getY(), r); int[] polygon = { oldPixcelX, baseY, oldPixcelX, oldPixcelY, newPixcelX, newPixcelY, newPixcelX, baseY }; gc.setAlpha((int) (255 * 0.8)); @@ -864,9 +954,15 @@ public class DAChartRenderer { return; } + int index = series.getPrevIndexByXvalue(plot.getVisibleStartX()); + if (index < 0) { + index = 0; + } + double maxY = getMaxYToDraw(series, index); + DAChartSeriesItem seriesItem = seriesItems.get(0); int oldPixcelX = plot.getXPixcelFromX(seriesItem.getX(), r); - int oldPixcelY = plot.getYPixcelFromY(series, seriesItem.getY(), r); + int oldPixcelY = plot.getYPixcelFromY(maxY, seriesItem.getY(), r); if (seriesItemSize == 1) { if (oldPixcelX < r.x) { @@ -885,16 +981,11 @@ public class DAChartRenderer { gc.setForeground(color); gc.setLineStyle(SWT.LINE_SOLID); - int index = series.getPrevIndexByXvalue(plot.getVisibleStartX()); - if (index < 0) { - index = 0; - } - seriesItem = seriesItems.get(index); double currentX = seriesItem.getX(); int newPixcelX = plot.getXPixcelFromX(currentX, r); - int newPixcelY = plot.getYPixcelFromY(series, seriesItem.getY(), r); + int newPixcelY = plot.getYPixcelFromY(maxY, seriesItem.getY(), r); for (int i = index; i < seriesItemSize; i++) { seriesItem = seriesItems.get(i); @@ -904,7 +995,7 @@ public class DAChartRenderer { oldPixcelY = newPixcelY; newPixcelX = plot.getXPixcelFromX(currentX, r); - newPixcelY = plot.getYPixcelFromY(series, seriesItem.getY(), r); + newPixcelY = plot.getYPixcelFromY(maxY, seriesItem.getY(), r); gc.drawLine(oldPixcelX, oldPixcelY, newPixcelX, oldPixcelY); gc.drawLine(newPixcelX, oldPixcelY, newPixcelX, newPixcelY); diff --git a/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/chartBoard/DAChartBoard.java b/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/chartBoard/DAChartBoard.java index 9b3cf1e..97c9a25 100644 --- a/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/chartBoard/DAChartBoard.java +++ b/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/chartBoard/DAChartBoard.java @@ -63,6 +63,9 @@ import org.tizen.dynamicanalyzer.widgets.lifecycle.LifecycleBar; import org.tizen.dynamicanalyzer.widgets.scale.DAScale; import org.tizen.dynamicanalyzer.widgets.scale.DAScaleSelectionListener; import org.tizen.dynamicanalyzer.widgets.timeline.DATimeline; +import org.tizen.dynamicanalyzer.widgets.timeline.DATimelineFrameRenderer; +import org.tizen.dynamicanalyzer.widgets.timeline.DATimelineMarker; +import org.tizen.dynamicanalyzer.widgets.timeline.DATimelineTimeRenderer; public class DAChartBoard extends Composite { @@ -100,10 +103,18 @@ public class DAChartBoard extends Composite { protected final static double DEFAULT_EXPAND_MEDIUM = 1; protected final static double DEFAULT_EXPAND_MAX = 2; private double itemRatio = DEFAULT_EXPAND_MEDIUM; + private int interval; private int chartHeight = DEFAULT_CHART_ZOOMIN_HEIGHT; + public final static int BOARD_STYLE_TIME = 0; + public final static int BOARD_STYLE_FRAME = 1; + public DAChartBoard(Composite parent, String title) { + this(parent, title, BOARD_STYLE_TIME); + } + + public DAChartBoard(Composite parent, String title, int boardStyle) { super(parent, SWT.NONE); this.setLayout(new FormLayout()); this.setBackground(ColorResources.WHITE); @@ -132,15 +143,21 @@ public class DAChartBoard extends Composite { } }); - timeline = new DATimeline(this); - timelineTooltip = new DefaultToolTip(timeline); - timelineTooltip.deactivate(); - timeline.addMouseTrackListener(timelineMouseTrackAdapter); + if (BOARD_STYLE_TIME == boardStyle) { + interval = DATimelineTimeRenderer.DEFAULT_INTERVAL; + timeline = new DATimeline(this, true); + timelineTooltip = new DefaultToolTip(timeline); + timelineTooltip.deactivate(); + timeline.addMouseTrackListener(timelineMouseTrackAdapter); - lifecycleBar = new LifecycleBar(this); - lifecycleBarTooltip = new DefaultToolTip(lifecycleBar); - lifecycleBarTooltip.deactivate(); - lifecycleBar.addMouseTrackListener(timelineMouseTrackAdapter); + lifecycleBar = new LifecycleBar(this); + lifecycleBarTooltip = new DefaultToolTip(lifecycleBar); + lifecycleBarTooltip.deactivate(); + lifecycleBar.addMouseTrackListener(timelineMouseTrackAdapter); + } else { // BOARD_STYLE_FRAME == boardStyle + interval = DATimelineFrameRenderer.DEFAULT_INTERVAL; + timeline = new DATimeline(this, false); + } scale = new DAScale(this, SWT.NONE); scale.addSelectionListener(scaleSelectionListener); @@ -234,19 +251,29 @@ public class DAChartBoard extends Composite { data.height = DEFAULT_CHARTBOARD_HEADER_HEIGHT; chartZoomButton.setLayoutData(data); - data = new FormData(); - data.left = new FormAttachment(chartZoomButton, 0); - data.top = new FormAttachment(0, 0); - data.right = new FormAttachment(100, 0); - data.height = DEFAULT_CHARTBOARD_HEADER_HEIGHT - LifecycleBar.HEIGHT; - timeline.setLayoutData(data); - - data = new FormData(); - data.left = new FormAttachment(chartZoomButton, 0); - data.right = new FormAttachment(100, 0); - data.top = new FormAttachment(timeline, 0); - data.height = LifecycleBar.HEIGHT; - lifecycleBar.setLayoutData(data); + if (BOARD_STYLE_TIME == boardStyle) { + data = new FormData(); + data.left = new FormAttachment(chartZoomButton, 0); + data.top = new FormAttachment(0, 0); + data.right = new FormAttachment(100, 0); + data.height = DEFAULT_CHARTBOARD_HEADER_HEIGHT + - LifecycleBar.HEIGHT; + timeline.setLayoutData(data); + + data = new FormData(); + data.left = new FormAttachment(chartZoomButton, 0); + data.right = new FormAttachment(100, 0); + data.top = new FormAttachment(timeline, 0); + data.height = LifecycleBar.HEIGHT; + lifecycleBar.setLayoutData(data); + } else { // BOARD_STYLE_FRAME == boardStyle + data = new FormData(); + data.left = new FormAttachment(chartZoomButton, 0); + data.top = new FormAttachment(0, 0); + data.right = new FormAttachment(100, 0); + data.height = DEFAULT_CHARTBOARD_HEADER_HEIGHT; + timeline.setLayoutData(data); + } data = new FormData(); data.left = new FormAttachment(0, 0); @@ -284,7 +311,7 @@ public class DAChartBoard extends Composite { itemListHeight = itemList.callbackZoom(itemRatio, false); itemList.layout(); - itemList.setSize(0, itemListHeight); + itemList.setSize(itemListScrollComp.getClientArea().width, itemListHeight); itemListScrollComp.redraw(); } @@ -403,9 +430,11 @@ public class DAChartBoard extends Composite { timeline.setScale(scaleVal); timeline.setStartTime(visibleStartTime); timeline.redraw(); - lifecycleBar.setScale(scaleVal); - lifecycleBar.setVisibleStartTime(visibleStartTime); - lifecycleBar.redraw(); + if (null != lifecycleBar) { + lifecycleBar.setScale(scaleVal); + lifecycleBar.setVisibleStartTime(visibleStartTime); + lifecycleBar.redraw(); + } setScrollThumb((int) (thumb * 1000)); hScroll.setSelection((int) (visibleStartTime * 1000)); setChartAxis(); @@ -422,16 +451,20 @@ public class DAChartBoard extends Composite { protected void notifyScrollChanged(double visibleStartTime) { timeline.setStartTime(visibleStartTime); timeline.redraw(); - lifecycleBar.setVisibleStartTime(visibleStartTime); - lifecycleBar.redraw(); + if (null != lifecycleBar) { + lifecycleBar.setVisibleStartTime(visibleStartTime); + lifecycleBar.redraw(); + } setChartAxis(); } protected void notifyVisibleStartTimeChanged(double visibleStartTime) { timeline.setStartTime(visibleStartTime); timeline.redraw(); - lifecycleBar.setVisibleStartTime(visibleStartTime); - lifecycleBar.redraw(); + if (null != lifecycleBar) { + lifecycleBar.setVisibleStartTime(visibleStartTime); + lifecycleBar.redraw(); + } hScroll.setSelection((int) (visibleStartTime * 1000)); setChartAxis(); } @@ -460,7 +493,7 @@ public class DAChartBoard extends Composite { protected void registeItem(DAChartBoardItem item) { int listHeight = itemList.registeItem(item); - itemList.setSize(0, listHeight); + itemList.setSize(itemListScrollComp.getClientArea().width, listHeight); } protected DAChartBoardItemList getChartComposite() { @@ -479,7 +512,7 @@ public class DAChartBoard extends Composite { itemListHeight = height; } itemList.layout(); - itemList.setSize(0, itemListHeight); + itemList.setSize(itemListScrollComp.getClientArea().width, itemListHeight); } public void setTotalEndTime(long time) { @@ -490,7 +523,9 @@ public class DAChartBoard extends Composite { itemList.setChartValidX(endTime); timeline.setTotalEndTime(endTime); - lifecycleBar.setTotalEndTime(endTime); + if (null != lifecycleBar) { // timeline only + lifecycleBar.setTotalEndTime(endTime); + } } private void markerContentsClear() { @@ -511,7 +546,9 @@ public class DAChartBoard extends Composite { itemList.contentsClear(); setTotalEndTime(0); timeline.setStartTime(0); - lifecycleBar.clear(); + if (null != lifecycleBar) { + lifecycleBar.clear(); + } if (null != oldImage) { oldImage = null; } @@ -520,8 +557,14 @@ public class DAChartBoard extends Composite { } markerContentsClear(); - timeline.getStartRangeMarker().setTime(-1); - timeline.getEndRangeMarker().setTime(-1); + DATimelineMarker marker = timeline.getStartRangeMarker(); + if (null != marker) { + timeline.getStartRangeMarker().setTime(-1); + } + marker = timeline.getEndRangeMarker(); + if (null != marker) { + timeline.getEndRangeMarker().setTime(-1); + } timeline.redraw(); } @@ -531,7 +574,9 @@ public class DAChartBoard extends Composite { itemList.setSize(0, 0); setTotalEndTime(0); timeline.clear(); - lifecycleBar.clear(); + if (null != lifecycleBar) { + lifecycleBar.clear(); + } if (null != oldImage) { oldImage = null; } @@ -584,7 +629,7 @@ public class DAChartBoard extends Composite { return; } DAChart chart = selectItem.getChart(); - if(null == chart){ + if (null == chart) { return; } oldImage = chart.getPlot().getBackgroundImage(); @@ -618,8 +663,8 @@ public class DAChartBoard extends Composite { return; } DAChartBoardItem item = itemList.get(parentIndex); - - if(null == item){ + + if (null == item) { return; } @@ -677,13 +722,19 @@ public class DAChartBoard extends Composite { } public void setTimelineMarkerStartTime(double time) { - timeline.getStartRangeMarker().setTime(time); - timeline.redraw(); + DATimelineMarker marker = timeline.getStartRangeMarker(); + if (null != marker) { + timeline.getStartRangeMarker().setTime(time); + timeline.redraw(); + } } public void setTimelineMarkerEndTime(double time) { - timeline.getEndRangeMarker().setTime(time); - timeline.redraw(); + DATimelineMarker marker = timeline.getEndRangeMarker(); + if (null != marker) { + timeline.getEndRangeMarker().setTime(time); + timeline.redraw(); + } } private MouseTrackAdapter timelineMouseTrackAdapter = new MouseTrackAdapter() { @@ -704,12 +755,12 @@ public class DAChartBoard extends Composite { public void hideItem(int index) { int listHeight = itemList.hideItem(index); - itemList.setSize(0, listHeight); + itemList.setSize(itemListScrollComp.getClientArea().width, listHeight); } public void showItem(int index) { int listHeight = itemList.showItem(index); - itemList.setSize(0, listHeight); + itemList.setSize(itemListScrollComp.getClientArea().width, listHeight); } public void reArrangeItem(Integer a[]) { @@ -740,6 +791,17 @@ public class DAChartBoard extends Composite { } public double getLifecycleEndTime() { + if (null == lifecycleBar) { + return -1; + } return lifecycleBar.getEndTime(); } + + protected int getInterval() { + return interval; + } + + protected void setInterval(int interval) { + this.interval = interval; + } } diff --git a/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/helper/ColorResources.java b/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/helper/ColorResources.java index 19194a2..f03a689 100644 --- a/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/helper/ColorResources.java +++ b/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/helper/ColorResources.java @@ -168,7 +168,6 @@ public class ColorResources { public static Color CONTEXT_MENU_STORKE_OUT = getColor("context_menu_storke_out", new RGB(120, 120, 120)); //$NON-NLS-1$ public static Color CONTEXT_MENU_STORKE_IN = getColor("context_menu_storke_in", new RGB(50, 185, 231)); //$NON-NLS-1$ - /*** popup menu colors ***/ public static Color POPUP_MENU_TEXT_NORMAL = getColor("popup_menu_text_normal", new RGB(0, 0, 0)); //$NON-NLS-1$ @@ -183,8 +182,7 @@ public class ColorResources { public static Color POPUP_MENU_OUTLINE_STORKE1 = getColor("popup_menu_outline_stroke1", new RGB(145, 145, 145)); //$NON-NLS-1$ public static Color POPUP_MENU_OUTLINE_STORKE2 = getColor("popup_menu_outline_stroke2", new RGB(255, 255, 255)); //$NON-NLS-1$ - - + // // /** device and application combo specific colors start **/ // public static final Color DEVICE_APPLICATION_ENABLE = WHITE; @@ -471,5 +469,4 @@ public class ColorResources { return colorRegistry.get(colorName); } - -} +} diff --git a/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/timeline/DATimeline.java b/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/timeline/DATimeline.java index 67b9267..c809bea 100644 --- a/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/timeline/DATimeline.java +++ b/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/timeline/DATimeline.java @@ -52,20 +52,32 @@ public class DATimeline extends Canvas { private boolean drawDetailedTime = false; private double detailedTime; private int detailedTimePosition; + private int detailedFrame = -1; - private DATimelineRenderer timelineRenderer = new DATimelineRenderer(); - private DATimelineMarker startRangeMarker = new DATimelineMarker( - ImageResources.RANGE_MARKER_START, - ImageResources.RANGE_MARKER_START_PUSH); - private DATimelineMarker endRangeMarker = new DATimelineMarker( - ImageResources.RANGE_MARKER_END, - ImageResources.RANGE_MARKER_END_PUSH); + private DATimelineRenderer timelineRenderer; + private DATimelineMarker startRangeMarker; + private DATimelineMarker endRangeMarker; public DATimeline(Composite parent) { + this(parent, false); + } + + public DATimeline(Composite parent, boolean useMarker) { super(parent, SWT.NONE); this.addPaintListener(chartPaintListener); - this.addMouseListener(new RangeMarkerMouseEventListener()); - this.addMouseMoveListener(new RangeMarkerMouseMoveEventListener()); + if (true == useMarker) { + timelineRenderer = new DATimelineTimeRenderer(); + startRangeMarker = new DATimelineMarker( + ImageResources.RANGE_MARKER_START, + ImageResources.RANGE_MARKER_START_PUSH); + endRangeMarker = new DATimelineMarker( + ImageResources.RANGE_MARKER_END, + ImageResources.RANGE_MARKER_END_PUSH); + this.addMouseListener(new RangeMarkerMouseEventListener()); + this.addMouseMoveListener(new RangeMarkerMouseMoveEventListener()); + } else { + timelineRenderer = new DATimelineFrameRenderer(); + } } public double getStartTime() { @@ -129,8 +141,8 @@ public class DATimeline extends Canvas { } private double pixcelToSecond(int pixcel) { - return (double) pixcel / scale - / DATimelineRenderer.DEFAULT_INTERVAL + startTime; + return (double) pixcel / scale / DATimelineRenderer.DEFAULT_INTERVAL + + startTime; } public void setTotalEndTime(double time) { @@ -160,6 +172,15 @@ public class DATimeline extends Canvas { public void clear() { setStartTime(0); stickyTimeList.clear(); + detailedFrame = -1; + } + + public int getDetailedFrame() { + return detailedFrame; + } + + public void setDetailedFrame(int detailedFrame) { + this.detailedFrame = detailedFrame; } private class RangeMarkerMouseEventListener extends MouseAdapter { diff --git a/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/timeline/DATimelineFrameRenderer.java b/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/timeline/DATimelineFrameRenderer.java new file mode 100644 index 0000000..321fbc2 --- /dev/null +++ b/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/timeline/DATimelineFrameRenderer.java @@ -0,0 +1,121 @@ +/* + * Dynamic Analyzer + * + * Copyright (c) 2013 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * YeongTaik Byeon + * 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.widgets.timeline; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.graphics.Rectangle; +import org.tizen.dynamicanalyzer.widgets.helper.ColorResources; +import org.tizen.dynamicanalyzer.widgets.helper.ImageResources; + +public class DATimelineFrameRenderer extends DATimelineRenderer { + public static final int DEFAULT_INTERVAL = 1; + public static final int DRAW_FRAME_INTERVAL = 10; + private final Image balloon = ImageResources.TIMELINE_DETAILED_TIME_BALLOON; + private final int balloonHalfWidth = balloon.getBounds().width / 2; + private final int balloonHalfHeight = balloon.getBounds().height / 2; + + private void drawTimeString(GC gc, int totalSecond, int pixcelX, int pixcelY) { + Point p; + String timeString = String.valueOf(totalSecond); + + p = gc.textExtent(timeString, SWT.DRAW_MNEMONIC); + gc.setForeground(ColorResources.TIMELINE_NUMBER_COLOR); + gc.drawText(timeString, pixcelX - p.x / 2, pixcelY, true); + gc.setForeground(ColorResources.TIMELINE_TICK_COLOR); + } + + public void draw(GC gc, DATimeline timeline) { + Rectangle rt = timeline.getClientArea(); + gc.setFont(timeTickFont); + gc.setBackground(ColorResources.TIMELINE_BG_COLOR); + gc.fillRectangle(rt); + + // draw underLine + gc.drawLine(0, rt.height - 1, rt.width, rt.height - 1); + + // draw time + int scale = timeline.getScale(); + int frameInterval = scale * DEFAULT_INTERVAL; + double startMargin = timeline.getStartTime(); + int startFrame = (int) startMargin; + int current = DRAW_FRAME_INTERVAL - (startFrame % DRAW_FRAME_INTERVAL); + current %= 10; + startMargin -= startFrame; + int pixcelX = (int) ((current-startMargin) * frameInterval); + + for (; pixcelX < rt.width; current+=DRAW_FRAME_INTERVAL){ + pixcelX = (int) ((current-startMargin) * frameInterval); + gc.drawLine(pixcelX, rt.height - 5, pixcelX, rt.height - 1); + if (scale >= DATimeline.SCALE_800) { + drawTimeString(gc, current+startFrame, pixcelX, 1); + }else if (scale >= DATimeline.SCALE_400) { + if((current+startFrame) % (DRAW_FRAME_INTERVAL*2) == 0){ + drawTimeString(gc, current+startFrame, pixcelX, 1); + } + }else{ + if((current+startFrame) % (DRAW_FRAME_INTERVAL*5) == 0){ + drawTimeString(gc, current+startFrame, pixcelX, 1); + } + } + } + + int detailedFrame = timeline.getDetailedFrame(); + if(-1 != detailedFrame){ + int detailedX = (int) ((detailedFrame - startFrame - startMargin + 0.5) * frameInterval); + gc.drawImage(balloon, 0, 0, balloon.getBounds().width, + balloon.getBounds().height, + detailedX - balloonHalfWidth, 0, + balloon.getBounds().width, timeline.getBounds().height - 1); + + String time = String.valueOf(detailedFrame); + gc.setForeground(ColorResources.BLACK); + gc.setFont(timeBalloonFont); + gc.drawString(time, + detailedX + - gc.stringExtent(time).x / 2, balloonHalfHeight + - gc.stringExtent(time).y / 2 - 4, true); + } + + if (timeline.getDrawDetailedTime()) { + gc.drawImage(balloon, 0, 0, balloon.getBounds().width, + balloon.getBounds().height, + timeline.getDetailedTimePosition() - balloonHalfWidth, 0, + balloon.getBounds().width, timeline.getBounds().height - 1); + + String time = String.valueOf((int)timeline.getDetailedTime()); + gc.setForeground(ColorResources.BLACK); + gc.setFont(timeBalloonFont); + gc.drawString(time, + timeline.getDetailedTimePosition() + - gc.stringExtent(time).x / 2, balloonHalfHeight + - gc.stringExtent(time).y / 2 - 4, true); + } + } +} diff --git a/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/timeline/DATimelineRenderer.java b/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/timeline/DATimelineRenderer.java index 6f81e94..d74fb77 100644 --- a/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/timeline/DATimelineRenderer.java +++ b/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/timeline/DATimelineRenderer.java @@ -25,29 +25,14 @@ */ package org.tizen.dynamicanalyzer.widgets.timeline; -import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Font; import org.eclipse.swt.graphics.GC; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.graphics.Point; -import org.eclipse.swt.graphics.Rectangle; -import org.tizen.dynamicanalyzer.widgets.helper.ColorResources; import org.tizen.dynamicanalyzer.widgets.helper.FontResources; -import org.tizen.dynamicanalyzer.widgets.helper.Formatter; -import org.tizen.dynamicanalyzer.widgets.helper.ImageResources; -public class DATimelineRenderer { +public abstract class DATimelineRenderer { public static final int DEFAULT_INTERVAL = 5; - - private final Image balloon = ImageResources.TIMELINE_DETAILED_TIME_BALLOON; - private final int balloonHalfWidth = balloon.getBounds().width / 2; - private final int balloonHalfHeight = balloon.getBounds().height / 2; - - private Font timeTickFont = FontResources.TIMELINE_TICK_FONT; - private Font timeBalloonFont = FontResources.TIMELINE_BALLOON_FONT; - - private int startTime; - int scale; + protected Font timeTickFont = FontResources.TIMELINE_TICK_FONT; + protected Font timeBalloonFont = FontResources.TIMELINE_BALLOON_FONT; public Font getTimeTickFont() { return timeTickFont; @@ -65,89 +50,5 @@ public class DATimelineRenderer { timeBalloonFont = font; } - private void drawRangeMarkers(GC gc, DATimeline timeline) { - DATimelineMarker startMarker = timeline - .getStartRangeMarker(); - DATimelineMarker endMarker = timeline.getEndRangeMarker(); - - if (startMarker.getTime() >= 0) { - double startMarkerTime = startMarker.getTime() - - timeline.getStartTime(); - int pixcelStartX = (int) Math.round(startMarkerTime * scale - * DEFAULT_INTERVAL); - gc.drawImage(startMarker.getImage(), pixcelStartX, 1); - } - - if (endMarker.getTime() >= 0) { - double endMarkerTime = endMarker.getTime() - - timeline.getStartTime(); - int pixcelEndX = (int) Math.round(endMarkerTime * scale - * DEFAULT_INTERVAL); - gc.drawImage(endMarker.getImage(), pixcelEndX - - endMarker.getImage().getBounds().width, 1); - } - } - - private void drawTimeString(GC gc, int totalSecond, int pixcelX, int pixcelY) { - Point p; - String timeString = Formatter.toTimelineFormat(totalSecond); - - p = gc.textExtent(timeString, SWT.DRAW_MNEMONIC); - gc.setForeground(ColorResources.TIMELINE_NUMBER_COLOR); - gc.drawText(timeString, pixcelX - p.x / 2, pixcelY, true); - gc.setForeground(ColorResources.TIMELINE_TICK_COLOR); - } - - public void draw(GC gc, DATimeline timeline) { - Rectangle rt = timeline.getClientArea(); - gc.setFont(timeTickFont); - gc.setBackground(ColorResources.TIMELINE_BG_COLOR); - gc.fillRectangle(rt); - - // draw underLine - gc.drawLine(0, rt.height - 1, rt.width, rt.height - 1); - - // draw time - int pixcelX = 0; - scale = timeline.getScale(); - int secondInterval = scale * DEFAULT_INTERVAL; - startTime = (int) timeline.getStartTime(); - pixcelX -= (timeline.getStartTime() - (double) startTime) - * ((double) secondInterval); - - for (; pixcelX < rt.width; startTime++, pixcelX += secondInterval) { - if (startTime % 10 == 0) { - drawTimeString(gc, startTime, pixcelX, 1); - gc.drawLine(pixcelX, rt.height - 7, pixcelX, rt.height - 1); - } else if (startTime % 5 == 0) { - if (scale >= DATimeline.SCALE_400) { - drawTimeString(gc, startTime, pixcelX, 1); - } - gc.drawLine(pixcelX, rt.height - 5, pixcelX, rt.height - 1); - } else { - if (scale >= DATimeline.SCALE_800) { - drawTimeString(gc, startTime, pixcelX, 1); - } - gc.drawLine(pixcelX, rt.height - 3, pixcelX, rt.height - 1); - } - } - - drawRangeMarkers(gc, timeline); - - if (timeline.getDrawDetailedTime()) { - gc.drawImage(balloon, 0, 0, balloon.getBounds().width, - balloon.getBounds().height, - timeline.getDetailedTimePosition() - balloonHalfWidth, 0, - balloon.getBounds().width, timeline.getBounds().height - 1); - - String time = Formatter.toTimeFormat((long) (timeline - .getDetailedTime() * 1000000)); - gc.setForeground(ColorResources.BLACK); - gc.setFont(timeBalloonFont); - gc.drawString(time, - timeline.getDetailedTimePosition() - - gc.stringExtent(time).x / 2, balloonHalfHeight - - gc.stringExtent(time).y / 2 - 4, true); - } - } + public abstract void draw(GC gc, DATimeline timeline); } diff --git a/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/timeline/DATimelineTimeRenderer.java b/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/timeline/DATimelineTimeRenderer.java new file mode 100644 index 0000000..acda475 --- /dev/null +++ b/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/timeline/DATimelineTimeRenderer.java @@ -0,0 +1,132 @@ +/* + * Dynamic Analyzer + * + * Copyright (c) 2013 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * YeongTaik Byeon + * 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.widgets.timeline; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.graphics.Rectangle; +import org.tizen.dynamicanalyzer.widgets.helper.ColorResources; +import org.tizen.dynamicanalyzer.widgets.helper.Formatter; +import org.tizen.dynamicanalyzer.widgets.helper.ImageResources; + +public class DATimelineTimeRenderer extends DATimelineRenderer { + public static final int DEFAULT_INTERVAL = 5; + private final Image balloon = ImageResources.TIMELINE_DETAILED_TIME_BALLOON; + private final int balloonHalfWidth = balloon.getBounds().width / 2; + private final int balloonHalfHeight = balloon.getBounds().height / 2; + + private int startTime; + int scale; + + private void drawRangeMarkers(GC gc, DATimeline timeline) { + DATimelineMarker startMarker = timeline.getStartRangeMarker(); + DATimelineMarker endMarker = timeline.getEndRangeMarker(); + + if (startMarker.getTime() >= 0) { + double startMarkerTime = startMarker.getTime() + - timeline.getStartTime(); + int pixcelStartX = (int) Math.round(startMarkerTime * scale + * DEFAULT_INTERVAL); + gc.drawImage(startMarker.getImage(), pixcelStartX, 1); + } + + if (endMarker.getTime() >= 0) { + double endMarkerTime = endMarker.getTime() + - timeline.getStartTime(); + int pixcelEndX = (int) Math.round(endMarkerTime * scale + * DEFAULT_INTERVAL); + gc.drawImage(endMarker.getImage(), pixcelEndX + - endMarker.getImage().getBounds().width, 1); + } + } + + private void drawTimeString(GC gc, int totalSecond, int pixcelX, int pixcelY) { + Point p; + String timeString = Formatter.toTimelineFormat(totalSecond); + + p = gc.textExtent(timeString, SWT.DRAW_MNEMONIC); + gc.setForeground(ColorResources.TIMELINE_NUMBER_COLOR); + gc.drawText(timeString, pixcelX - p.x / 2, pixcelY, true); + gc.setForeground(ColorResources.TIMELINE_TICK_COLOR); + } + + public void draw(GC gc, DATimeline timeline) { + Rectangle rt = timeline.getClientArea(); + gc.setFont(timeTickFont); + gc.setBackground(ColorResources.TIMELINE_BG_COLOR); + gc.fillRectangle(rt); + + // draw underLine + gc.drawLine(0, rt.height - 1, rt.width, rt.height - 1); + + // draw time + int pixcelX = 0; + scale = timeline.getScale(); + int secondInterval = scale * DEFAULT_INTERVAL; + startTime = (int) timeline.getStartTime(); + pixcelX -= (timeline.getStartTime() - (double) startTime) + * ((double) secondInterval); + + for (; pixcelX < rt.width; startTime++, pixcelX += secondInterval) { + if (startTime % 10 == 0) { + drawTimeString(gc, startTime, pixcelX, 1); + gc.drawLine(pixcelX, rt.height - 7, pixcelX, rt.height - 1); + } else if (startTime % 5 == 0) { + if (scale >= DATimeline.SCALE_400) { + drawTimeString(gc, startTime, pixcelX, 1); + } + gc.drawLine(pixcelX, rt.height - 5, pixcelX, rt.height - 1); + } else { + if (scale >= DATimeline.SCALE_800) { + drawTimeString(gc, startTime, pixcelX, 1); + } + gc.drawLine(pixcelX, rt.height - 3, pixcelX, rt.height - 1); + } + } + + drawRangeMarkers(gc, timeline); + + if (timeline.getDrawDetailedTime()) { + gc.drawImage(balloon, 0, 0, balloon.getBounds().width, + balloon.getBounds().height, + timeline.getDetailedTimePosition() - balloonHalfWidth, 0, + balloon.getBounds().width, timeline.getBounds().height - 1); + + String time = Formatter.toTimeFormat((long) (timeline + .getDetailedTime() * 1000000)); + gc.setForeground(ColorResources.BLACK); + gc.setFont(timeBalloonFont); + gc.drawString(time, + timeline.getDetailedTimePosition() + - gc.stringExtent(time).x / 2, balloonHalfHeight + - gc.stringExtent(time).y / 2 - 4, true); + } + } + +} diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/common/AnalyzerPaths.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/common/AnalyzerPaths.java index 4f4fb5c..be66b47 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/common/AnalyzerPaths.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/common/AnalyzerPaths.java @@ -36,6 +36,9 @@ public class AnalyzerPaths { .getInstallPath(); public static final String DYNAMIC_ANALYZER_SAVE_PATH = PathManager .getSavePath(); + public static final String DYNAMIC_ANALYZER_AUTOTEST_PATH = TIZEN_SDK_DATA_PATH + + File.separator + "test" + File.separator + + AnalyzerConstants.DYNAMIC_ANALYZER_FOLDER_NAME; public static final String TOOL_FOLDER_PATH = DYNAMIC_ANALYZER_INSTALL_PATH + File.separator + AnalyzerConstants.TOOLS_FOLDER_NAME; public static final String TEMP_FOLDER_PATH = DYNAMIC_ANALYZER_SAVE_PATH diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/logparser/LogCenterConstants.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/logparser/LogCenterConstants.java index b6f83a7..b1c3274 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/logparser/LogCenterConstants.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/logparser/LogCenterConstants.java @@ -45,6 +45,7 @@ public class LogCenterConstants { public static final int LOG_CUSTOM_CHART = 13; public static final int LOG_SYNC = 14; public static final int LOG_NETWORK = 15; + public static final int LOG_GLES20 = 16; public static final int TYPE_CALLSTACK = 99; @@ -148,7 +149,6 @@ public class LogCenterConstants { public static final int HTTP_API_OTHER = 22; public static final int HTTP_API_CLOSE = 23; - /* Log snapshot */ public static final int SNAPSHOT_IMAGE_PATH_INDEX = 12; public static final int SNAPSHOT_ROTATE_INDEX = 13; @@ -257,7 +257,7 @@ public class LogCenterConstants { public static final int SYNC_API_TYPE_NOTIFY = 7; public static final int SYNC_API_TYPE_NOTIFY_ALL = 8; public static final int SYNC_API_TYPE_OTHER = 9; - + /* network log : 15 */ public static final int NETWORK_OBJECT_INDEX = 12; public static final int NETWORK_FD_INDEX = 13; @@ -268,6 +268,11 @@ public class LogCenterConstants { public static final int NETWORK_DESTINATION_ADDRESS_INDEX = 18; public static final int NETWORK_RESERVED_INDEX = 19; + /* gles20 log : 16 */ + public static final int GL_API_TYPE_INDEX = 12; + public static final int GL_CONTEXT_VALUE_INDEX = 13; + public static final int GL_ELAPSED_TIME_INDEX = 14; + /* Common Column Size */ public static final int COMMON_COLUMN_SIZE_RID = 80; public static final int COMMON_COLUMN_SIZE_ID = 20; diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/model/TreeInput.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/model/TreeInput.java index 702f4fb..bfb29fa 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/model/TreeInput.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/model/TreeInput.java @@ -33,6 +33,8 @@ public class TreeInput extends TableInput { List children = null; String parent = null; String child = null; + + TreeInput parentInput = null; public List getChildren() { if (null == children) { @@ -54,4 +56,17 @@ public class TreeInput extends TableInput { public void setChild(String child) { this.child = child; } + + public TreeInput getParentInput() { + return parentInput; + } + + public void setParentInput(TreeInput parentInput) { + this.parentInput = parentInput; + } + + public void addChild(TreeInput childInput) { + getChildren().add(childInput); + childInput.setParentInput(this); + } } diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/AnalyzerLabels.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/AnalyzerLabels.java index 1a17196..fbd0685 100755 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/AnalyzerLabels.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/AnalyzerLabels.java @@ -116,6 +116,7 @@ public class AnalyzerLabels extends NLS { public static String COOLBAR_AREA_TIMELINE; public static String COOLBAR_AREA_RANGE; public static String COOLBAR_AREA_NETWORK; + public static String COOLBAR_AREA_GRAPHICS; public static String COOLBAR_AREA_FILE_TOOLTIP; public static String COOLBAR_AREA_SUMMARY_TOOLTIP; @@ -124,7 +125,8 @@ public class AnalyzerLabels extends NLS { public static String COOLBAR_AREA_TIMELINE_TOOLTIP; public static String COOLBAR_AREA_RANGE_TOOLTIP; public static String COOLBAR_AREA_NETWORK_TOOLTIP; - + public static String COOLBAR_AREA_GRAPHICS_TOOLTIP; + public static String COOLBAR_AREA_FILE_TOOLTIP_MAC; public static String COOLBAR_AREA_SUMMARY_TOOLTIP_MAC; public static String COOLBAR_AREA_THREAD_TOOLTIP_MAC; @@ -132,6 +134,7 @@ public class AnalyzerLabels extends NLS { public static String COOLBAR_AREA_TIMELINE_TOOLTIP_MAC; public static String COOLBAR_AREA_RANGE_TOOLTIP_MAC; public static String COOLBAR_AREA_NETWORK_TOOLTIP_MAC; + public static String COOLBAR_AREA_GRAPHICS_TOOLTIP_MAC; public static String COOLBAR_AREA_CONFIGURATION_FEATURES; public static String COOLBAR_AREA_CONFIGURATION_SETTING; diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/AnalyzerLabels.properties b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/AnalyzerLabels.properties index 3869112..0a0efff 100755 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/AnalyzerLabels.properties +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/AnalyzerLabels.properties @@ -80,6 +80,7 @@ COOLBAR_AREA_UI=UI COOLBAR_AREA_TIMELINE=Timeline COOLBAR_AREA_RANGE=Range COOLBAR_AREA_NETWORK=Network +<<<<<<< Updated upstream #COOLBAR_AREA_TIMELINE_TOOLTIP=Timeline [Ctrl + 1] #COOLBAR_AREA_FILE_TOOLTIP=File [Ctrl + 2] @@ -87,6 +88,9 @@ COOLBAR_AREA_NETWORK=Network #COOLBAR_AREA_UI_TOOLTIP=UI [Ctrl + 4] #COOLBAR_AREA_SUMMARY_TOOLTIP=Summary [Ctrl + 5] #COOLBAR_AREA_RANGE_TOOLTIP=Range [Ctrl + 6] +======= +COOLBAR_AREA_GRAPHICS=Graphics +>>>>>>> Stashed changes COOLBAR_AREA_TIMELINE_TOOLTIP=Timeline [Ctrl + 1] COOLBAR_AREA_FILE_TOOLTIP=File [Ctrl + 2] @@ -97,6 +101,7 @@ COOLBAR_AREA_GRAPHICS_TOOLTIP=Graphics [Command + 6] COOLBAR_AREA_SUMMARY_TOOLTIP=Summary [Ctrl + 7] COOLBAR_AREA_RANGE_TOOLTIP=Range [Ctrl + 8] +<<<<<<< Updated upstream #COOLBAR_AREA_TIMELINE_TOOLTIP_MAC=Timeline [Command + 1] #COOLBAR_AREA_FILE_TOOLTIP_MAC=File [Command + 2] @@ -104,6 +109,8 @@ COOLBAR_AREA_RANGE_TOOLTIP=Range [Ctrl + 8] #COOLBAR_AREA_UI_TOOLTIP_MAC=UI [Command + 4] #COOLBAR_AREA_SUMMARY_TOOLTIP_MAC=Summary [Command + 5] #COOLBAR_AREA_RANGE_TOOLTIP_MAC=Range [Command + 6] +======= +>>>>>>> Stashed changes COOLBAR_AREA_TIMELINE_TOOLTIP_MAC=Timeline [Command + 1] COOLBAR_AREA_FILE_TOOLTIP_MAC=File [Command + 2] COOLBAR_AREA_NETWORK_TOOLTIP_MAC=Network [Command + 3] diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/ConfigureLabels.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/ConfigureLabels.java index 1141041..5a2c4aa 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/ConfigureLabels.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/ConfigureLabels.java @@ -96,6 +96,8 @@ public class ConfigureLabels extends NLS { public static String CONFIGUREMANAGER_CHART_AVAILABLE_ITEM_LIST; public static String CONFIGUREMANAGER_CHART_SELECTED_ITEM_LIST; + public static String INTERNAL_LOG_LEVEL; + public static String THEME; static { diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/GLPageLabels.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/GLPageLabels.java new file mode 100644 index 0000000..da07971 --- /dev/null +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/GLPageLabels.java @@ -0,0 +1,147 @@ +/* + * Dynamic Analyzer + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * 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.nl; + +import org.eclipse.osgi.util.NLS; + +public class GLPageLabels extends NLS { + private static final String BUNDLE_NAME = "org.tizen.dynamicanalyzer.nl.GLPageLabels"; //$NON-NLS-1$ + + public static String GL_CHART_TITLE_TIME; + public static String GL_CHART_TITLE_FRAME; + + public static String GL_DETAILS_VIEW_TITLE; + + /* GL API List view */ + public static String GL_API_LIST_VIEW_TITLE; + public static String GL_API_LIST_VIEW_INDEX; + public static String GL_API_LIST_VIEW_TIME; + public static String GL_API_LIST_VIEW_NAME; + public static String GL_API_LIST_VIEW_PARAMETER; + public static String GL_API_LIST_VIEW_ELAPSED_TIME; + public static String GL_API_LIST_VIEW_ERROR; + + /* GL context view */ + public static String GL_CONTEXT_VIEW_TITLE; + public static String GL_CONTEXT_VIEW_NAME; + public static String GL_CONTEXT_VIEW_VALUE; + public static String GL_CONTEXT_VIEW_PREV; + + public static String GL_CONTEXT_V0; + public static String GL_CONTEXT_V1; + public static String GL_CONTEXT_V2; + public static String GL_CONTEXT_V3; + public static String GL_CONTEXT_ENABLED; + public static String GL_CONTEXT_DISABLED; + public static String GL_CONTEXT_ACTIVATED; + public static String GL_CONTEXT_DEACTIVATED; + + public static String GL_CONTEXT_VERTEX_INFO; + public static String GL_CONTEXT_GENERIC_VERTEX_ATTRIBUTE; + public static String GL_CONTEXT_ATTRIBUTES; + public static String GL_CONTEXT_ATTRIBUTE_ARRAYS; + public static String GL_CONTEXT_SIZE; + public static String GL_CONTEXT_TYPE; + public static String GL_CONTEXT_NORMALIZED; + public static String GL_CONTEXT_STRIDE; + public static String GL_CONTEXT_POINTER; + public static String GL_CONTEXT_VERTEX_BUFFER_OBJECT; + public static String GL_CONTEXT_TARGET; + public static String GL_CONTEXT_DATA; + public static String GL_CONTEXT_USAGE; + public static String GL_CONTEXT_TRANSFORMATION; + public static String GL_CONTEXT_VIEWPORT; + public static String GL_CONTEXT_X; + public static String GL_CONTEXT_Y; + public static String GL_CONTEXT_WIDTH; + public static String GL_CONTEXT_HEIGHT; + public static String GL_CONTEXT_DEPTH_RANGE; + public static String GL_CONTEXT_NEAR; + public static String GL_CONTEXT_FAR; + public static String GL_CONTEXT_RASTERIZATION; + public static String GL_CONTEXT_LINE_WIDTH; + public static String GL_CONTEXT_CULLING; + public static String GL_CONTEXT_ORIENTATION; + public static String GL_CONTEXT_MODE; + public static String GL_CONTEXT_POLYGON_OFFSET; + public static String GL_CONTEXT_FACTOR; + public static String GL_CONTEXT_UNITS; + public static String GL_CONTEXT_FRAGMENT_OPERATION; + public static String GL_CONTEXT_SCISSOR; + public static String GL_CONTEXT_STENCIL; + public static String GL_CONTEXT_FRONT; + public static String GL_CONTEXT_FUNCTION; + public static String GL_CONTEXT_REFERENCE; + public static String GL_CONTEXT_MASK; + public static String GL_CONTEXT_STENCIL_TEST_FAIL_ACTION; + public static String GL_CONTEXT_DEPTH_TEST_FAIL_ACTION; + public static String GL_CONTEXT_DEPTH_TEST_PASS_ACTION; + public static String GL_CONTEXT_BACK; + public static String GL_CONTEXT_DEPTH; + public static String GL_CONTEXT_BLENDING; + public static String GL_CONTEXT_SOURCE; + public static String GL_CONTEXT_RGB_FACTOR; + public static String GL_CONTEXT_ALPHA_FACTOR; + public static String GL_CONTEXT_DESTINATION; + public static String GL_CONTEXT_RGB_EQUATION; + public static String GL_CONTEXT_ALPHA_EQUATION; + public static String GL_CONTEXT_BLEND_COLOR; + public static String GL_CONTEXT_DITHER; + public static String GL_CONTEXT_PIXEL; + public static String GL_CONTEXT_PACK_ALIGNMENT; + public static String GL_CONTEXT_UNPACK_ALIGNMENT; + public static String GL_CONTEXT_TEXTURE; + public static String GL_CONTEXT_TEXTURE_UNITS; + public static String GL_CONTEXT_2D_BINDING; + public static String GL_CONTEXT_CUBEMAP_BINDING; + public static String GL_CONTEXT_TEXTURE_OBJECT; + public static String GL_CONTEXT_MAG_FUNCTION; + public static String GL_CONTEXT_MIN_FUNCTION; + public static String GL_CONTEXT_WRAP_MODE_S; + public static String GL_CONTEXT_WRAP_MODE_T; + public static String GL_CONTEXT_MIPMAP_LEVEL; + public static String GL_CONTEXT_FORMAT; + public static String GL_CONTEXT_PROGRAM_OBJ; + public static String GL_CONTEXT_VERTEX_SHADER; + public static String GL_CONTEXT_FRAGMENT_SHADER; + public static String GL_CONTEXT_ATTRIBUTE; + public static String GL_CONTEXT_NAME; + public static String GL_CONTEXT_INDEX; + public static String GL_CONTEXT_UNIFORM; + public static String GL_CONTEXT_VALUE; + public static String GL_CONTEXT_SHADER_OBJECT; + public static String GL_CONTEXT_FRAMEBUFFER_STATE; + public static String GL_CONTEXT_FRAMEBUFER_BINDING; + + static { + // initialize resource bundle + NLS.initializeMessages(BUNDLE_NAME, GLPageLabels.class); + } + + private GLPageLabels() { + } +} diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/GLPageLabels.properties b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/GLPageLabels.properties new file mode 100644 index 0000000..262f758 --- /dev/null +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/GLPageLabels.properties @@ -0,0 +1,131 @@ +GL_CHART_TITLE_TIME=Time +GL_CHART_TITLE_FRAME=Frame + +GL_DETAILS_VIEW_TITLE=Details + +GL_API_LIST_VIEW_TITLE=APIs +GL_API_LIST_VIEW_INDEX=# +GL_API_LIST_VIEW_TIME=Time +GL_API_LIST_VIEW_NAME=API +GL_API_LIST_VIEW_PARAMETER=Parameter +GL_API_LIST_VIEW_ELAPSED_TIME=Elapsed time +GL_API_LIST_VIEW_ERROR=Error + +GL_CONTEXT_VIEW_TITLE=State +GL_CONTEXT_VIEW_NAME=Name +GL_CONTEXT_VIEW_VALUE=Value +GL_CONTEXT_VIEW_PREV=Prev. + + +GL_CONTEXT_V0=V0 +GL_CONTEXT_V1=V1 +GL_CONTEXT_V2=V2 +GL_CONTEXT_V3=V3 +GL_CONTEXT_ENABLED=Enabled +GL_CONTEXT_DISABLED=Disabled +GL_CONTEXT_ACTIVATED=Activated +GL_CONTEXT_DEACTIVATED=Deactivated + +GL_CONTEXT_VERTEX_INFO=Vertex Info + GL_CONTEXT_GENERIC_VERTEX_ATTRIBUTE=Generic Vertex Attribute +GL_CONTEXT_ATTRIBUTES=Attributes + # index + # v0~ +GL_CONTEXT_ATTRIBUTE_ARRAYS=Attribute Arrays + GL_CONTEXT_SIZE=Size + GL_CONTEXT_TYPE=Type + GL_CONTEXT_NORMALIZED=Normalized + GL_CONTEXT_STRIDE=Stride + GL_CONTEXT_POINTER=Pointer + GL_CONTEXT_VERTEX_BUFFER_OBJECT=Vertex Buffer Object + GL_CONTEXT_TARGET=Target + # Size + GL_CONTEXT_DATA=Data + GL_CONTEXT_USAGE=Usage +GL_CONTEXT_TRANSFORMATION=Transformation + GL_CONTEXT_VIEWPORT=Viewport + GL_CONTEXT_X=X + GL_CONTEXT_Y=Y + GL_CONTEXT_WIDTH=Width + GL_CONTEXT_HEIGHT=Height + GL_CONTEXT_DEPTH_RANGE=Depth Range + GL_CONTEXT_NEAR=Near + GL_CONTEXT_FAR=Far +GL_CONTEXT_RASTERIZATION=Rasterization + GL_CONTEXT_LINE_WIDTH=Line Width + GL_CONTEXT_CULLING=Culling + GL_CONTEXT_ORIENTATION=Orientation + GL_CONTEXT_MODE=Mode + GL_CONTEXT_POLYGON_OFFSET=Polygon Offset + GL_CONTEXT_FACTOR=Factor +GL_CONTEXT_UNITS=Units +GL_CONTEXT_FRAGMENT_OPERATION=Fragment Operation + GL_CONTEXT_SCISSOR=Scissor + # X + # Y + # Width + # Height + GL_CONTEXT_STENCIL=Stencil + GL_CONTEXT_FRONT=Front + GL_CONTEXT_FUNCTION=Function + GL_CONTEXT_REFERENCE=Reference + GL_CONTEXT_MASK=Mask + GL_CONTEXT_STENCIL_TEST_FAIL_ACTION=Stencil Test Fail Action + GL_CONTEXT_DEPTH_TEST_FAIL_ACTION=Depth Test Fail Action + GL_CONTEXT_DEPTH_TEST_PASS_ACTION=Depth Test Pass Action + GL_CONTEXT_BACK=Back + # Function + # Reference + # Mask + # Stencil Test Fail Action + # Depth Test Fail Action + # Depth Test Pass Action + GL_CONTEXT_DEPTH=Depth + # Function + GL_CONTEXT_BLENDING=Blending + GL_CONTEXT_SOURCE=Source + GL_CONTEXT_RGB_FACTOR=RGB Factor + GL_CONTEXT_ALPHA_FACTOR=Alpha Factor + GL_CONTEXT_DESTINATION=Destination + # RGB Factor + # Alpha Factor + GL_CONTEXT_RGB_EQUATION=RGB Equation + GL_CONTEXT_ALPHA_EQUATION=Alpha Equation + GL_CONTEXT_BLEND_COLOR=Blend Color + GL_CONTEXT_DITHER=Dither +GL_CONTEXT_PIXEL=Pixel + GL_CONTEXT_PACK_ALIGNMENT=Pack Alignment + GL_CONTEXT_UNPACK_ALIGNMENT=Unpack Alignment +GL_CONTEXT_TEXTURE=Texture + GL_CONTEXT_TEXTURE_UNITS=Texture Units + GL_CONTEXT_2D_BINDING=2D Binding + GL_CONTEXT_CUBEMAP_BINDING=Cubemap Binding + GL_CONTEXT_TEXTURE_OBJECT=Texture Objects + GL_CONTEXT_MAG_FUNCTION=Mag. Function + GL_CONTEXT_MIN_FUNCTION=Min. Function + GL_CONTEXT_WRAP_MODE_S=Wrap Mode s + GL_CONTEXT_WRAP_MODE_T=Wrap Mode t + GL_CONTEXT_MIPMAP_LEVEL=Mipmap Level + # Target + # Width + # Height + GL_CONTEXT_FORMAT=Format + # Type +GL_CONTEXT_PROGRAM_OBJ=Program Objects + GL_CONTEXT_VERTEX_SHADER=Vertex Shader + GL_CONTEXT_FRAGMENT_SHADER=Fragment Shader + GL_CONTEXT_ATTRIBUTE=Attributes + GL_CONTEXT_NAME=Name + GL_CONTEXT_INDEX=Index + GL_CONTEXT_UNIFORM=Uniforms + # Name + GL_CONTEXT_VALUE=Value +GL_CONTEXT_SHADER_OBJECT=Shader Objects + # Type + # Source +GL_CONTEXT_FRAMEBUFFER_STATE=Framebuffer State + GL_CONTEXT_FRAMEBUFER_BINDING=Framebuffer Binding + + + + \ No newline at end of file diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/resources/ColorResources.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/resources/ColorResources.java index 81bb4c7..486ac7e 100755 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/resources/ColorResources.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/resources/ColorResources.java @@ -361,30 +361,30 @@ public class ColorResources { public static Color ADD_CHART_DISABLE_COLOR_END = getColor("add_chart_disable_color_end"); //$NON-NLS-1$ /** timeline chart **/ - public static Color SERIESE_COLOR_CPU_SYSTEM = getColor("seriesColorCPUSystem"); //$NON-NLS-1$ - public static Color SERIESE_COLOR_CPU_APP = getColor("seriesColorCPUApp"); //$NON-NLS-1$ + public static Color SERIES_COLOR_CPU_SYSTEM = getColor("seriesColorCPUSystem"); //$NON-NLS-1$ + public static Color SERIES_COLOR_CPU_APP = getColor("seriesColorCPUApp"); //$NON-NLS-1$ - public static Color SERIESE_COLOR_CPUCORE_CORE0 = getColor("seriesColorCPUCoreCore0"); //$NON-NLS-1$ - public static Color SERIESE_COLOR_CPUCORE_CORE1 = getColor("seriesColorCPUCoreCore1"); //$NON-NLS-1$ - public static Color SERIESE_COLOR_CPUCORE_CORE2 = getColor("seriesColorCPUCoreCore2"); //$NON-NLS-1$ - public static Color SERIESE_COLOR_CPUCORE_CORE3 = getColor("seriesColorCPUCoreCore3"); //$NON-NLS-1$ + public static Color SERIES_COLOR_CPUCORE_CORE0 = getColor("seriesColorCPUCoreCore0"); //$NON-NLS-1$ + public static Color SERIES_COLOR_CPUCORE_CORE1 = getColor("seriesColorCPUCoreCore1"); //$NON-NLS-1$ + public static Color SERIES_COLOR_CPUCORE_CORE2 = getColor("seriesColorCPUCoreCore2"); //$NON-NLS-1$ + public static Color SERIES_COLOR_CPUCORE_CORE3 = getColor("seriesColorCPUCoreCore3"); //$NON-NLS-1$ - public static Color SERIESE_COLOR_CPU_FREQ = getColor("seriesColorCPUFreq"); //$NON-NLS-1$ + public static Color SERIES_COLOR_CPU_FREQ = getColor("seriesColorCPUFreq"); //$NON-NLS-1$ - public static Color SERIESE_COLOR_HEAP_SYSTEM = getColor("seriesColorHeapSystem"); //$NON-NLS-1$ - public static Color SERIESE_COLOR_HEAP_USER = getColor("seriesColorHeapApp"); //$NON-NLS-1$ + public static Color SERIES_COLOR_HEAP_SYSTEM = getColor("seriesColorHeapSystem"); //$NON-NLS-1$ + public static Color SERIES_COLOR_HEAP_USER = getColor("seriesColorHeapApp"); //$NON-NLS-1$ - public static Color SERIESE_COLOR_PROCESS_VSS = getColor("seriesColorProcessVSS"); //$NON-NLS-1$ - public static Color SERIESE_COLOR_PROCESS_RSS = getColor("seriesColorProcessRSS"); //$NON-NLS-1$ - public static Color SERIESE_COLOR_PROCESS_PSS = getColor("seriesColorProcessPSS"); //$NON-NLS-1$ + public static Color SERIES_COLOR_PROCESS_VSS = getColor("seriesColorProcessVSS"); //$NON-NLS-1$ + public static Color SERIES_COLOR_PROCESS_RSS = getColor("seriesColorProcessRSS"); //$NON-NLS-1$ + public static Color SERIES_COLOR_PROCESS_PSS = getColor("seriesColorProcessPSS"); //$NON-NLS-1$ - public static Color SERIESE_COLOR_MEMORY_SYS_MAX = getColor("seriesColorMemorySysMax"); //$NON-NLS-1$ - public static Color SERIESE_COLOR_MEMORY_SYS_USED = getColor("seriesColorMemorySysUsed"); //$NON-NLS-1$ - public static Color SERIESE_COLOR_MEMORY_APP_USED = getColor("seriesColorMemoryAppUsed"); //$NON-NLS-1$ + public static Color SERIES_COLOR_MEMORY_SYS_MAX = getColor("seriesColorMemorySysMax"); //$NON-NLS-1$ + public static Color SERIES_COLOR_MEMORY_SYS_USED = getColor("seriesColorMemorySysUsed"); //$NON-NLS-1$ + public static Color SERIES_COLOR_MEMORY_APP_USED = getColor("seriesColorMemoryAppUsed"); //$NON-NLS-1$ - public static Color SERIESE_COLOR_FILE_READ = getColor("seriesColorFileRead"); //$NON-NLS-1$ - public static Color SERIESE_COLOR_FILE_WRITE = getColor("seriesColorFileWrite"); //$NON-NLS-1$ - public static Color SERIESE_COLOR_FILE_FD = getColor("seriesColorFileFD"); //$NON-NLS-1$ + public static Color SERIES_COLOR_FILE_READ = getColor("seriesColorFileRead"); //$NON-NLS-1$ + public static Color SERIES_COLOR_FILE_WRITE = getColor("seriesColorFileWrite"); //$NON-NLS-1$ + public static Color SERIES_COLOR_FILE_FD = getColor("seriesColorFileFD"); //$NON-NLS-1$ public static Color SERIES_COLOR_UI_EVENT_KEY = getColor("seriesColorUIEventKey");//$NON-NLS-1$ public static Color SERIES_COLOR_UI_EVENT_TOUCH = getColor("seriesColorUIEventTouch");//$NON-NLS-1$ @@ -720,30 +720,30 @@ public class ColorResources { ADD_CHART_DISABLE_COLOR_END = getColor("add_chart_disable_color_end"); //$NON-NLS-1$ /** timeline chart **/ - SERIESE_COLOR_CPU_SYSTEM = getColor("seriesColorCPUSystem"); //$NON-NLS-1$ - SERIESE_COLOR_CPU_APP = getColor("seriesColorCPUApp"); //$NON-NLS-1$ + SERIES_COLOR_CPU_SYSTEM = getColor("seriesColorCPUSystem"); //$NON-NLS-1$ + SERIES_COLOR_CPU_APP = getColor("seriesColorCPUApp"); //$NON-NLS-1$ - SERIESE_COLOR_CPUCORE_CORE0 = getColor("seriesColorCPUCoreCore0"); //$NON-NLS-1$ - SERIESE_COLOR_CPUCORE_CORE1 = getColor("seriesColorCPUCoreCore1"); //$NON-NLS-1$ - SERIESE_COLOR_CPUCORE_CORE2 = getColor("seriesColorCPUCoreCore2"); //$NON-NLS-1$ - SERIESE_COLOR_CPUCORE_CORE3 = getColor("seriesColorCPUCoreCore3"); //$NON-NLS-1$ + SERIES_COLOR_CPUCORE_CORE0 = getColor("seriesColorCPUCoreCore0"); //$NON-NLS-1$ + SERIES_COLOR_CPUCORE_CORE1 = getColor("seriesColorCPUCoreCore1"); //$NON-NLS-1$ + SERIES_COLOR_CPUCORE_CORE2 = getColor("seriesColorCPUCoreCore2"); //$NON-NLS-1$ + SERIES_COLOR_CPUCORE_CORE3 = getColor("seriesColorCPUCoreCore3"); //$NON-NLS-1$ - SERIESE_COLOR_CPU_FREQ = getColor("seriesColorCPUFreq"); //$NON-NLS-1$ + SERIES_COLOR_CPU_FREQ = getColor("seriesColorCPUFreq"); //$NON-NLS-1$ - SERIESE_COLOR_HEAP_SYSTEM = getColor("seriesColorHeapSystem"); //$NON-NLS-1$ - SERIESE_COLOR_HEAP_USER = getColor("seriesColorHeapApp"); //$NON-NLS-1$ + SERIES_COLOR_HEAP_SYSTEM = getColor("seriesColorHeapSystem"); //$NON-NLS-1$ + SERIES_COLOR_HEAP_USER = getColor("seriesColorHeapApp"); //$NON-NLS-1$ - SERIESE_COLOR_PROCESS_VSS = getColor("seriesColorProcessVSS"); //$NON-NLS-1$ - SERIESE_COLOR_PROCESS_RSS = getColor("seriesColorProcessRSS"); //$NON-NLS-1$ - SERIESE_COLOR_PROCESS_PSS = getColor("seriesColorProcessPSS"); //$NON-NLS-1$ + SERIES_COLOR_PROCESS_VSS = getColor("seriesColorProcessVSS"); //$NON-NLS-1$ + SERIES_COLOR_PROCESS_RSS = getColor("seriesColorProcessRSS"); //$NON-NLS-1$ + SERIES_COLOR_PROCESS_PSS = getColor("seriesColorProcessPSS"); //$NON-NLS-1$ - SERIESE_COLOR_MEMORY_SYS_MAX = getColor("seriesColorMemorySysMax"); //$NON-NLS-1$ - SERIESE_COLOR_MEMORY_SYS_USED = getColor("seriesColorMemorySysUsed"); //$NON-NLS-1$ - SERIESE_COLOR_MEMORY_APP_USED = getColor("seriesColorMemoryAppUsed"); //$NON-NLS-1$ + SERIES_COLOR_MEMORY_SYS_MAX = getColor("seriesColorMemorySysMax"); //$NON-NLS-1$ + SERIES_COLOR_MEMORY_SYS_USED = getColor("seriesColorMemorySysUsed"); //$NON-NLS-1$ + SERIES_COLOR_MEMORY_APP_USED = getColor("seriesColorMemoryAppUsed"); //$NON-NLS-1$ - SERIESE_COLOR_FILE_READ = getColor("seriesColorFileRead"); //$NON-NLS-1$ - SERIESE_COLOR_FILE_WRITE = getColor("seriesColorFileWrite"); //$NON-NLS-1$ - SERIESE_COLOR_FILE_FD = getColor("seriesColorFileFD"); //$NON-NLS-1$ + SERIES_COLOR_FILE_READ = getColor("seriesColorFileRead"); //$NON-NLS-1$ + SERIES_COLOR_FILE_WRITE = getColor("seriesColorFileWrite"); //$NON-NLS-1$ + SERIES_COLOR_FILE_FD = getColor("seriesColorFileFD"); //$NON-NLS-1$ SELECTION_RANGE = getColor("selectionRange"); //$NON-NLS-1$ SELECTION_LINE = getColor("selectionLine"); //$NON-NLS-1$ diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/resources/ImageResources.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/resources/ImageResources.java index 7b6310b..1d35eff 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/resources/ImageResources.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/resources/ImageResources.java @@ -263,7 +263,7 @@ public class ImageResources { public static final Image UI_EVENT = getPngImage("time_line_icon_UI_events"); //$NON-NLS-1$ public static final Image CHART_CUSTOM = getPngImage("time_line_icon_custom"); //$NON-NLS-1$ public static final Image CHART_NETWORK = getPngImage("time_line_icon_traffic"); //$NON-NLS-1$ - + /* Resource */ public static final Image TYPE_FILE = getPngImage("resource/resource_file"); //$NON-NLS-1$ public static final Image TYPE_SOCKET = getPngImage("resource/resource_socket"); //$NON-NLS-1$ @@ -360,6 +360,10 @@ public class ImageResources { public static final Image TAB_ICON_UI = getPngImage("tab_icon_userinterface"); //$NON-NLS-1$ public static final Image TAB_ICON_SUMMARY = getPngImage("tab_icon_summary"); //$NON-NLS-1$ public static final Image TAB_ICON_RANGE = getPngImage("tab_icon_range"); //$NON-NLS-1$ + + /* gl */ + public static final Image GL_DROP_LEFT_ARROW = getPngImage("arrow_full_left"); //$NON-NLS-1$ + public static final Image GL_DROP_DOWN_ARROW = getPngImage("arrow_full_down"); //$NON-NLS-1$ private static Image getImage(String pluginId, String folderName, String imageName, String extension) { diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/shortcut/ShortCutManager.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/shortcut/ShortCutManager.java index 275d026..13ed7d7 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/shortcut/ShortCutManager.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/shortcut/ShortCutManager.java @@ -10,6 +10,7 @@ import org.tizen.dynamicanalyzer.handlers.ReplayTraceHandler; import org.tizen.dynamicanalyzer.nl.AnalyzerLabels; import org.tizen.dynamicanalyzer.ui.file.FilePage; import org.tizen.dynamicanalyzer.ui.network.NetworkPage; +import org.tizen.dynamicanalyzer.ui.opengl.ui.GLPage; import org.tizen.dynamicanalyzer.ui.range.RangeDataManager; import org.tizen.dynamicanalyzer.ui.range.RangePage; import org.tizen.dynamicanalyzer.ui.summary.SummaryPage; @@ -29,6 +30,15 @@ public class ShortCutManager { private static ShortCutManager instance = null; private boolean enabled = true; private int CTRL_STATE_MASK = SWT.CTRL; + + private static int KEY_1 = 49; + private static int KEY_2 = 50; + private static int KEY_3 = 51; + private static int KEY_4 = 52; + private static int KEY_5 = 53; + private static int KEY_6 = 54; + private static int KEY_7 = 55; + private static int KEY_8 = 56; public static String START_TRACE = null; public static String STOP_TRACE = null; @@ -42,6 +52,7 @@ public class ShortCutManager { public static String COOLBAR_AREA_TIMELINE_TOOLTIP = null; public static String COOLBAR_AREA_RANGE_TOOLTIP = null; public static String COOLBAR_AREA_NETWORK_TOOLTIP = null; + public static String COOLBAR_AREA_GRAPHICS_TOOLTIP = null; public static String COOLBAR_AREA_ABOUT = null; public static String COOLBAR_AREA_SETTING = null; @@ -61,7 +72,7 @@ public class ShortCutManager { COOLBAR_AREA_TIMELINE_TOOLTIP = AnalyzerLabels.COOLBAR_AREA_TIMELINE_TOOLTIP_MAC; COOLBAR_AREA_RANGE_TOOLTIP = AnalyzerLabels.COOLBAR_AREA_RANGE_TOOLTIP_MAC; COOLBAR_AREA_NETWORK_TOOLTIP = AnalyzerLabels.COOLBAR_AREA_NETWORK_TOOLTIP_MAC; - + COOLBAR_AREA_GRAPHICS_TOOLTIP = AnalyzerLabels.COOLBAR_AREA_GRAPHICS_TOOLTIP_MAC; COOLBAR_AREA_ABOUT = AnalyzerLabels.ABOUT_MAC; COOLBAR_AREA_SETTING = AnalyzerLabels.SETTING_MAC; @@ -121,25 +132,28 @@ public class ShortCutManager { button.setToggled(!button.isToggled()); } // ctrl + number 1 ~ 6 page - else if (event.stateMask == CTRL_STATE_MASK && event.keyCode == 49) { + else if (event.stateMask == CTRL_STATE_MASK && event.keyCode == KEY_1) { System.out.println("timeline page"); AnalyzerUtil.changePage(TimelinePage.ID); - } else if (event.stateMask == CTRL_STATE_MASK && event.keyCode == 50) { + } else if (event.stateMask == CTRL_STATE_MASK && event.keyCode == KEY_2) { System.out.println("file page"); AnalyzerUtil.changePage(FilePage.ID); - } else if (event.stateMask == CTRL_STATE_MASK && event.keyCode == 51) { + } else if (event.stateMask == CTRL_STATE_MASK && event.keyCode == KEY_3) { System.out.println("NetworkPage page"); AnalyzerUtil.changePage(NetworkPage.ID); - } else if (event.stateMask == CTRL_STATE_MASK && event.keyCode == 52) { + } else if (event.stateMask == CTRL_STATE_MASK && event.keyCode == KEY_4) { System.out.println("thread page"); AnalyzerUtil.changePage(ThreadPage.ID); - } else if (event.stateMask == CTRL_STATE_MASK && event.keyCode == 53) { + } else if (event.stateMask == CTRL_STATE_MASK && event.keyCode == KEY_5) { System.out.println("ui page"); AnalyzerUtil.changePage(UIPage.ID); - } else if (event.stateMask == CTRL_STATE_MASK && event.keyCode == 54) { + } else if (event.stateMask == CTRL_STATE_MASK && event.keyCode == KEY_6) { + System.out.println("Graphics page"); + AnalyzerUtil.changePage(GLPage.ID); + } else if (event.stateMask == CTRL_STATE_MASK && event.keyCode == KEY_7) { System.out.println("summary page"); AnalyzerUtil.changePage(SummaryPage.ID); - } else if (event.stateMask == CTRL_STATE_MASK && event.keyCode == 55) { + } else if (event.stateMask == CTRL_STATE_MASK && event.keyCode == KEY_8) { System.out.println("range page"); AnalyzerUtil.changePage(RangePage.ID); } diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/sql/DBTableManager.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/sql/DBTableManager.java index afb1296..c1e452b 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/sql/DBTableManager.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/sql/DBTableManager.java @@ -30,6 +30,7 @@ import java.util.ArrayList; import java.util.List; import org.tizen.dynamicanalyzer.common.CommonConstants; +import org.tizen.dynamicanalyzer.ui.opengl.data.GLContextDBEnum; public class DBTableManager { @@ -51,6 +52,7 @@ public class DBTableManager { private static final String TABLE_NAME_PROCESS_INFO = "ProcessInfo";//$NON-NLS-1$ private static final String TABLE_NAME_LIB_OBJ = "LibraryObject";//$NON-NLS-1$ private static final String TABLE_NAME_APINAME = "ApiName";//$NON-NLS-1$ + private static final String TABLE_NAME_GLES20_CONTEXT_DATA = "Gles20ContextData";//$NON-NLS-1$ private static List tableInfos; @@ -64,6 +66,7 @@ public class DBTableManager { public static final int TABLE_INDEX_PROCESS_INFO = 7; public static final int TABLE_INDEX_LIB_OBJ = 8; public static final int TABLE_INDEX_APINAME = 9; + public static final int TABLE_INDEX_GLES20_CONTEXT_DATA = 10; public static final String EMPTY = CommonConstants.EMPTY; public static final String TEXT = "VARCHAR(256)";//$NON-NLS-1$ @@ -301,6 +304,30 @@ public class DBTableManager { options, types); tableInfos.set(TABLE_INDEX_APINAME, apiName); } + + // "gles20 context data" table info block + { + GLContextDBEnum[] glContextDBEnum = GLContextDBEnum.values(); + int length = glContextDBEnum.length; + + String[] names = new String[length + 1]; + String[] options = new String[length + 1]; + String[] types = new String[length + 1]; + for (int i = 0; i < length; i++) { + names[i] = glContextDBEnum[i].getcolumnName(); + options[i] = EMPTY; + types[i] = TEXT; + } + + names[length] = "Seq";//$NON-NLS-1$] + options[length] = NOT_NULL; + types[length] = TEXT; + + DBTableInfo Gles20ContextTableInfo = new DBTableInfo( + TABLE_NAME_GLES20_CONTEXT_DATA, names, options, types); + tableInfos.set(TABLE_INDEX_GLES20_CONTEXT_DATA, + Gles20ContextTableInfo); + } } public DBTableInfo getTableInfo(int tableInfoIndex) { diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/model/probe2/GLES20LogData.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/model/probe2/GLES20LogData.java new file mode 100644 index 0000000..2b22a98 --- /dev/null +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/model/probe2/GLES20LogData.java @@ -0,0 +1,74 @@ +package org.tizen.dynamicanalyzer.swap.model.probe2; + +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; + +import org.tizen.dynamicanalyzer.common.CommonConstants; +import org.tizen.dynamicanalyzer.swap.model.ByteUtils; + +public class GLES20LogData extends ProbeCommonData { + int apiType = 0; + long elapsedTime = 0; + String contextValue = ""; + + @Override + public void makeData(byte[] data) { + super.makeData(data); + + apiType = ByteUtils.toInt(data, index); + index += CommonConstants.INT_SIZE; + + elapsedTime = ByteUtils.toLong(data, index); + index += CommonConstants.LONG_SIZE; + + int length = LogDataUtils.getStringLength(index, data); + byte[] temp = new byte[length]; + System.arraycopy(data, index, temp, 0, length); + contextValue = new String(temp); + } + + public int getApiType() { + return apiType; + } + + public void setApiType(int apiType) { + this.apiType = apiType; + } + + public long getElapsedTime() { + return elapsedTime; + } + + public void setElapsedTime(long elapsedTime) { + this.elapsedTime = elapsedTime; + } + + public String getContextValue() { + return contextValue; + } + + public void setContextValue(String contextValue) { + this.contextValue = contextValue; + } + + @Override + public void makePreparedStatement(PreparedStatement prep) + throws SQLException { + super.makePreparedStatement(prep); + int index = ProbeCommonData.STATE_COUNT + 1; + + prep.setInt(index++, apiType); + prep.setLong(index++, elapsedTime); + prep.setString(index++, contextValue); + } + + @Override + public void loadData(ResultSet rs) throws SQLException { + super.loadData(rs); + int index = ProbeCommonData.STATE_COUNT + 1; + apiType = rs.getInt(index++); + elapsedTime = rs.getLong(index++); + contextValue = rs.getString(index++); + } +} diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/model/probe2/SystemData.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/model/probe2/SystemData.java index a845814..b92332b 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/model/probe2/SystemData.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/model/probe2/SystemData.java @@ -10,7 +10,6 @@ import java.sql.SQLException; import org.tizen.dynamicanalyzer.common.CommonConstants; import org.tizen.dynamicanalyzer.communicator.DACommunicator; -import org.tizen.dynamicanalyzer.swap.logparser.MessageParser; import org.tizen.dynamicanalyzer.swap.model.ByteUtils; public class SystemData extends LogData { diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/common/ContextEndMenuItemClickListener.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/common/ContextEndMenuItemClickListener.java index a131a42..d240558 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/common/ContextEndMenuItemClickListener.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/common/ContextEndMenuItemClickListener.java @@ -22,10 +22,10 @@ public class ContextEndMenuItemClickListener extends DAContextMenuListener { public void widgetSelected(DAContextMenuItem menuItem) { double endTime = endItem.getDoubleData(); rangeDataManager - .setMarkerEndTime((long) (endTime * TimelineConstants.MEGA)); + .setMarkerEndTime((long) (endTime * TimelineConstants.MEGA_DOUBLE)); double startTime = rangeDataManager.getMarkerStartTime() - / TimelineConstants.MEGA; + / TimelineConstants.MEGA_DOUBLE; chartBoard.setTimelineMarkerStartTime(startTime); diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/common/ContextFromSelectionMenuItemClickListener.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/common/ContextFromSelectionMenuItemClickListener.java index 2b6ff83..0d048d1 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/common/ContextFromSelectionMenuItemClickListener.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/common/ContextFromSelectionMenuItemClickListener.java @@ -32,9 +32,9 @@ public class ContextFromSelectionMenuItemClickListener extends endTime = temp; } rangeDataManager - .setMarkerStartTime((long) (startTime * TimelineConstants.MEGA)); + .setMarkerStartTime((long) (startTime * TimelineConstants.MEGA_DOUBLE)); rangeDataManager - .setMarkerEndTime((long) (endTime * TimelineConstants.MEGA)); + .setMarkerEndTime((long) (endTime * TimelineConstants.MEGA_DOUBLE)); chartBoard.setTimelineMarkerStartTime(startTime); chartBoard.setTimelineMarkerEndTime(endTime); ((DAChartPlotIntervalMarker) chartBoard.getMarkers().get( diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/common/ContextStartMenuItemClickListener.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/common/ContextStartMenuItemClickListener.java index 986ff05..c6b79bb 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/common/ContextStartMenuItemClickListener.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/common/ContextStartMenuItemClickListener.java @@ -21,10 +21,10 @@ public class ContextStartMenuItemClickListener extends DAContextMenuListener { public void widgetSelected(DAContextMenuItem menuItem) { double startTime = startItem.getDoubleData(); rangeDataManager - .setMarkerStartTime((long) (startTime * TimelineConstants.MEGA)); + .setMarkerStartTime((long) (startTime * TimelineConstants.MEGA_DOUBLE)); double endTime = rangeDataManager.getMarkerEndTime() - / TimelineConstants.MEGA; + / TimelineConstants.MEGA_DOUBLE; chartBoard.setTimelineMarkerStartTime(startTime); chartBoard.setTimelineMarkerEndTime(endTime); diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/common/PopupEndMenuItemClickListener.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/common/PopupEndMenuItemClickListener.java index 62992af..0eb7527 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/common/PopupEndMenuItemClickListener.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/common/PopupEndMenuItemClickListener.java @@ -45,13 +45,12 @@ public class PopupEndMenuItemClickListener extends DAPopupMenuListener { @Override public void widgetSelected(DAPopupMenuItem menuItem) { - // TODO Auto-generated method stub double endTime = endItem.getDoubleData(); rangeDataManager - .setMarkerEndTime((long) (endTime * TimelineConstants.MEGA)); + .setMarkerEndTime((long) (endTime * TimelineConstants.MEGA_DOUBLE)); double startTime = rangeDataManager.getMarkerStartTime() - / TimelineConstants.MEGA; + / TimelineConstants.MEGA_DOUBLE; chartBoard.setTimelineMarkerStartTime(startTime); diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/common/PopupFromSelectionMenuItemClickListener.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/common/PopupFromSelectionMenuItemClickListener.java index 99f9420..4746727 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/common/PopupFromSelectionMenuItemClickListener.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/common/PopupFromSelectionMenuItemClickListener.java @@ -58,9 +58,9 @@ public class PopupFromSelectionMenuItemClickListener extends endTime = temp; } rangeDataManager - .setMarkerStartTime((long) (startTime * TimelineConstants.MEGA)); + .setMarkerStartTime((long) (startTime * TimelineConstants.MEGA_DOUBLE)); rangeDataManager - .setMarkerEndTime((long) (endTime * TimelineConstants.MEGA)); + .setMarkerEndTime((long) (endTime * TimelineConstants.MEGA_DOUBLE)); chartBoard.setTimelineMarkerStartTime(startTime); chartBoard.setTimelineMarkerEndTime(endTime); ((DAChartPlotIntervalMarker) chartBoard.getMarkers().get( diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/common/PopupStartMenuItemClickListener.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/common/PopupStartMenuItemClickListener.java index c816185..fe07970 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/common/PopupStartMenuItemClickListener.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/common/PopupStartMenuItemClickListener.java @@ -48,10 +48,10 @@ public class PopupStartMenuItemClickListener extends DAPopupMenuListener { // TODO Auto-generated method stub double startTime = startItem.getDoubleData(); rangeDataManager - .setMarkerStartTime((long) (startTime * TimelineConstants.MEGA)); + .setMarkerStartTime((long) (startTime * TimelineConstants.MEGA_DOUBLE)); double endTime = rangeDataManager.getMarkerEndTime() - / TimelineConstants.MEGA; + / TimelineConstants.MEGA_DOUBLE; chartBoard.setTimelineMarkerStartTime(startTime); chartBoard.setTimelineMarkerEndTime(endTime); diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/common/SetRangeMarkerMouseMoveListener.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/common/SetRangeMarkerMouseMoveListener.java index 39aa703..0dc3e6b 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/common/SetRangeMarkerMouseMoveListener.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/common/SetRangeMarkerMouseMoveListener.java @@ -29,33 +29,33 @@ public class SetRangeMarkerMouseMoveListener implements MouseMoveListener { if (startMarker.isPushed()) { double startTime = startMarker.getTime(); rangeDataManager - .setMarkerStartTime((long) (startTime * TimelineConstants.MEGA)); + .setMarkerStartTime((long) (startTime * TimelineConstants.MEGA_DOUBLE)); double endTime = rangeDataManager.getMarkerEndTime() - / TimelineConstants.MEGA; + / TimelineConstants.MEGA_DOUBLE; chartBoard.setTimelineMarkerStartTime(startTime); chartBoard.setTimelineMarkerEndTime(endTime); ((DAChartPlotIntervalMarker) chartBoard.getMarkers().get( UICommonConstants.RANGE_MARKER_INDEX)).setInterval( - rangeDataManager.getMarkerStartTime() / TimelineConstants.MEGA, - rangeDataManager.getMarkerEndTime() / TimelineConstants.MEGA); + rangeDataManager.getMarkerStartTime() / TimelineConstants.MEGA_DOUBLE, + rangeDataManager.getMarkerEndTime() / TimelineConstants.MEGA_DOUBLE); } else if (endMarker.isPushed()) { double endTime = endMarker.getTime(); rangeDataManager - .setMarkerEndTime((long) (endTime * TimelineConstants.MEGA)); + .setMarkerEndTime((long) (endTime * TimelineConstants.MEGA_DOUBLE)); double startTime = rangeDataManager.getMarkerStartTime() - / TimelineConstants.MEGA; + / TimelineConstants.MEGA_DOUBLE; chartBoard.setTimelineMarkerStartTime(startTime); chartBoard.setTimelineMarkerEndTime(endTime); ((DAChartPlotIntervalMarker) chartBoard.getMarkers().get( UICommonConstants.RANGE_MARKER_INDEX)).setInterval( - rangeDataManager.getMarkerStartTime() / TimelineConstants.MEGA, - rangeDataManager.getMarkerEndTime() / TimelineConstants.MEGA); + rangeDataManager.getMarkerStartTime() / TimelineConstants.MEGA_DOUBLE, + rangeDataManager.getMarkerEndTime() / TimelineConstants.MEGA_DOUBLE); } } } diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/common/TimelineChartMouseEventListener.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/common/TimelineChartMouseEventListener.java index 4008dc2..1bae0a2 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/common/TimelineChartMouseEventListener.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/common/TimelineChartMouseEventListener.java @@ -12,11 +12,9 @@ import org.tizen.dynamicanalyzer.common.AnalyzerManager; import org.tizen.dynamicanalyzer.common.DASelectionData; import org.tizen.dynamicanalyzer.ui.range.RangeDataManager; import org.tizen.dynamicanalyzer.ui.timeline.chart.ScreenshotChart; -import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineChartManager; import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants; import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineView; import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea; -import org.tizen.dynamicanalyzer.ui.widgets.DAContextMenu; import org.tizen.dynamicanalyzer.widgets.chart.DAChart; import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlot; import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlotIntervalMarker; @@ -27,20 +25,20 @@ import org.tizen.dynamicanalyzer.widgets.chart.DAChartSeriesItem; import org.tizen.dynamicanalyzer.widgets.chart.DAScreenshotChartPlot; import org.tizen.dynamicanalyzer.widgets.chart.DAUIEventChartPlot; import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoard; -import org.tizen.dynamicanalyzer.widgets.contextMenu.DAContextMenuItem; +import org.tizen.dynamicanalyzer.widgets.popupMenu.DAPopupMenu; +import org.tizen.dynamicanalyzer.widgets.popupMenu.DAPopupMenuItem; import org.tizen.dynamicanalyzer.widgets.timeline.DATimeline; public class TimelineChartMouseEventListener extends MouseAdapter implements MouseMoveListener { private RangeDataManager rangeDataManager = RangeDataManager.getInstance(); - private DAContextMenu menu; + private DAPopupMenu menu; private DATimeline timeline; private double baseTime = TimelineConstants.NOT_INITED; private static final int SELECTION_MARKER_INDEX = 0; // FIXME - public TimelineChartMouseEventListener(DAContextMenu menu, - DATimeline timeline) { + public TimelineChartMouseEventListener(DAPopupMenu menu, DATimeline timeline) { this.menu = menu; this.timeline = timeline; } @@ -59,38 +57,38 @@ public class TimelineChartMouseEventListener extends MouseAdapter implements double eventTime = plot.getXFromXPixcel(e.x); if (e.button == 3) { - List itemList = menu.getItems(); - DAContextMenuItem startItem = itemList.get(0); - DAContextMenuItem endItem = itemList.get(1); - DAContextMenuItem fromSelectionItem = itemList.get(2); - DAContextMenuItem analysisItem = itemList.get(3); - DAContextMenuItem clearItem = itemList.get(4); - - if(ToolbarArea.getInstance() == null) { + List itemList = menu.getItems(); + DAPopupMenuItem startItem = itemList.get(0); + DAPopupMenuItem endItem = itemList.get(1); + DAPopupMenuItem fromSelectionItem = itemList.get(2); + DAPopupMenuItem analysisItem = itemList.get(3); + DAPopupMenuItem clearItem = itemList.get(4); + + if (ToolbarArea.getInstance() == null) { System.out.println("toolbar area is null");//$NON-NLS-1$ return; } - - if (eventTime * TimelineConstants.MEGA <= ToolbarArea.getInstance() + + if (eventTime * TimelineConstants.MEGA_DOUBLE <= ToolbarArea.getInstance() .getTime()) { - startItem.setButtonEnabled(true); - endItem.setButtonEnabled(true); - analysisItem.setButtonEnabled(rangeDataManager.isAnalyzable()); - clearItem.setButtonEnabled(rangeDataManager.isBeingAnalyzed()); + startItem.setEnabled(true); + endItem.setEnabled(true); + analysisItem.setEnabled(rangeDataManager.isAnalyzable()); + clearItem.setEnabled(rangeDataManager.isBeingAnalyzed()); startItem.setDoubleData(eventTime); endItem.setDoubleData(eventTime); } else { - startItem.setButtonEnabled(false); - endItem.setButtonEnabled(false); - analysisItem.setButtonEnabled(rangeDataManager.isAnalyzable()); - clearItem.setButtonEnabled(rangeDataManager.isBeingAnalyzed()); + startItem.setEnabled(false); + endItem.setEnabled(false); + analysisItem.setEnabled(rangeDataManager.isAnalyzable()); + clearItem.setEnabled(rangeDataManager.isBeingAnalyzed()); } if (intervalMarker.getStartVal() != intervalMarker.getEndVal()) { - fromSelectionItem.setButtonEnabled(true); + fromSelectionItem.setEnabled(true); } else { - fromSelectionItem.setButtonEnabled(false); + fromSelectionItem.setEnabled(false); } if (plot instanceof DAUIEventChartPlot) { @@ -106,8 +104,7 @@ public class TimelineChartMouseEventListener extends MouseAdapter implements startIndexList.add(startIndex); endIndexList.add(endIndex + 1); } - - DAContextMenuItem eventListItem = menu.getItems().get( + DAPopupMenuItem eventListItem = menu.getItems().get( menu.getItems().size() - 1); ((UIEventChartContextMenuItem) eventListItem) .setChartSeriesList(chart.getSeriesList()); @@ -128,27 +125,45 @@ public class TimelineChartMouseEventListener extends MouseAdapter implements if (plot instanceof DAScreenshotChartPlot) { DAChartSeries series = chart.getSeries(0); - int index = series.getPrevIndexByXvalue(eventTime); - if (index >= 0 && index < series.getSeriesItemList().size()) { - DAChartSeriesItem item = series.getSeriesItemList().get(index); - double itemTime = item.getX(); - int imageWidth = item.getImage().getBounds().width; - double imageRightTime = itemTime - + plot.getXFromXPixcel(imageWidth) - - plot.getVisibleStartX(); - - if (eventTime > itemTime && eventTime < imageRightTime) { - if (bShift == true && intervalMarker.getStartVal() != -1) { - if (baseTime > eventTime) { - intervalMarker.setStartVal(eventTime); - intervalMarker.setEndVal(baseTime); + if(series != null) { + int index = series.getPrevIndexByXvalue(eventTime); + if (index >= 0 && index < series.getSeriesItemList().size()) { + DAChartSeriesItem item = series.getSeriesItemList().get( + index); + double itemTime = item.getX(); + int imageWidth = item.getImage().getBounds().width; + double imageRightTime = itemTime + + plot.getXFromXPixcel(imageWidth) + - plot.getVisibleStartX(); + + if (eventTime > itemTime && eventTime < imageRightTime) { + if (bShift == true + && intervalMarker.getStartVal() != -1) { + if (baseTime > eventTime) { + intervalMarker.setStartVal(eventTime); + intervalMarker.setEndVal(baseTime); + } else { + intervalMarker.setStartVal(baseTime); + intervalMarker.setEndVal(eventTime); + } } else { - intervalMarker.setStartVal(baseTime); - intervalMarker.setEndVal(eventTime); + intervalMarker.setInterval(itemTime, eventTime); + baseTime = itemTime; } } else { - intervalMarker.setInterval(itemTime, eventTime); - baseTime = itemTime; + if (bShift == true + && intervalMarker.getStartVal() != -1) { + if (baseTime > eventTime) { + intervalMarker.setStartVal(eventTime); + intervalMarker.setEndVal(baseTime); + } else { + intervalMarker.setStartVal(baseTime); + intervalMarker.setEndVal(eventTime); + } + } else { + intervalMarker.setInterval(eventTime, eventTime); + baseTime = eventTime; + } } } else { if (bShift == true && intervalMarker.getStartVal() != -1) { @@ -164,19 +179,6 @@ public class TimelineChartMouseEventListener extends MouseAdapter implements baseTime = eventTime; } } - } else { - if (bShift == true && intervalMarker.getStartVal() != -1) { - if (baseTime > eventTime) { - intervalMarker.setStartVal(eventTime); - intervalMarker.setEndVal(baseTime); - } else { - intervalMarker.setStartVal(baseTime); - intervalMarker.setEndVal(eventTime); - } - } else { - intervalMarker.setInterval(eventTime, eventTime); - baseTime = eventTime; - } } DAChart chartWidget = ScreenshotChart.getInstance().getChart(); DAScreenshotChartPlot screenshotChartPlot = (DAScreenshotChartPlot) chartWidget @@ -228,8 +230,8 @@ public class TimelineChartMouseEventListener extends MouseAdapter implements markerEndTime = eventTime; } - double toolbarTime = TimelineChartManager.getInstance().getChartBoard() - .getLifecycleEndTime(); + double toolbarTime = ToolbarArea.getInstance().getTime() + / TimelineConstants.MEGA_DOUBLE; if (markerStartTime < 0) { markerStartTime = 0; @@ -246,16 +248,28 @@ public class TimelineChartMouseEventListener extends MouseAdapter implements if (plot instanceof DAScreenshotChartPlot) { DAChartSeries series = chart.getSeries(0); int index = series.getPrevIndexByXvalue(plot.getXFromXPixcel(e.x)); - if (index >= 0 && index < series.getSeriesItemList().size()) { - DAChartSeriesItem item = series.getSeriesItemList().get(index); - double itemTime = item.getX(); - int imageWidth = item.getImage().getBounds().width; - double imageRightTime = itemTime - + plot.getXFromXPixcel(imageWidth) - - plot.getVisibleStartX(); - - if (markerEndTime > itemTime && markerEndTime < imageRightTime) { - intervalMarker.setInterval(markerStartTime, itemTime); + if (series != null) { + if (index >= 0 && index < series.getSeriesItemList().size()) { + DAChartSeriesItem item = series.getSeriesItemList().get( + index); + double itemTime = item.getX(); + int imageWidth = item.getImage().getBounds().width; + double imageRightTime = itemTime + + plot.getXFromXPixcel(imageWidth) + - plot.getVisibleStartX(); + + if (markerEndTime > itemTime + && markerEndTime < imageRightTime) { + intervalMarker.setInterval(markerStartTime, itemTime); + } else { + if (markerEndTime <= plot.getVisibleEndX()) { + intervalMarker.setInterval(markerStartTime, + markerEndTime); + } else { + intervalMarker.setInterval(markerStartTime, + plot.getVisibleEndX()); + } + } } else { if (markerEndTime <= plot.getVisibleEndX()) { intervalMarker.setInterval(markerStartTime, @@ -265,13 +279,6 @@ public class TimelineChartMouseEventListener extends MouseAdapter implements plot.getVisibleEndX()); } } - } else { - if (markerEndTime <= plot.getVisibleEndX()) { - intervalMarker.setInterval(markerStartTime, markerEndTime); - } else { - intervalMarker.setInterval(markerStartTime, - plot.getVisibleEndX()); - } } } else { if (markerEndTime <= plot.getVisibleEndX()) { @@ -359,8 +366,8 @@ public class TimelineChartMouseEventListener extends MouseAdapter implements } private void sendSelectionTimes(double start, double end) { - long startTime = (long) (start * TimelineConstants.MEGA); - long endTime = (long) (end * TimelineConstants.MEGA); + long startTime = (long) (start * TimelineConstants.MEGA_DOUBLE); + long endTime = (long) (end * TimelineConstants.MEGA_DOUBLE); if (endTime < startTime) { long temp = startTime; startTime = endTime; @@ -391,9 +398,6 @@ public class TimelineChartMouseEventListener extends MouseAdapter implements for (int i = 0; i < seriesList.size(); i++) { if (plot instanceof DAUIEventChartPlot) { i = (int) (seriesList.size() * yPosRatio); - if (i < 0 || i > 4) { - System.out.println(yPosRatio + " " + i);//$NON-NLS-1$ - } } DAChartSeries series = seriesList.get(i); int index = series.getPrevIndexByXvalue(plot.getXFromXPixcel(x)); diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/common/UIEventChartContextMenuItem.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/common/UIEventChartContextMenuItem.java index dda8487..a3efaa0 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/common/UIEventChartContextMenuItem.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/common/UIEventChartContextMenuItem.java @@ -3,16 +3,16 @@ package org.tizen.dynamicanalyzer.ui.common; import java.util.List; import org.tizen.dynamicanalyzer.widgets.chart.DAChartSeries; -import org.tizen.dynamicanalyzer.widgets.contextMenu.ContextMenu; -import org.tizen.dynamicanalyzer.widgets.contextMenu.DAContextMenuItem; +import org.tizen.dynamicanalyzer.widgets.popupMenu.DAPopupMenu; +import org.tizen.dynamicanalyzer.widgets.popupMenu.DAPopupMenuItem; -public class UIEventChartContextMenuItem extends DAContextMenuItem { +public class UIEventChartContextMenuItem extends DAPopupMenuItem { private List chartSeriesList; private List startIndexList; private List endIndexList; - public UIEventChartContextMenuItem(ContextMenu menu) { - super(menu); + public UIEventChartContextMenuItem(DAPopupMenu menu) { + super(menu, DAPopupMenuItem.NONE); } public List getChartSeriesList() { diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/file/FileApiListTable.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/file/FileApiListTable.java index dae50fa..1062e15 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/file/FileApiListTable.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/file/FileApiListTable.java @@ -177,15 +177,15 @@ public class FileApiListTable extends DAApiListTableComposite { if (type == START_TIME) { rangeDataManager.setMarkerStartTime(time); - startTime = time / TimelineConstants.MEGA; + startTime = time / TimelineConstants.MEGA_DOUBLE; endTime = rangeDataManager.getMarkerEndTime() - / TimelineConstants.MEGA; + / TimelineConstants.MEGA_DOUBLE; } else if (type == END_TIME) { rangeDataManager.setMarkerEndTime(time); - endTime = time / TimelineConstants.MEGA; + endTime = time / TimelineConstants.MEGA_DOUBLE; startTime = rangeDataManager.getMarkerStartTime() - / TimelineConstants.MEGA; + / TimelineConstants.MEGA_DOUBLE; } board.setTimelineMarkerStartTime(startTime); diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/file/FileChartData.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/file/FileChartData.java index de90bbc..9d26df7 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/file/FileChartData.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/file/FileChartData.java @@ -494,7 +494,7 @@ public class FileChartData { } public double getFileOpendTime() { - return this.fileOpendTime / TimelineConstants.MEGA; + return this.fileOpendTime / TimelineConstants.MEGA_DOUBLE; } public void setFileClosedTime(double data) { @@ -502,7 +502,7 @@ public class FileChartData { } public double getFileClosedTime() { - return this.fileClosedTime / TimelineConstants.MEGA; + return this.fileClosedTime / TimelineConstants.MEGA_DOUBLE; } public void setFileLastUsedTime(double data) { @@ -510,7 +510,7 @@ public class FileChartData { } public double getFileLastUsedTime() { - return this.fileLastUsedTime / TimelineConstants.MEGA; + return this.fileLastUsedTime / TimelineConstants.MEGA_DOUBLE; } public void setFileUsedTime(double data) { @@ -532,9 +532,9 @@ public class FileChartData { for (int i = 0; i < children.size(); i++) { fileData = children.get(i); firstUsedTime = fileData.getFileOpendTime() - * TimelineConstants.MEGA; + * TimelineConstants.MEGA_DOUBLE; lastUsedTime = fileData.getFileLastUsedTime() - * TimelineConstants.MEGA; + * TimelineConstants.MEGA_DOUBLE; if (lastUsedTime == 0) { continue; } else if (!fileData.isFileOpenFailed() && firstInputData == false) { diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/file/FileChartDataEvent.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/file/FileChartDataEvent.java index f8d9add..7b2a85c 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/file/FileChartDataEvent.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/file/FileChartDataEvent.java @@ -105,7 +105,7 @@ public class FileChartDataEvent { } public double getApiChartTime() { - return getLogTime() / TimelineConstants.MEGA; + return getLogTime() / TimelineConstants.MEGA_DOUBLE; } public void setFilePath(String data) { diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/file/FileChartView.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/file/FileChartView.java index d168e30..9e8e721 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/file/FileChartView.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/file/FileChartView.java @@ -99,11 +99,11 @@ public class FileChartView extends DAView { (long) (((DAChartPlotIntervalMarker) fileChart .getMarkers() .get(UICommonConstants.SELECTION_MARKER_INDEX)) - .getStartVal() * TimelineConstants.MEGA), + .getStartVal() * TimelineConstants.MEGA_DOUBLE), (long) (((DAChartPlotIntervalMarker) fileChart .getMarkers() .get(UICommonConstants.SELECTION_MARKER_INDEX)) - .getEndVal() * TimelineConstants.MEGA), + .getEndVal() * TimelineConstants.MEGA_DOUBLE), item.getData(), null)); } }); @@ -143,17 +143,17 @@ public class FileChartView extends DAView { fileChart.setTotalEndTime(ToolbarArea.getInstance().getTime()); fileChart.setTimelineMarkerStartTime(rangeDataManager - .getMarkerStartTime() / TimelineConstants.MEGA); + .getMarkerStartTime() / TimelineConstants.MEGA_DOUBLE); fileChart.setTimelineMarkerEndTime(rangeDataManager.getMarkerEndTime() - / TimelineConstants.MEGA); + / TimelineConstants.MEGA_DOUBLE); if (RangeDataManager.getInstance().isBeingAnalyzed()) { ((DAChartPlotIntervalMarker) fileChart.getMarkers().get( UICommonConstants.RANGE_ANALYSIS_MARKER_INDEX)) .setInterval(rangeDataManager.getAnalysisStartTime() - / TimelineConstants.MEGA, + / TimelineConstants.MEGA_DOUBLE, rangeDataManager.getAnalysisEndTime() - / TimelineConstants.MEGA); + / TimelineConstants.MEGA_DOUBLE); } else { ((DAChartPlotIntervalMarker) fileChart.getMarkers().get( UICommonConstants.RANGE_ANALYSIS_MARKER_INDEX)) @@ -162,8 +162,8 @@ public class FileChartView extends DAView { ((DAChartPlotIntervalMarker) fileChart.getMarkers().get( UICommonConstants.RANGE_MARKER_INDEX)).setInterval( - rangeDataManager.getMarkerStartTime() / TimelineConstants.MEGA, - rangeDataManager.getMarkerEndTime() / TimelineConstants.MEGA); + rangeDataManager.getMarkerStartTime() / TimelineConstants.MEGA_DOUBLE, + rangeDataManager.getMarkerEndTime() / TimelineConstants.MEGA_DOUBLE); } @@ -172,8 +172,8 @@ public class FileChartView extends DAView { long start = selData.getStartTime(); long end = selData.getEndTime(); - double startTime = (double) start / TimelineConstants.MEGA; - double endTime = (double) end / TimelineConstants.MEGA; + double startTime = (double) start / TimelineConstants.MEGA_DOUBLE; + double endTime = (double) end / TimelineConstants.MEGA_DOUBLE; double middleTime = (startTime + endTime) / 2.0; if (start == end) { middleTime = startTime; diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/file/FileDataMaker.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/file/FileDataMaker.java index 022609c..1c835e1 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/file/FileDataMaker.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/file/FileDataMaker.java @@ -44,11 +44,11 @@ import org.tizen.dynamicanalyzer.resources.ImageResources; import org.tizen.dynamicanalyzer.swap.model.probe2.FailedData2; import org.tizen.dynamicanalyzer.swap.model.probe2.FileData; import org.tizen.dynamicanalyzer.swap.model.probe2.LogData; -import org.tizen.dynamicanalyzer.ui.common.ContextAnalysisMenuItemClickListener; -import org.tizen.dynamicanalyzer.ui.common.ContextClearMenuItemClickListener; -import org.tizen.dynamicanalyzer.ui.common.ContextEndMenuItemClickListener; -import org.tizen.dynamicanalyzer.ui.common.ContextFromSelectionMenuItemClickListener; -import org.tizen.dynamicanalyzer.ui.common.ContextStartMenuItemClickListener; +import org.tizen.dynamicanalyzer.ui.common.PopupAnalysisMenuItemClickListener; +import org.tizen.dynamicanalyzer.ui.common.PopupClearMenuItemClickListener; +import org.tizen.dynamicanalyzer.ui.common.PopupEndMenuItemClickListener; +import org.tizen.dynamicanalyzer.ui.common.PopupFromSelectionMenuItemClickListener; +import org.tizen.dynamicanalyzer.ui.common.PopupStartMenuItemClickListener; import org.tizen.dynamicanalyzer.ui.common.TimelineChartMouseEventListener; import org.tizen.dynamicanalyzer.ui.common.TimelineChartMouseTrackAdapter; import org.tizen.dynamicanalyzer.ui.summary.failed.FailedChecker; @@ -57,15 +57,16 @@ import org.tizen.dynamicanalyzer.ui.summary.warning.WarningCase; import org.tizen.dynamicanalyzer.ui.summary.warning.WarningChecker; import org.tizen.dynamicanalyzer.ui.summary.warning.WarningData; import org.tizen.dynamicanalyzer.ui.timeline.chart.FileChart; -import org.tizen.dynamicanalyzer.ui.widgets.DAContextMenu; import org.tizen.dynamicanalyzer.utils.AnalyzerUtil; import org.tizen.dynamicanalyzer.widgets.chart.DAChart; import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlot; +import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlot.AutoRangeType; import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlotTooltip; import org.tizen.dynamicanalyzer.widgets.chart.DAChartSeries; import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoard; import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoardItem; -import org.tizen.dynamicanalyzer.widgets.contextMenu.DAContextMenuItem; +import org.tizen.dynamicanalyzer.widgets.popupMenu.DAPopupMenu; +import org.tizen.dynamicanalyzer.widgets.popupMenu.DAPopupMenuItem; public class FileDataMaker { private DAChartBoard board; @@ -290,7 +291,7 @@ public class FileDataMaker { } else { plot.setBackgroundImage(ImageResources.BG_CHILD_GRADIENT); } - plot.setAutoHeightRange(false); + plot.setAutoHeightRange(AutoRangeType.MANUAL); plot.setAxisFont(FontResources.CHART_AXIS_FONT); plot.setAxisRangeY(0, 101); plot.setAxisRangeX(board.getVisibleStartTime(), @@ -299,34 +300,36 @@ public class FileDataMaker { tooltip.setFont(FontResources.CHART_TOOLTIP_FONT); plot.setTooltip(tooltip); - DAContextMenu popupMenu = new DAContextMenu(chart); + DAPopupMenu popupMenu = new DAPopupMenu(chart); popupMenu.setFont(FontResources.CONTEXT_MENU_ITEM_FONT); - DAContextMenuItem startItem = new DAContextMenuItem(popupMenu); + DAPopupMenuItem startItem = new DAPopupMenuItem(popupMenu, + DAPopupMenuItem.NONE); startItem.setText(TimelineChartLabels.RANGE_CONTEXT_SET_START); - startItem.addClickListener(new ContextStartMenuItemClickListener( - startItem, board)); + startItem.addListener(new PopupStartMenuItemClickListener(startItem, + board)); - DAContextMenuItem endItem = new DAContextMenuItem(popupMenu); + DAPopupMenuItem endItem = new DAPopupMenuItem(popupMenu, + DAPopupMenuItem.NONE); endItem.setText(TimelineChartLabels.RANGE_CONTEXT_SET_END); - endItem.addClickListener(new ContextEndMenuItemClickListener(endItem, - board)); + endItem.addListener(new PopupEndMenuItemClickListener(endItem, board)); - DAContextMenuItem fromSelectionItem = new DAContextMenuItem(popupMenu); + DAPopupMenuItem fromSelectionItem = new DAPopupMenuItem(popupMenu, + DAPopupMenuItem.NONE); fromSelectionItem .setText(TimelineChartLabels.RANGE_CONTEXT_SET_FROM_SELECTION); fromSelectionItem - .addClickListener(new ContextFromSelectionMenuItemClickListener( + .addListener(new PopupFromSelectionMenuItemClickListener( fromSelectionItem, board)); - - DAContextMenuItem analysisItem = new DAContextMenuItem(popupMenu); + + DAPopupMenuItem analysisItem = new DAPopupMenuItem(popupMenu, + DAPopupMenuItem.NONE); analysisItem.setText(TimelineChartLabels.RANGE_CONTEXT_ANALYSIS); - analysisItem - .addClickListener(new ContextAnalysisMenuItemClickListener()); + analysisItem.addListener(new PopupAnalysisMenuItemClickListener()); - DAContextMenuItem clearItem = new DAContextMenuItem(popupMenu); + DAPopupMenuItem clearItem = new DAPopupMenuItem(popupMenu, + DAPopupMenuItem.NONE); clearItem.setText(TimelineChartLabels.RANGE_CONTEXT_CLEAR); - clearItem - .addClickListener(new ContextClearMenuItemClickListener(board)); + clearItem.addListener(new PopupClearMenuItemClickListener()); TimelineChartMouseEventListener timelineChartMouseEventListener = new TimelineChartMouseEventListener( popupMenu, board.getTimeline()); diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/network/NetworkApiListTable.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/network/NetworkApiListTable.java index 484e38d..3730b88 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/network/NetworkApiListTable.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/network/NetworkApiListTable.java @@ -274,15 +274,15 @@ public class NetworkApiListTable extends DAApiListTableComposite { if (type == START_TIME) { rangeDataManager.setMarkerStartTime(time); - startTime = time / TimelineConstants.MEGA; + startTime = time / TimelineConstants.MEGA_DOUBLE; endTime = rangeDataManager.getMarkerEndTime() - / TimelineConstants.MEGA; + / TimelineConstants.MEGA_DOUBLE; } else if (type == END_TIME) { rangeDataManager.setMarkerEndTime(time); - endTime = time / TimelineConstants.MEGA; + endTime = time / TimelineConstants.MEGA_DOUBLE; startTime = rangeDataManager.getMarkerStartTime() - / TimelineConstants.MEGA; + / TimelineConstants.MEGA_DOUBLE; } board.setTimelineMarkerStartTime(startTime); diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/network/NetworkChartData.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/network/NetworkChartData.java index 8046d19..e5adbec 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/network/NetworkChartData.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/network/NetworkChartData.java @@ -886,7 +886,7 @@ public class NetworkChartData { } public double getSocketOpendTime() { - return this.socketOpendTime / TimelineConstants.MEGA; + return this.socketOpendTime / TimelineConstants.MEGA_DOUBLE; } public void setSocketClosedTime(double data) { @@ -894,7 +894,7 @@ public class NetworkChartData { } public double getSocketClosedTime() { - return this.socketClosedTime / TimelineConstants.MEGA; + return this.socketClosedTime / TimelineConstants.MEGA_DOUBLE; } public void setSocketLastUsedTime(double data) { @@ -902,7 +902,7 @@ public class NetworkChartData { } public double getSocketLastUsedTime() { - return this.socketLastUsedTime / TimelineConstants.MEGA; + return this.socketLastUsedTime / TimelineConstants.MEGA_DOUBLE; } public void setSocketUsedTime(double data) { @@ -924,9 +924,9 @@ public class NetworkChartData { for (int i = 0; i < children.size(); i++) { networkData = children.get(i); firstUsedTime = networkData.getSocketOpendTime() - * TimelineConstants.MEGA; + * TimelineConstants.MEGA_DOUBLE; lastUsedTime = networkData.getSocketLastUsedTime() - * TimelineConstants.MEGA; + * TimelineConstants.MEGA_DOUBLE; if (lastUsedTime == 0) { continue; } else if (!networkData.isFDOpenFailed() && firstInputData == false) { diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/network/NetworkChartDataEvent.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/network/NetworkChartDataEvent.java index 0b4d192..9380589 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/network/NetworkChartDataEvent.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/network/NetworkChartDataEvent.java @@ -119,7 +119,7 @@ public class NetworkChartDataEvent { } public double getApiChartTime() { - return getLogTime() / TimelineConstants.MEGA; + return getLogTime() / TimelineConstants.MEGA_DOUBLE; } public void setAddress(String data) { diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/network/NetworkChartView.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/network/NetworkChartView.java index 365ac44..a53a12d 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/network/NetworkChartView.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/network/NetworkChartView.java @@ -102,11 +102,11 @@ public class NetworkChartView extends DAView { (long) (((DAChartPlotIntervalMarker) networkChart .getMarkers() .get(UICommonConstants.SELECTION_MARKER_INDEX)) - .getStartVal() * TimelineConstants.MEGA), + .getStartVal() * TimelineConstants.MEGA_DOUBLE), (long) (((DAChartPlotIntervalMarker) networkChart .getMarkers() .get(UICommonConstants.SELECTION_MARKER_INDEX)) - .getEndVal() * TimelineConstants.MEGA), + .getEndVal() * TimelineConstants.MEGA_DOUBLE), item.getData(), null)); } }); @@ -149,17 +149,17 @@ public class NetworkChartView extends DAView { networkChart.setTotalEndTime(ToolbarArea.getInstance().getTime()); networkChart.setTimelineMarkerStartTime(rangeDataManager - .getMarkerStartTime() / TimelineConstants.MEGA); + .getMarkerStartTime() / TimelineConstants.MEGA_DOUBLE); networkChart.setTimelineMarkerEndTime(rangeDataManager.getMarkerEndTime() - / TimelineConstants.MEGA); + / TimelineConstants.MEGA_DOUBLE); if (RangeDataManager.getInstance().isBeingAnalyzed()) { ((DAChartPlotIntervalMarker) networkChart.getMarkers().get( UICommonConstants.RANGE_ANALYSIS_MARKER_INDEX)) .setInterval(rangeDataManager.getAnalysisStartTime() - / TimelineConstants.MEGA, + / TimelineConstants.MEGA_DOUBLE, rangeDataManager.getAnalysisEndTime() - / TimelineConstants.MEGA); + / TimelineConstants.MEGA_DOUBLE); } else { ((DAChartPlotIntervalMarker) networkChart.getMarkers().get( UICommonConstants.RANGE_ANALYSIS_MARKER_INDEX)) @@ -168,8 +168,8 @@ public class NetworkChartView extends DAView { ((DAChartPlotIntervalMarker) networkChart.getMarkers().get( UICommonConstants.RANGE_MARKER_INDEX)).setInterval( - rangeDataManager.getMarkerStartTime() / TimelineConstants.MEGA, - rangeDataManager.getMarkerEndTime() / TimelineConstants.MEGA); + rangeDataManager.getMarkerStartTime() / TimelineConstants.MEGA_DOUBLE, + rangeDataManager.getMarkerEndTime() / TimelineConstants.MEGA_DOUBLE); } @@ -178,8 +178,8 @@ public class NetworkChartView extends DAView { long start = selData.getStartTime(); long end = selData.getEndTime(); - double startTime = (double) start / TimelineConstants.MEGA; - double endTime = (double) end / TimelineConstants.MEGA; + double startTime = (double) start / TimelineConstants.MEGA_DOUBLE; + double endTime = (double) end / TimelineConstants.MEGA_DOUBLE; double middleTime = (startTime + endTime) / 2.0; if (start == end) { middleTime = startTime; diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/network/NetworkDataMaker.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/network/NetworkDataMaker.java index 6db46f4..2798020 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/network/NetworkDataMaker.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/network/NetworkDataMaker.java @@ -43,11 +43,11 @@ import org.tizen.dynamicanalyzer.resources.ImageResources; import org.tizen.dynamicanalyzer.swap.model.probe2.FailedData2; import org.tizen.dynamicanalyzer.swap.model.probe2.LogData; import org.tizen.dynamicanalyzer.swap.model.probe2.NetworkData; -import org.tizen.dynamicanalyzer.ui.common.ContextAnalysisMenuItemClickListener; -import org.tizen.dynamicanalyzer.ui.common.ContextClearMenuItemClickListener; -import org.tizen.dynamicanalyzer.ui.common.ContextEndMenuItemClickListener; -import org.tizen.dynamicanalyzer.ui.common.ContextFromSelectionMenuItemClickListener; -import org.tizen.dynamicanalyzer.ui.common.ContextStartMenuItemClickListener; +import org.tizen.dynamicanalyzer.ui.common.PopupAnalysisMenuItemClickListener; +import org.tizen.dynamicanalyzer.ui.common.PopupClearMenuItemClickListener; +import org.tizen.dynamicanalyzer.ui.common.PopupEndMenuItemClickListener; +import org.tizen.dynamicanalyzer.ui.common.PopupFromSelectionMenuItemClickListener; +import org.tizen.dynamicanalyzer.ui.common.PopupStartMenuItemClickListener; import org.tizen.dynamicanalyzer.ui.common.TimelineChartMouseEventListener; import org.tizen.dynamicanalyzer.ui.common.TimelineChartMouseTrackAdapter; import org.tizen.dynamicanalyzer.ui.summary.failed.FailedChecker; @@ -55,15 +55,16 @@ import org.tizen.dynamicanalyzer.ui.summary.leaks.LeakDetector; import org.tizen.dynamicanalyzer.ui.summary.warning.WarningCase; import org.tizen.dynamicanalyzer.ui.summary.warning.WarningChecker; import org.tizen.dynamicanalyzer.ui.summary.warning.WarningData; -import org.tizen.dynamicanalyzer.ui.widgets.DAContextMenu; import org.tizen.dynamicanalyzer.utils.AnalyzerUtil; import org.tizen.dynamicanalyzer.widgets.chart.DAChart; import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlot; +import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlot.AutoRangeType; import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlotTooltip; import org.tizen.dynamicanalyzer.widgets.chart.DAChartSeries; import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoard; import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoardItem; -import org.tizen.dynamicanalyzer.widgets.contextMenu.DAContextMenuItem; +import org.tizen.dynamicanalyzer.widgets.popupMenu.DAPopupMenu; +import org.tizen.dynamicanalyzer.widgets.popupMenu.DAPopupMenuItem; public class NetworkDataMaker { private DAChartBoard board; @@ -408,7 +409,7 @@ public class NetworkDataMaker { } else { plot.setBackgroundImage(ImageResources.BG_CHILD_GRADIENT); } - plot.setAutoHeightRange(false); + plot.setAutoHeightRange(AutoRangeType.MANUAL); plot.setAxisFont(FontResources.CHART_AXIS_FONT); plot.setAxisRangeY(0, 101); plot.setAxisRangeX(board.getVisibleStartTime(), @@ -417,34 +418,36 @@ public class NetworkDataMaker { tooltip.setFont(FontResources.CHART_TOOLTIP_FONT); plot.setTooltip(tooltip); - DAContextMenu popupMenu = new DAContextMenu(chart); + DAPopupMenu popupMenu = new DAPopupMenu(chart); popupMenu.setFont(FontResources.CONTEXT_MENU_ITEM_FONT); - DAContextMenuItem startItem = new DAContextMenuItem(popupMenu); + DAPopupMenuItem startItem = new DAPopupMenuItem(popupMenu, + DAPopupMenuItem.NONE); startItem.setText(TimelineChartLabels.RANGE_CONTEXT_SET_START); - startItem.addClickListener(new ContextStartMenuItemClickListener( - startItem, board)); + startItem.addListener(new PopupStartMenuItemClickListener(startItem, + board)); - DAContextMenuItem endItem = new DAContextMenuItem(popupMenu); + DAPopupMenuItem endItem = new DAPopupMenuItem(popupMenu, + DAPopupMenuItem.NONE); endItem.setText(TimelineChartLabels.RANGE_CONTEXT_SET_END); - endItem.addClickListener(new ContextEndMenuItemClickListener(endItem, - board)); + endItem.addListener(new PopupEndMenuItemClickListener(endItem, board)); - DAContextMenuItem fromSelectionItem = new DAContextMenuItem(popupMenu); + DAPopupMenuItem fromSelectionItem = new DAPopupMenuItem(popupMenu, + DAPopupMenuItem.NONE); fromSelectionItem .setText(TimelineChartLabels.RANGE_CONTEXT_SET_FROM_SELECTION); fromSelectionItem - .addClickListener(new ContextFromSelectionMenuItemClickListener( + .addListener(new PopupFromSelectionMenuItemClickListener( fromSelectionItem, board)); - DAContextMenuItem analysisItem = new DAContextMenuItem(popupMenu); + DAPopupMenuItem analysisItem = new DAPopupMenuItem(popupMenu, + DAPopupMenuItem.NONE); analysisItem.setText(TimelineChartLabels.RANGE_CONTEXT_ANALYSIS); - analysisItem - .addClickListener(new ContextAnalysisMenuItemClickListener()); + analysisItem.addListener(new PopupAnalysisMenuItemClickListener()); - DAContextMenuItem clearItem = new DAContextMenuItem(popupMenu); + DAPopupMenuItem clearItem = new DAPopupMenuItem(popupMenu, + DAPopupMenuItem.NONE); clearItem.setText(TimelineChartLabels.RANGE_CONTEXT_CLEAR); - clearItem - .addClickListener(new ContextClearMenuItemClickListener(board)); + clearItem.addListener(new PopupClearMenuItemClickListener()); TimelineChartMouseEventListener timelineChartMouseEventListener = new TimelineChartMouseEventListener( popupMenu, board.getTimeline()); diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/network/NetworkTrafficChart.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/network/NetworkTrafficChart.java index 4eb1c2b..f70d6a0 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/network/NetworkTrafficChart.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/network/NetworkTrafficChart.java @@ -177,7 +177,7 @@ public class NetworkTrafficChart { FDCountData trafficData = trafficDataList.get(0); double doubleTime = Double.parseDouble(trafficData.time) - / TimelineConstants.MEGA; + / TimelineConstants.MEGA_DOUBLE; switch (trafficData.type) { case TYPE_RECV: { DAChartSeriesItem item = new DAChartSeriesItem(doubleTime, diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/GLConstantMap.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/GLConstantMap.java new file mode 100644 index 0000000..28f1c3c --- /dev/null +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/GLConstantMap.java @@ -0,0 +1,166 @@ +package org.tizen.dynamicanalyzer.ui.opengl; + +import java.util.HashMap; + +public class GLConstantMap { + private static HashMap constantMap = null; + + private static void initialize() { + constantMap = new HashMap(); + /* DataType */ + constantMap.put("1400", "GL_BYTE"); + constantMap.put("1401", "GL_UNSIGNED_BYTE"); + constantMap.put("1402", "GL_SHORT"); + constantMap.put("1403", "GL_UNSIGNED_SHORT"); + constantMap.put("1404", "GL_INT"); + constantMap.put("1405", "GL_UNSIGNED_INT"); + constantMap.put("1406", "GL_FLOAT"); + constantMap.put("140c", "GL_FIXED"); + /* BlendingFactorDest */ + constantMap.put("0", "GL_ZERO"); + constantMap.put("1", "GL_ONE"); + constantMap.put("300", "GL_SRC_COLOR"); + constantMap.put("301", "GL_ONE_MINUS_SRC_COLOR"); + constantMap.put("302", "GL_SRC_ALPHA"); + constantMap.put("303", "GL_ONE_MINUS_SRC_ALPHA"); + constantMap.put("304", "GL_DST_ALPHA"); + constantMap.put("305", "GL_ONE_MINUS_DST_ALPHA"); + /* BlendingFactorSrc */ + constantMap.put("306", "GL_DST_COLOR"); + constantMap.put("307", "GL_ONE_MINUS_DST_COLOR"); + constantMap.put("308", "GL_SRC_ALPHA_SATURATE"); + /* BlendEquationSeparate */ + constantMap.put("8006", "GL_FUNC_ADD"); + constantMap.put("8009", "GL_BLEND_EQUATION"); + constantMap.put("8009", "GL_BLEND_EQUATION_RGB");//FIXME + constantMap.put("883d", "GL_BLEND_EQUATION_ALPHA"); + /* BlendSubtract */ + constantMap.put("800a", "GL_FUNC_SUBTRACT"); + constantMap.put("880b", "GL_FUNC_REVERSE_SUBTRACT"); + /* Separate Blend Functions */ + constantMap.put("80c8", "GL_BLEND_DST_RGB"); + constantMap.put("80c9", "GL_BLEND_SRC_RGB"); + constantMap.put("80ca", "GL_BLEND_DST_ALPHA"); + constantMap.put("80cb", "GL_BLEND_SRC_ALPHA"); + constantMap.put("8001", "GL_CONSTANT_COLOR"); + constantMap.put("8002", "GL_ONE_MINUS_CONSTANT_COLOR"); + constantMap.put("8003", "GL_CONSTANT_ALPHA"); + constantMap.put("8004", "GL_ONE_MINUS_CONSTANT_ALPHA"); + constantMap.put("8005", "GL_BLEND_COLOR"); + /* FrontFaceDirection */ + constantMap.put("900", "GL_CW"); + constantMap.put("901", "GL_CCW"); + /* CullFaceMode */ + constantMap.put("404", "GL_FRONT"); + constantMap.put("405", "GL_BACK"); + constantMap.put("408", "GL_FRONT_AND_BACK"); + /* StencilFunction */ + constantMap.put("200", "GL_NEVER"); + constantMap.put("201", "GL_LESS"); + constantMap.put("202", "GL_EQUAL"); + constantMap.put("203", "GL_LEQUAL"); + constantMap.put("204", "GL_GREATER"); + constantMap.put("205", "GL_NOTEQUAL"); + constantMap.put("206", "GL_GEQUAL"); + constantMap.put("207", "GL_ALWAYS"); + /* StencilOp */ + constantMap.put("1e00", "GL_KEEP"); + constantMap.put("1e01", "GL_REPLACE"); + constantMap.put("1e02", "GL_INCR"); + constantMap.put("1e03", "GL_DECR"); + constantMap.put("1e0a", "GL_INVERT"); + constantMap.put("1e07", "GL_INCR_WRAP"); + constantMap.put("1e08", "GL_DECR_WRAP"); + /* TextureUnit */ + constantMap.put("84c0", "GL_TEXTURE0"); + constantMap.put("84c1", "GL_TEXTURE1"); + constantMap.put("84c2", "GL_TEXTURE2"); + constantMap.put("84c3", "GL_TEXTURE3"); + constantMap.put("84c4", "GL_TEXTURE4"); + constantMap.put("84c5", "GL_TEXTURE5"); + constantMap.put("84c6", "GL_TEXTURE6"); + constantMap.put("84c7", "GL_TEXTURE7"); + constantMap.put("84c8", "GL_TEXTURE8"); + constantMap.put("84c9", "GL_TEXTURE9"); + constantMap.put("84ca", "GL_TEXTURE10"); + constantMap.put("84cb", "GL_TEXTURE11"); + constantMap.put("84cc", "GL_TEXTURE12"); + constantMap.put("84cd", "GL_TEXTURE13"); + constantMap.put("84ce", "GL_TEXTURE14"); + constantMap.put("84cf", "GL_TEXTURE15"); + constantMap.put("84d0", "GL_TEXTURE16"); + constantMap.put("84d1", "GL_TEXTURE17"); + constantMap.put("84d2", "GL_TEXTURE18"); + constantMap.put("84d3", "GL_TEXTURE19"); + constantMap.put("84d4", "GL_TEXTURE20"); + constantMap.put("84d5", "GL_TEXTURE21"); + constantMap.put("84d6", "GL_TEXTURE22"); + constantMap.put("84d7", "GL_TEXTURE23"); + constantMap.put("84d8", "GL_TEXTURE24"); + constantMap.put("84d9", "GL_TEXTURE25"); + constantMap.put("84da", "GL_TEXTURE26"); + constantMap.put("84db", "GL_TEXTURE27"); + constantMap.put("84dc", "GL_TEXTURE28"); + constantMap.put("84dd", "GL_TEXTURE29"); + constantMap.put("84de", "GL_TEXTURE30"); + constantMap.put("84df", "GL_TEXTURE31"); + constantMap.put("84e0", "GL_ACTIVE_TEXTURE"); + /* Shaders */ + constantMap.put("8b30", "GL_FRAGMENT_SHADER"); + constantMap.put("8b31", "GL_VERTEX_SHADER"); + /* Uniform Types */ + constantMap.put("8b50", "GL_FLOAT_VEC2"); + constantMap.put("8b51", "GL_FLOAT_VEC3"); + constantMap.put("8b52", "GL_FLOAT_VEC4"); + constantMap.put("8b53", "GL_INT_VEC2"); + constantMap.put("8b54", "GL_INT_VEC3"); + constantMap.put("8b55", "GL_INT_VEC4"); + constantMap.put("8b56", "GL_BOOL"); + constantMap.put("8b57", "GL_BOOL_VEC2"); + constantMap.put("8b58", "GL_BOOL_VEC3"); + constantMap.put("8b59", "GL_BOOL_VEC4"); + constantMap.put("8b5a", "GL_FLOAT_MAT2"); + constantMap.put("8b5b", "GL_FLOAT_MAT3"); + constantMap.put("8b5c", "GL_FLOAT_MAT4"); + constantMap.put("8b5e", "GL_SAMPLER_2D"); + constantMap.put("8b60", "GL_SAMPLER_CUBE"); + /* TextureParameterName */ + constantMap.put("2800", "GL_TEXTURE_MAG_FILTER"); + constantMap.put("2801", "GL_TEXTURE_MIN_FILTER"); + constantMap.put("2802", "GL_TEXTURE_WRAP_S"); + constantMap.put("2803", "GL_TEXTURE_WRAP_T"); + /* TextureTarget */ + constantMap.put("de1", "GL_TEXTURE_2D"); + constantMap.put("8513", "GL_TEXTURE_CUBE_MAP"); + /* TextureMagFilter */ + constantMap.put("2600", "GL_NEAREST"); + constantMap.put("2601", "GL_LINEAR"); + /* TextureMinFilter */ + /* GL_NEAREST */ + /* GL_LINEAR */ + constantMap.put("2700", "GL_NEAREST_MIPMAP_NEAREST"); + constantMap.put("2701", "GL_LINEAR_MIPMAP_NEAREST"); + constantMap.put("2702", "GL_NEAREST_MIPMAP_LINEAR"); + constantMap.put("2703", "GL_LINEAR_MIPMAP_LINEAR"); + /* TextureWrapMode */ + constantMap.put("2901", "GL_REPEAT"); + constantMap.put("812f", "GL_CLAMP_TO_EDGE"); + constantMap.put("8370", "GL_MIRRORED_REPEAT"); + /* Buffer Objects */ + constantMap.put("8892", "GL_ARRAY_BUFFER"); + constantMap.put("8893", "GL_ELEMENT_ARRAY_BUFFER"); + constantMap.put("8894", "GL_ARRAY_BUFFER_BINDING"); + constantMap.put("8895", "GL_ELEMENT_ARRAY_BUFFER_BINDING"); + + constantMap.put("88e0", "GL_STREAM_DRAW"); + constantMap.put("88e4", "GL_STATIC_DRAW"); + constantMap.put("88e8", "GL_DYNAMIC_DRAW"); + } + + public static String getConstantString(String key) { + if (constantMap == null) { + initialize(); + } + return constantMap.get(key); + } +} diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/GLES20ErrorInformation.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/GLES20ErrorInformation.java new file mode 100644 index 0000000..eef0893 --- /dev/null +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/GLES20ErrorInformation.java @@ -0,0 +1,229 @@ +/* + * Dynamic Analyzer + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * 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.opengl; + +import java.util.HashMap; + +public class GLES20ErrorInformation { + private static HashMap gles20ErrorMap = null; + private static HashMap gles20ErrorDescriptionMap = null; + + private static void initialize() { + gles20ErrorMap = new HashMap(); + gles20ErrorMap.put(new Long(0), "No error"); + gles20ErrorMap.put(new Long(500), "GL_INVALID_ENUM"); + gles20ErrorMap.put(new Long(501), "GL_INVALID_VALUE"); + gles20ErrorMap.put(new Long(502), "GL_INVALID_OPERATION"); + gles20ErrorMap.put(new Long(505), "GL_OUT_OF_MEMORY"); + gles20ErrorMap.put(new Long(506), "GL_INVALID_FRAMEBUFFER_OPERATION"); + + gles20ErrorDescriptionMap = new HashMap(); + gles20ErrorDescriptionMap.put("0", "No error"); + gles20ErrorDescriptionMap + .put("500", + "An unacceptable value is specified for an enumerated argument. The offending command is ignored and has no other side effect than to set the error flag."); + gles20ErrorDescriptionMap + .put("501", + "A numeric argument is out of range. The offending command is ignored and has no other side effect than to set the error flag."); + gles20ErrorDescriptionMap + .put("502", + "The specified operation is not allowed in the current state. The offending command is ignored and has no other side effect than to set the error flag."); + gles20ErrorDescriptionMap + .put("505", + "There is not enough memory left to execute the command. The state of the GL is undefined, except for the state of the error flags, after this error is recorded."); + gles20ErrorDescriptionMap + .put("506", + "The command is trying to render to or read from the framebuffer while the currently bound framebuffer is not framebuffer complete (i.e. the return value from glCheckFramebufferStatus is not GL_FRAMEBUFFER_COMPLETE). The offending command is ignored and has no other side effect than to set the error flag."); + + gles20ErrorDescriptionMap.put("glActiveTextureGL_INVALID_ENUM", "GL_INVALID_ENUM is generated if texture is not one of GL_TEXTUREi, where i ranges from 0 to (GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS - 1)."); + gles20ErrorDescriptionMap.put("glAttachShaderGL_INVALID_VALUE", "GL_INVALID_VALUE is generated if either program or shader is not a value generated by OpenGL."); + gles20ErrorDescriptionMap.put("glAttachShaderGL_INVALID_OPERATION", "GL_INVALID_OPERATION is generated \n1. if program is not a program object.\n2. if shader is not a shader object.\n3. if shader is already attached to program, or if another shader object of the same type as shader is already attached to program."); + gles20ErrorDescriptionMap.put("glBindAttribLocationGL_INVALID_VALUE", "GL_INVALID_VALUE is generated \n1. if index is greater than or equal to GL_MAX_VERTEX_ATTRIBS.\n2. if program is not a value"); + gles20ErrorDescriptionMap.put("glBindAttribLocationGL_INVALID_OPERATION", "GL_INVALID_OPERATION is generated \n1. if name starts with the reserved prefix \"gl_\".\n2. if program is not a program object."); + gles20ErrorDescriptionMap.put("glBindBufferGL_INVALID_ENUM", "GL_INVALID_ENUM is generated if target is not one of the allowable values."); + gles20ErrorDescriptionMap.put("glBindFramebufferGL_INVALID_ENUM", "GL_INVALID_ENUM is generated if target is not GL_FRAMEBUFFER."); + gles20ErrorDescriptionMap.put("glBindRenderbufferGL_INVALID_ENUM", "GL_INVALID_ENUM is generated if target is not GL_RENDERBUFFER."); + gles20ErrorDescriptionMap.put("glBindTextureGL_INVALID_ENUM", "GL_INVALID_ENUM is generated if target is not one of the allowable values."); + gles20ErrorDescriptionMap.put("glBindTextureGL_INVALID_OPERATION", "GL_INVALID_OPERATION is generated if texture was previously created with a target that doesn't match that of target."); + gles20ErrorDescriptionMap.put("glBlendEquationGL_INVALID_ENUM", "GL_INVALID_ENUM is generated if mode is not one of GL_FUNC_ADD, GL_FUNC_SUBTRACT, or GL_FUNC_REVERSE_SUBTRACT."); + gles20ErrorDescriptionMap.put("glBlendEquationSeparateGL_INVALID_ENUM", "GL_INVALID_ENUM is generated if either modeRGB or modeAlpha is not one of GL_FUNC_ADD, GL_FUNC_SUBTRACT, or GL_FUNC_REVERSE_SUBTRACT."); + gles20ErrorDescriptionMap.put("glBlendFuncGL_INVALID_ENUM", "GL_INVALID_ENUM is generated if either sfactor or dfactor is not an accepted value."); + gles20ErrorDescriptionMap.put("glBlendFuncSeparateGL_INVALID_ENUM", "GL_INVALID_ENUM is generated if srcRGB, dstRGB, srcAlpha, or dstAlpha is not an accepted value."); + gles20ErrorDescriptionMap.put("glBufferDataGL_INVALID_VALUE", "GL_INVALID_VALUE is generated if size is negative."); + gles20ErrorDescriptionMap.put("glBufferDataGL_INVALID_ENUM", "GL_INVALID_ENUM is generated \n1. if target is not GL_ARRAY_BUFFER or GL_ELEMENT_ARRAY_BUFFER.\n2. if usage is not GL_STREAM_DRAW, GL_STATIC_DRAW, or GL_DYNAMIC_DRAW."); + gles20ErrorDescriptionMap.put("glBufferDataGL_OUT_OF_MEMORY", "GL_OUT_OF_MEMORY is generated if the GL is unable to create a data store with the specified size."); + gles20ErrorDescriptionMap.put("glBufferDataGL_INVALID_OPERATION", "GL_INVALID_OPERATION is generated if the reserved buffer object name 0 is bound to target."); + gles20ErrorDescriptionMap.put("glBufferSubDataGL_INVALID_VALUE", "GL_INVALID_VALUE is generated if offset or size is negative, or if together they define a region of memory that extends beyond the buffer object's allocated data store."); + gles20ErrorDescriptionMap.put("glBufferSubDataGL_INVALID_ENUM", "GL_INVALID_ENUM is generated if target is not GL_ARRAY_BUFFER or GL_ELEMENT_ARRAY_BUFFER."); + gles20ErrorDescriptionMap.put("glBufferSubDataGL_INVALID_OPERATION", "GL_INVALID_OPERATION is generated if the reserved buffer object name 0 is bound to target."); + gles20ErrorDescriptionMap.put("glCheckFramebufferStatusGL_INVALID_ENUM", "GL_INVALID_ENUM is generated if target is not GL_FRAMEBUFFER."); + gles20ErrorDescriptionMap.put("glClearGL_INVALID_VALUE", "GL_INVALID_VALUE is generated if any bit other than the three defined bits is set in mask."); + gles20ErrorDescriptionMap.put("glCompileShaderGL_INVALID_VALUE", "GL_INVALID_VALUE is generated if shader is not a value generated by OpenGL."); + gles20ErrorDescriptionMap.put("glCompileShaderGL_INVALID_OPERATION", "GL_INVALID_OPERATION is generated \n1. if a shader compiler is not supported.\n2. if shader is not a shader object."); + gles20ErrorDescriptionMap.put("glCompressedTexImage2DGL_INVALID_VALUE", "GL_INVALID_VALUE is generated \n1. if level is less than 0.\n2. if level is greater than log 2 ? max , where max is the returned value of GL_MAX_TEXTURE_SIZE when target is GL_TEXTURE_2D or GL_MAX_CUBE_MAP_TEXTURE_SIZE when target is not GL_TEXTURE_2D.\n3. if width or height is less than 0 or greater than GL_MAX_TEXTURE_SIZE when target is GL_TEXTURE_2D or GL_MAX_CUBE_MAP_TEXTURE_SIZE when target is not GL_TEXTURE_2D.\n4. if border is not 0.\n5. if imageSize is not consistent with the format, dimensions, and contents of the specified compressed image data."); + gles20ErrorDescriptionMap.put("glCompressedTexImage2DGL_INVALID_ENUM", "GL_INVALID_ENUM is generated \n1. if target is not GL_TEXTURE_2D, GL_TEXTURE_CUBE_MAP_POSITIVE_X, GL_TEXTURE_CUBE_MAP_NEGATIVE_X, GL_TEXTURE_CUBE_MAP_POSITIVE_Y, GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, GL_TEXTURE_CUBE_MAP_POSITIVE_Z, or GL_TEXTURE_CUBE_MAP_NEGATIVE_Z.\n2. if internalformat is not a supported format returned in GL_COMPRESSED_TEXTURE_FORMATS."); + gles20ErrorDescriptionMap.put("glCompressedTexImage2DGL_INVALID_OPERATION", "GL_INVALID_OPERATION is generated if parameter combinations are not supported by the specific compressed internal format as specified in the specific texture compression extension."); + gles20ErrorDescriptionMap.put("glCompressedTexSubImage2DGL_INVALID_VALUE", "GL_INVALID_VALUE is generated \n1. if level is less than 0.\n2. if level is greater than log 2 ? max , where max is the returned value of GL_MAX_TEXTURE_SIZE when target is GL_TEXTURE_2D or GL_MAX_CUBE_MAP_TEXTURE_SIZE when target is not GL_TEXTURE_2D.\n3. if xoffset < 0 , xoffset + width > w , yoffset < 0 , or yoffset + height > h , where w is the width and h is the height of the texture image being modified.\n4. if width or height is less than 0.\n5. if imageSize is not consistent with the format, dimensions, and contents of the specified compressed image data."); + gles20ErrorDescriptionMap.put("glCompressedTexSubImage2DGL_INVALID_ENUM", "GL_INVALID_ENUM is generated \n1. if target is not GL_TEXTURE_2D, GL_TEXTURE_CUBE_MAP_POSITIVE_X, GL_TEXTURE_CUBE_MAP_NEGATIVE_X, GL_TEXTURE_CUBE_MAP_POSITIVE_Y, GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, GL_TEXTURE_CUBE_MAP_POSITIVE_Z, or GL_TEXTURE_CUBE_MAP_NEGATIVE_Z.\n2. if format is not a supported format returned in GL_COMPRESSED_TEXTURE_FORMATS."); + gles20ErrorDescriptionMap.put("glCompressedTexSubImage2DGL_INVALID_OPERATION", "GL_INVALID_OPERATION is generated \n1. if the texture array has not been defined by a previous glCompressedTexImage2D operation whose internalformat matches the format of glCompressedTexSubImage2D.\n2. if parameter combinations are not supported by the specific compressed internal format as specified in the specific texture compression extension."); + gles20ErrorDescriptionMap.put("glCopyTexImage2DGL_INVALID_VALUE", "GL_INVALID_VALUE is generated \n1. if target is one of the six cube map 2D image targets and the width and height parameters are not equal.\n2. if level is less than 0.\n3. if level is greater than log 2 ? max , where max is the returned value of GL_MAX_TEXTURE_SIZE when target is GL_TEXTURE_2D or GL_MAX_CUBE_MAP_TEXTURE_SIZE when target is not GL_TEXTURE_2D.\n4. if width or height is less than 0 or greater than GL_MAX_TEXTURE_SIZE when target is GL_TEXTURE_2D or GL_MAX_CUBE_MAP_TEXTURE_SIZE when target is not GL_TEXTURE_2D.\n5. if border is not 0."); + gles20ErrorDescriptionMap.put("glCopyTexImage2DGL_INVALID_ENUM", "GL_INVALID_ENUM is generated \n1. if target is not GL_TEXTURE_2D, GL_TEXTURE_CUBE_MAP_POSITIVE_X, GL_TEXTURE_CUBE_MAP_NEGATIVE_X, GL_TEXTURE_CUBE_MAP_POSITIVE_Y, GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, GL_TEXTURE_CUBE_MAP_POSITIVE_Z, or GL_TEXTURE_CUBE_MAP_NEGATIVE_Z.\n2. if internalformat is not an accepted format."); + gles20ErrorDescriptionMap.put("glCopyTexImage2DGL_INVALID_OPERATION", "GL_INVALID_OPERATION is generated if the currently bound framebuffer's format does not contain a superset of the components required by the base format of internalformat."); + gles20ErrorDescriptionMap.put("glCopyTexImage2DGL_INVALID_FRAMEBUFFER_OPERATION", "GL_INVALID_FRAMEBUFFER_OPERATION is generated if the currently bound framebuffer is not framebuffer complete (i.e. the return value from glCheckFramebufferStatus is not GL_FRAMEBUFFER_COMPLETE)."); + gles20ErrorDescriptionMap.put("glCopyTexSubImage2DGL_INVALID_VALUE", "GL_INVALID_VALUE is generated \n1. if level is less than 0.\n2. if level > log 2 ? max , where max is the returned value of GL_MAX_TEXTURE_SIZE.\n3. if xoffset < 0 , xoffset + width > w , yoffset < 0 , or yoffset + height > h , where w is the width and h is the height of the texture image being modified.\n4. if width or height is less than 0."); + gles20ErrorDescriptionMap.put("glCopyTexSubImage2DGL_INVALID_ENUM", "GL_INVALID_ENUM is generated if target is not GL_TEXTURE_2D, GL_TEXTURE_CUBE_MAP_POSITIVE_X, GL_TEXTURE_CUBE_MAP_NEGATIVE_X, GL_TEXTURE_CUBE_MAP_POSITIVE_Y, GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, GL_TEXTURE_CUBE_MAP_POSITIVE_Z, or GL_TEXTURE_CUBE_MAP_NEGATIVE_Z."); + gles20ErrorDescriptionMap.put("glCopyTexSubImage2DGL_INVALID_OPERATION", "GL_INVALID_OPERATION is generated \n1. if the texture array has not been defined by a previous glTexImage2D or glCopyTexImage2D operation.\n2. if the currently bound framebuffer's format does not contain a superset of the components required by the texture's base internal format."); + gles20ErrorDescriptionMap.put("glCopyTexSubImage2DGL_INVALID_FRAMEBUFFER_OPERATION", "GL_INVALID_FRAMEBUFFER_OPERATION is generated if the currently bound framebuffer is not framebuffer complete (i.e. the return value from glCheckFramebufferStatus is not GL_FRAMEBUFFER_COMPLETE)."); + gles20ErrorDescriptionMap.put("glCreateShaderGL_INVALID_ENUM", "GL_INVALID_ENUM is generated if shaderType is not an accepted value."); + gles20ErrorDescriptionMap.put("glCullFaceGL_INVALID_ENUM", "GL_INVALID_ENUM is generated if mode is not an accepted value."); + gles20ErrorDescriptionMap.put("glDeleteBuffersGL_INVALID_VALUE", "GL_INVALID_VALUE is generated if n is negative."); + gles20ErrorDescriptionMap.put("glDeleteFramebuffersGL_INVALID_VALUE", "GL_INVALID_VALUE is generated if n is negative."); + gles20ErrorDescriptionMap.put("glDeleteProgramGL_INVALID_VALUE", "GL_INVALID_VALUE is generated if program is not a value generated by OpenGL."); + gles20ErrorDescriptionMap.put("glDeleteRenderbuffersGL_INVALID_VALUE", "GL_INVALID_VALUE is generated if n is negative."); + gles20ErrorDescriptionMap.put("glDeleteShaderGL_INVALID_VALUE", "GL_INVALID_VALUE is generated if shader is not a value generated by OpenGL."); + gles20ErrorDescriptionMap.put("glDeleteTexturesGL_INVALID_VALUE", "GL_INVALID_VALUE is generated if n is negative."); + gles20ErrorDescriptionMap.put("glDepthFuncGL_INVALID_ENUM", "GL_INVALID_ENUM is generated if func is not an accepted value."); + gles20ErrorDescriptionMap.put("glDetachShaderGL_INVALID_VALUE", "GL_INVALID_VALUE is generated if either program or shader is a value that was not generated by OpenGL."); + gles20ErrorDescriptionMap.put("glDetachShaderGL_INVALID_OPERATION", "GL_INVALID_OPERATION is generated \n1. if program is not a program object.\n2. if shader is not a shader object.\n3. if shader is not attached to program."); + gles20ErrorDescriptionMap.put("glDrawArraysGL_INVALID_VALUE", "GL_INVALID_VALUE is generated if count is negative."); + gles20ErrorDescriptionMap.put("glDrawArraysGL_INVALID_ENUM", "GL_INVALID_ENUM is generated if mode is not an accepted value."); + gles20ErrorDescriptionMap.put("glDrawArraysGL_INVALID_FRAMEBUFFER_OPERATION", "GL_INVALID_FRAMEBUFFER_OPERATION is generated if the currently bound framebuffer is not framebuffer complete (i.e. the return value from glCheckFramebufferStatus is not GL_FRAMEBUFFER_COMPLETE)."); + gles20ErrorDescriptionMap.put("glDrawElementsGL_INVALID_VALUE", "GL_INVALID_VALUE is generated if count is negative."); + gles20ErrorDescriptionMap.put("glDrawElementsGL_INVALID_ENUM", "GL_INVALID_ENUM is generated \n1. if mode is not an accepted value.\n2. if type is not GL_UNSIGNED_BYTE or GL_UNSIGNED_SHORT."); + gles20ErrorDescriptionMap.put("glDrawElementsGL_INVALID_FRAMEBUFFER_OPERATION", "GL_INVALID_FRAMEBUFFER_OPERATION is generated if the currently bound framebuffer is not framebuffer complete (i.e. the return value from glCheckFramebufferStatus is not GL_FRAMEBUFFER_COMPLETE)."); + gles20ErrorDescriptionMap.put("glEnableGL_INVALID_ENUM", "GL_INVALID_ENUM is generated if cap is not one of the values listed previously."); + gles20ErrorDescriptionMap.put("glEnableVertexAttribArrayGL_INVALID_VALUE", "GL_INVALID_VALUE is generated if index is greater than or equal to GL_MAX_VERTEX_ATTRIBS."); + gles20ErrorDescriptionMap.put("glFramebufferRenderbufferGL_INVALID_ENUM", "GL_INVALID_ENUM is generated \n1. if target is not GL_FRAMEBUFFER.\n2. if renderbuffertarget is not GL_RENDERBUFFER and renderbuffer is not 0.\n3. if attachment is not an accepted attachment point."); + gles20ErrorDescriptionMap.put("glFramebufferRenderbufferGL_INVALID_OPERATION", "GL_INVALID_OPERATION is generated \n1. if the default framebuffer object name 0 is bound.\n2. if renderbuffer is neither 0 nor the name of an existing renderbuffer object."); + gles20ErrorDescriptionMap.put("glFramebufferTexture2DGL_INVALID_VALUE", "GL_INVALID_VALUE is generated if level is not 0 and texture is not 0."); + gles20ErrorDescriptionMap.put("glFramebufferTexture2DGL_INVALID_ENUM", "GL_INVALID_ENUM is generated \n1. if target is not GL_FRAMEBUFFER.\n2. if textarget is not an accepted texture target and texture is not 0.\n3. if attachment is not an accepted attachment point."); + gles20ErrorDescriptionMap.put("glFramebufferTexture2DGL_INVALID_OPERATION", "GL_INVALID_OPERATION is generated \n1. if the default framebuffer object name 0 is bound.\n2. if texture is neither 0 nor the name of an existing texture object.\n3. if texture is the name of an existing two-dimensional texture object but textarget is not GL_TEXTURE_2D or if texture is the name of an existing cube map texture object but textarget is GL_TEXTURE_2D."); + gles20ErrorDescriptionMap.put("glFrontFaceGL_INVALID_ENUM", "GL_INVALID_ENUM is generated if mode is not an accepted value."); + gles20ErrorDescriptionMap.put("glGenBuffersGL_INVALID_VALUE", "GL_INVALID_VALUE is generated if n is negative."); + gles20ErrorDescriptionMap.put("glGenFramebuffersGL_INVALID_VALUE", "GL_INVALID_VALUE is generated if n is negative."); + gles20ErrorDescriptionMap.put("glGenRenderbuffersGL_INVALID_VALUE", "GL_INVALID_VALUE is generated if n is negative."); + gles20ErrorDescriptionMap.put("glGenTexturesGL_INVALID_VALUE", "GL_INVALID_VALUE is generated if n is negative."); + gles20ErrorDescriptionMap.put("glGenerateMipmapGL_INVALID_ENUM", "GL_INVALID_ENUM is generated if target is not GL_TEXTURE_2D or GL_TEXTURE_CUBE_MAP."); + gles20ErrorDescriptionMap.put("glGenerateMipmapGL_INVALID_OPERATION", "GL_INVALID_OPERATION is generated \n1. if the texture bound to target is a cube map, but its six faces do not share indentical widths, heights, formats, and types.\n2. if either the width or height of the zero level array is not a power of two.\n3. if the zero level array is stored in a compressed internal format."); + gles20ErrorDescriptionMap.put("glGetGL_INVALID_ENUM", "GL_INVALID_ENUM is generated if pname is not one of the values listed previously."); + gles20ErrorDescriptionMap.put("glGetActiveAttribGL_INVALID_VALUE", "GL_INVALID_VALUE is generated \n1. if program is not a value\n2. if index is greater than or equal to the number of active attribute variables in program.\n3. if bufSize is less than 0."); + gles20ErrorDescriptionMap.put("glGetActiveAttribGL_INVALID_OPERATION", "GL_INVALID_OPERATION is generated if program is not a program object."); + gles20ErrorDescriptionMap.put("glGetActiveUniformGL_INVALID_VALUE", "GL_INVALID_VALUE is generated \n1. if program is not a value\n2. if index is greater than or equal to the number of active uniform variables in program.\n3. if bufSize is less than 0."); + gles20ErrorDescriptionMap.put("glGetActiveUniformGL_INVALID_OPERATION", "GL_INVALID_OPERATION is generated if program is not a program object."); + gles20ErrorDescriptionMap.put("glGetAttachedShadersGL_INVALID_VALUE", "GL_INVALID_VALUE is generated \n1. if program is not a value\n2. if maxCount is less than 0."); + gles20ErrorDescriptionMap.put("glGetAttachedShadersGL_INVALID_OPERATION", "GL_INVALID_OPERATION is generated if program is not a program object."); + gles20ErrorDescriptionMap.put("glGetAttribLocationGL_INVALID_OPERATION", "GL_INVALID_OPERATION is generated \n1. if program is not a value\n2. if program is not a program object.\n3. if program has not been successfully linked."); + gles20ErrorDescriptionMap.put("glGetBufferParameterivGL_INVALID_ENUM", "GL_INVALID_ENUM is generated if target or value is not an accepted value."); + gles20ErrorDescriptionMap.put("glGetBufferParameterivGL_INVALID_OPERATION", "GL_INVALID_OPERATION is generated if the reserved buffer object name 0 is bound to target."); + gles20ErrorDescriptionMap.put("glGetFramebufferAttachmentParameterivGL_INVALID_ENUM", "GL_INVALID_ENUM is generated \n1. if target is not GL_FRAMEBUFFER.\n2. if attachment is not GL_COLOR_ATTACHMENT0, GL_DEPTH_ATTACHMENT, or GL_STENCIL_ATTACHMENT.\n3. if the attached object at the named attachment point is GL_RENDERBUFFER and pname is not GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE or GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME.\n4. if the attached object at the named attachment point is GL_TEXTURE and pname is not GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL, or GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE.\n5. if there is no attached object at the named attachment point and pname is not GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE."); + gles20ErrorDescriptionMap.put("glGetFramebufferAttachmentParameterivGL_INVALID_OPERATION", "GL_INVALID_OPERATION is generated if the default framebuffer object name 0 is bound."); + gles20ErrorDescriptionMap.put("glGetProgramInfoLogGL_INVALID_VALUE", "GL_INVALID_VALUE is generated \n1. if program is not a value\n2. if maxLength is less than 0."); + gles20ErrorDescriptionMap.put("glGetProgramInfoLogGL_INVALID_OPERATION", "GL_INVALID_OPERATION is generated if program is not a program object."); + gles20ErrorDescriptionMap.put("glGetProgramivGL_INVALID_VALUE", "GL_INVALID_VALUE is generated if program is not a value generated by OpenGL."); + gles20ErrorDescriptionMap.put("glGetProgramivGL_INVALID_ENUM", "GL_INVALID_ENUM is generated if pname is not an accepted value."); + gles20ErrorDescriptionMap.put("glGetProgramivGL_INVALID_OPERATION", "GL_INVALID_OPERATION is generated if program does not refer to a program object."); + gles20ErrorDescriptionMap.put("glGetRenderbufferParameterivGL_INVALID_ENUM", "GL_INVALID_ENUM is generated \n1. if target is not GL_RENDERBUFFER.\n2. if pname is not GL_RENDERBUFFER_WIDTH, GL_RENDERBUFFER_HEIGHT, GL_RENDERBUFFER_INTERNAL_FORMAT, GL_RENDERBUFFER_RED_SIZE, GL_RENDERBUFFER_GREEN_SIZE, GL_RENDERBUFFER_BLUE_SIZE, GL_RENDERBUFFER_ALPHA_SIZE, GL_RENDERBUFFER_DEPTH_SIZE, or GL_RENDERBUFFER_STENCIL_SIZE."); + gles20ErrorDescriptionMap.put("glGetRenderbufferParameterivGL_INVALID_OPERATION", "GL_INVALID_OPERATION is generated if the reserved renderbuffer object name 0 is bound."); + gles20ErrorDescriptionMap.put("glGetShaderInfoLogGL_INVALID_VALUE", "GL_INVALID_VALUE is generated \n1. if shader is not a value\n2. if maxLength is less than 0."); + gles20ErrorDescriptionMap.put("glGetShaderInfoLogGL_INVALID_OPERATION", "GL_INVALID_OPERATION is generated if shader is not a shader object."); + gles20ErrorDescriptionMap.put("glGetShaderPrecisionFormatGL_INVALID_ENUM", "GL_INVALID_ENUM is generated if shaderType or precisionType is not an accepted value."); + gles20ErrorDescriptionMap.put("glGetShaderPrecisionFormatGL_INVALID_OPERATION", "GL_INVALID_OPERATION is generated if a shader compiler is not supported."); + gles20ErrorDescriptionMap.put("glGetShaderSourceGL_INVALID_VALUE", "GL_INVALID_VALUE is generated \n1. if shader is not a value\n2. if bufSize is less than 0."); + gles20ErrorDescriptionMap.put("glGetShaderSourceGL_INVALID_OPERATION", "GL_INVALID_OPERATION is generated if shader is not a shader object."); + gles20ErrorDescriptionMap.put("glGetShaderivGL_INVALID_VALUE", "GL_INVALID_VALUE is generated if shader is not a value generated by OpenGL."); + gles20ErrorDescriptionMap.put("glGetShaderivGL_INVALID_ENUM", "GL_INVALID_ENUM is generated if pname is not an accepted value."); + gles20ErrorDescriptionMap.put("glGetShaderivGL_INVALID_OPERATION", "GL_INVALID_OPERATION is generated \n1. if pname is GL_COMPILE_STATUS, GL_INFO_LOG_LENGTH, or GL_SHADER_SOURCE_LENGTH but a shader compiler is not supported.\n2. if shader does not refer to a shader object."); + gles20ErrorDescriptionMap.put("glGetStringGL_INVALID_ENUM", "GL_INVALID_ENUM is generated if name is not an accepted value."); + gles20ErrorDescriptionMap.put("glGetTexParameterGL_INVALID_ENUM", "GL_INVALID_ENUM is generated if target or pname is not an accepted value."); + gles20ErrorDescriptionMap.put("glGetUniformGL_INVALID_VALUE", "GL_INVALID_VALUE is generated if program is not a value generated by OpenGL."); + gles20ErrorDescriptionMap.put("glGetUniformGL_INVALID_OPERATION", "GL_INVALID_OPERATION is generated \n1. if program is not a program object.\n2. if program has not been successfully linked.\n3. if location does not correspond to a valid uniform variable location for the specified program object."); + gles20ErrorDescriptionMap.put("glGetUniformLocationGL_INVALID_VALUE", "GL_INVALID_VALUE is generated if program is not a value generated by OpenGL."); + gles20ErrorDescriptionMap.put("glGetUniformLocationGL_INVALID_OPERATION", "GL_INVALID_OPERATION is generated \n1. if program is not a program object.\n2. if program has not been successfully linked."); + gles20ErrorDescriptionMap.put("glGetVertexAttribGL_INVALID_VALUE", "GL_INVALID_VALUE is generated if index is greater than or equal to GL_MAX_VERTEX_ATTRIBS."); + gles20ErrorDescriptionMap.put("glGetVertexAttribGL_INVALID_ENUM", "GL_INVALID_ENUM is generated if pname is not an accepted value."); + gles20ErrorDescriptionMap.put("glGetVertexAttribPointervGL_INVALID_VALUE", "GL_INVALID_VALUE is generated if index is greater than or equal to GL_MAX_VERTEX_ATTRIBS."); + gles20ErrorDescriptionMap.put("glGetVertexAttribPointervGL_INVALID_ENUM", "GL_INVALID_ENUM is generated if pname is not an accepted value."); + gles20ErrorDescriptionMap.put("glHintGL_INVALID_ENUM", "GL_INVALID_ENUM is generated if either target or mode is not an accepted value."); + gles20ErrorDescriptionMap.put("glIsEnabledGL_INVALID_ENUM", "GL_INVALID_ENUM is generated if cap is not an accepted value."); + gles20ErrorDescriptionMap.put("glLineWidthGL_INVALID_VALUE", "GL_INVALID_VALUE is generated if width is less than or equal to 0."); + gles20ErrorDescriptionMap.put("glLinkProgramGL_INVALID_VALUE", "GL_INVALID_VALUE is generated if program is not a value generated by OpenGL."); + gles20ErrorDescriptionMap.put("glLinkProgramGL_INVALID_OPERATION", "GL_INVALID_OPERATION is generated if program is not a program object."); + gles20ErrorDescriptionMap.put("glPixelStoreiGL_INVALID_VALUE", "GL_INVALID_VALUE is generated if alignment is specified as other than 1, 2, 4, or 8."); + gles20ErrorDescriptionMap.put("glPixelStoreiGL_INVALID_ENUM", "GL_INVALID_ENUM is generated if pname is not an accepted value."); + gles20ErrorDescriptionMap.put("glReadPixelsGL_INVALID_VALUE", "GL_INVALID_VALUE is generated if either width or height is negative."); + gles20ErrorDescriptionMap.put("glReadPixelsGL_INVALID_ENUM", "GL_INVALID_ENUM is generated if format or type is not an accepted value."); + gles20ErrorDescriptionMap.put("glReadPixelsGL_INVALID_OPERATION", "GL_INVALID_OPERATION is generated \n1. if type is GL_UNSIGNED_SHORT_5_6_5 and format is not GL_RGB.\n2. if type is GL_UNSIGNED_SHORT_4_4_4_4 or GL_UNSIGNED_SHORT_5_5_5_1 and format is not GL_RGBA.\n3. if format and type are neither GL_RGBA and GL_UNSIGNED_BYTE, respectively, nor the format/type pair returned by querying GL_IMPLEMENTATION_COLOR_READ_FORMAT and GL_IMPLEMENTATION_COLOR_READ_TYPE."); + gles20ErrorDescriptionMap.put("glReadPixelsGL_INVALID_FRAMEBUFFER_OPERATION", "GL_INVALID_FRAMEBUFFER_OPERATION is generated if the currently bound framebuffer is not framebuffer complete (i.e. the return value from glCheckFramebufferStatus is not GL_FRAMEBUFFER_COMPLETE)."); + gles20ErrorDescriptionMap.put("glReleaseShaderCompilerGL_INVALID_OPERATION", "GL_INVALID_OPERATION is generated if a shader compiler is not supported."); + gles20ErrorDescriptionMap.put("glRenderbufferStorageGL_INVALID_VALUE", "GL_INVALID_VALUE is generated if width or height is less than zero or greater than GL_MAX_RENDERBUFFER_SIZE."); + gles20ErrorDescriptionMap.put("glRenderbufferStorageGL_INVALID_ENUM", "GL_INVALID_ENUM is generated \n1. if target is not GL_RENDERBUFFER.\n2. if internalformat is not an accepted format."); + gles20ErrorDescriptionMap.put("glRenderbufferStorageGL_INVALID_OPERATION", "GL_INVALID_OPERATION is generated if the reserved renderbuffer object name 0 is bound."); + gles20ErrorDescriptionMap.put("glRenderbufferStorageGL_OUT_OF_MEMORY", "GL_OUT_OF_MEMORY is generated if the implementation is unable to create a data store with the requested width and height."); + gles20ErrorDescriptionMap.put("glScissorGL_INVALID_VALUE", "GL_INVALID_VALUE is generated if either width or height is negative."); + gles20ErrorDescriptionMap.put("glShaderBinaryGL_INVALID_VALUE", "GL_INVALID_VALUE is generated \n1. if any value in shaders is not a vlue\n2. if the format of the data pointed to by binary does not match binaryformat.\n3. if n or length is negative."); + gles20ErrorDescriptionMap.put("glShaderBinaryGL_INVALID_ENUM", "GL_INVALID_ENUM is generated if binaryformat is not a supported format returned in GL_SHADER_BINARY_FORMATS."); + gles20ErrorDescriptionMap.put("glShaderBinaryGL_INVALID_OPERATION", "GL_INVALID_OPERATION is generated if any value in shaders is not a shader object, or if there is more than one vertex shader object handle or more than one fragment shader object handle in shaders."); + gles20ErrorDescriptionMap.put("glShaderSourceGL_INVALID_VALUE", "GL_INVALID_VALUE is generated \n1. if shader is not a value\n2. if count is less than 0."); + gles20ErrorDescriptionMap.put("glShaderSourceGL_INVALID_OPERATION", "GL_INVALID_OPERATION is generated \n1. if a shader compiler is not supported.\n2. if shader is not a shader object."); + gles20ErrorDescriptionMap.put("glStencilFuncGL_INVALID_ENUM", "GL_INVALID_ENUM is generated if func is not one of the eight accepted values."); + gles20ErrorDescriptionMap.put("glStencilFuncSeparateGL_INVALID_ENUM", "GL_INVALID_ENUM is generated \n1. if face is not GL_FRONT, GL_BACK, or GL_FRONT_AND_BACK.\n2. if func is not one of the eight accepted values."); + gles20ErrorDescriptionMap.put("glStencilMaskSeparateGL_INVALID_ENUM", "GL_INVALID_ENUM is generated if face is not GL_FRONT, GL_BACK, or GL_FRONT_AND_BACK."); + gles20ErrorDescriptionMap.put("glStencilOpGL_INVALID_ENUM", "GL_INVALID_ENUM is generated if sfail, dpfail, or dppass is any value other than the eight defined symbolic constant values."); + gles20ErrorDescriptionMap.put("glStencilOpSeparateGL_INVALID_ENUM", "GL_INVALID_ENUM is generated \n1. if face is any value other than GL_FRONT, GL_BACK, or GL_FRONT_AND_BACK.\n2. if sfail, dpfail, or dppass is any value other than the eight defined symbolic constant values."); + gles20ErrorDescriptionMap.put("glTexImage2DGL_INVALID_VALUE", "GL_INVALID_VALUE is generated \n1. if target is one of the six cube map 2D image targets and the width and height parameters are not equal.\n2. if level is less than 0.\n3. if level is greater than log 2 ? max , where max is the returned value of GL_MAX_TEXTURE_SIZE when target is GL_TEXTURE_2D or GL_MAX_CUBE_MAP_TEXTURE_SIZE when target is not GL_TEXTURE_2D.\n4. if internalformat is not an accepted format.\n5. if width or height is less than 0 or greater than GL_MAX_TEXTURE_SIZE when target is GL_TEXTURE_2D or GL_MAX_CUBE_MAP_TEXTURE_SIZE when target is not GL_TEXTURE_2D.\n6. if border is not 0."); + gles20ErrorDescriptionMap.put("glTexImage2DGL_INVALID_ENUM", "GL_INVALID_ENUM is generated \n1. if target is not GL_TEXTURE_2D, GL_TEXTURE_CUBE_MAP_POSITIVE_X, GL_TEXTURE_CUBE_MAP_NEGATIVE_X, GL_TEXTURE_CUBE_MAP_POSITIVE_Y, GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, GL_TEXTURE_CUBE_MAP_POSITIVE_Z, or GL_TEXTURE_CUBE_MAP_NEGATIVE_Z.\n2. if format or type is not an accepted value."); + gles20ErrorDescriptionMap.put("glTexImage2DGL_INVALID_OPERATION", "GL_INVALID_OPERATION is generated \n1. if format does not match internalformat.\n2. if type is GL_UNSIGNED_SHORT_5_6_5 and format is not GL_RGB.\n3. if type is GL_UNSIGNED_SHORT_4_4_4_4 or GL_UNSIGNED_SHORT_5_5_5_1 and format is not GL_RGBA."); + gles20ErrorDescriptionMap.put("glTexParameterGL_INVALID_ENUM", "GL_INVALID_ENUM is generated \n1. if target or pname is not one of the accepted defined values.\n2. if params should have a defined symbolic constant value (based on the value of pname) and does not."); + gles20ErrorDescriptionMap.put("glTexSubImage2DGL_INVALID_VALUE", "GL_INVALID_VALUE is generated \n1. if level is less than 0.\n2. if level is greater than log 2 max, where max is the returned value of GL_MAX_TEXTURE_SIZE.\n3. if xoffset < 0 , xoffset + width > w , yoffset < 0 , or yoffset + height > h , where w is the width and h is the height of the texture image being modified.\n4. if width or height is less than 0."); + gles20ErrorDescriptionMap.put("glTexSubImage2DGL_INVALID_ENUM", "GL_INVALID_ENUM is generated \n1. if target is not GL_TEXTURE_2D, GL_TEXTURE_CUBE_MAP_POSITIVE_X, GL_TEXTURE_CUBE_MAP_NEGATIVE_X, GL_TEXTURE_CUBE_MAP_POSITIVE_Y, GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, GL_TEXTURE_CUBE_MAP_POSITIVE_Z, or GL_TEXTURE_CUBE_MAP_NEGATIVE_Z.\n2. if format or type is not an accepted value."); + gles20ErrorDescriptionMap.put("glTexSubImage2DGL_INVALID_OPERATION", "GL_INVALID_OPERATION is generated \n1. if the texture array has not been defined by a previous glTexImage2D or glCopyTexImage2D operation whose internalformat matches the format of glTexSubImage2D.\n2. if type is GL_UNSIGNED_SHORT_5_6_5 and format is not GL_RGB.\n3. if type is GL_UNSIGNED_SHORT_4_4_4_4 or GL_UNSIGNED_SHORT_5_5_5_1 and format is not GL_RGBA."); + gles20ErrorDescriptionMap.put("glUniformGL_INVALID_VALUE", "GL_INVALID_VALUE is generated \n1. if count is less than 0.\n2. if transpose is not GL_FALSE."); + gles20ErrorDescriptionMap.put("glUniformGL_INVALID_OPERATION", "GL_INVALID_OPERATION is generated \n1. if there is no current program object.\n2. if the size of the uniform variable declared in the shader does not match the size indicated by the glUniform command.\n3. if one of the integer variants of this function is used to load a uniform variable of type float, vec2, vec3, vec4, or an array of these, or if one of the floating-point variants of this function is used to load a uniform variable of type int, ivec2, ivec3, or ivec4, or an array of these.\n4. if location is an invalid uniform location for the current program object and location is not equal to -1.\n5. if count is greater than 1 and the indicated uniform variable is not an array variable.\n6. if a sampler is loaded using a command other than glUniform1i and glUniform1iv."); + gles20ErrorDescriptionMap.put("glUseProgramGL_INVALID_VALUE", "GL_INVALID_VALUE is generated if program is neither 0 nor a value generated by OpenGL."); + gles20ErrorDescriptionMap.put("glUseProgramGL_INVALID_OPERATION", "GL_INVALID_OPERATION is generated \n1. if program is not a program object.\n2. if program could not be made part of current state."); + gles20ErrorDescriptionMap.put("glValidateProgramGL_INVALID_VALUE", "GL_INVALID_VALUE is generated if program is not a value generated by OpenGL."); + gles20ErrorDescriptionMap.put("glValidateProgramGL_INVALID_OPERATION", "GL_INVALID_OPERATION is generated if program is not a program object."); + gles20ErrorDescriptionMap.put("glVertexAttribGL_INVALID_VALUE", "GL_INVALID_VALUE is generated if index is greater than or equal to GL_MAX_VERTEX_ATTRIBS."); + gles20ErrorDescriptionMap.put("glVertexAttribPointerGL_INVALID_VALUE", "GL_INVALID_VALUE is generated \n1. if index is greater than or equal to GL_MAX_VERTEX_ATTRIBS.\n2. if size is not 1, 2, 3, or 4.\n3. if stride is negative."); + gles20ErrorDescriptionMap.put("glVertexAttribPointerGL_INVALID_ENUM", "GL_INVALID_ENUM is generated if type is not an accepted value."); + gles20ErrorDescriptionMap.put("glViewportGL_INVALID_VALUE", "GL_INVALID_VALUE is generated if either width or height is negative."); + } + + public static String getError(Long key) { + if(gles20ErrorMap == null) { + initialize(); + } + return gles20ErrorMap.get(key); + } + + public static String getErrorDescription(String key) { + if(gles20ErrorDescriptionMap == null) { + initialize(); + } + return gles20ErrorDescriptionMap.get(key); + } +} diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/data/CurrentContextValueList.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/data/CurrentContextValueList.java new file mode 100644 index 0000000..8529ee5 --- /dev/null +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/data/CurrentContextValueList.java @@ -0,0 +1,58 @@ +/* + * Dynamic Analyzer + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * 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.opengl.data; + +import java.util.ArrayList; +import java.util.List; + +@SuppressWarnings("serial") +public class CurrentContextValueList extends ArrayList { + private List setIndexList; + + public CurrentContextValueList() { + super(); + setIndexList = new ArrayList(); + } + + public String set(int index, String element) { + setIndexList.add(String.valueOf(index)); + + return super.set(index, element); + } + + public String originalSet(int index, String element) { + return super.set(index, element); + } + + public List getSetIndexList() { + return setIndexList; + } + + public void clearSetIndexList() { + setIndexList.clear(); + } +} diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/data/GLContextDBEnum.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/data/GLContextDBEnum.java new file mode 100644 index 0000000..bf0942d --- /dev/null +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/data/GLContextDBEnum.java @@ -0,0 +1,129 @@ +/* + * Dynamic Analyzer + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * 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.opengl.data; + + + +public enum GLContextDBEnum { + GVA_V0("gvaV0"),//$NON-NLS-1$ + GVA_V1("gvaV1"),//$NON-NLS-1$ + GVA_V2("gvaV2"),//$NON-NLS-1$ + GVA_V3("gvaV3"),//$NON-NLS-1$ + GVA_ENABLED("gvaEnabled"),//$NON-NLS-1$ + GVA_SIZE("gvaSize"),//$NON-NLS-1$ + GVA_TYPE("gvaType"),//$NON-NLS-1$ + GVA_NORMAL("gvaNormal"),//$NON-NLS-1$ + GVA_STRIDE("gvaStride"),//$NON-NLS-1$ + GVA_POINTER("gvaPointer"),//$NON-NLS-1$ + VBO_BINDING("VBOBinding"),//$NON-NLS-1$ + VBO_ID("VBOID"),//$NON-NLS-1$ + VBO_SIZE("VBOSize"),//$NON-NLS-1$ + VBO_Data("VBOData"),//$NON-NLS-1$ + VBO_Usage("VBOUsage"),//$NON-NLS-1$ + VIEWPORT_X("viewportX"),//$NON-NLS-1$ + VIEWPORT_Y("viewportY"),//$NON-NLS-1$ + VIEWPORT_W("viewportW"),//$NON-NLS-1$ + VIEWPORT_H("viewportH"),//$NON-NLS-1$ + DEPTH_RANGE_N("depthRangeNear"),//$NON-NLS-1$ + DEPTH_RANGE_F("depthRangeFar"),//$NON-NLS-1$ + LINE_W("lineWidth"),//$NON-NLS-1$ + CULLING_ENABLED("cullingEnabled"),//$NON-NLS-1$ + CULLING_ORI("cullingOrientation"),//$NON-NLS-1$ + CULLING_MODE("cullingMode"),//$NON-NLS-1$ + POLY_ENABLED("polygonMode"),//$NON-NLS-1$ + POLY_FACTOR("polygonFactor"),//$NON-NLS-1$ + POLY_UNITS("cullingUnits"),//$NON-NLS-1$ + SCISSOR_ENABLED("scissorEnabled"),//$NON-NLS-1$ + SCISSOR_X("scissorX"),//$NON-NLS-1$ + SCISSOR_Y("scissorY"),//$NON-NLS-1$ + SCISSOR_W("scissorWidth"),//$NON-NLS-1$ + SCISSOR_H("scissorHeight"),//$NON-NLS-1$ + STENCIL_ENABLED("stencilEnabled"),//$NON-NLS-1$ + STENCIL_FRONT_FUNC("stencilFrontFunction"),//$NON-NLS-1$ + STENCIL_FRONT_REF("stencilFrontReference"),//$NON-NLS-1$ + STENCIL_FRONT_MASK("stencilFrontMask"),//$NON-NLS-1$ + STENCIL_FRONT_S_FAIL("stencilFrontStencilFailAction"),//$NON-NLS-1$ + STENCIL_FRONT_D_FAIL("stencilFrontDepthFailAction"),//$NON-NLS-1$ + STENCIL_FRONT_D_PASS("stencilFrontDepthPassAction"),//$NON-NLS-1$ + STENCIL_BACK_FUNC("stencilBackFunction"),//$NON-NLS-1$ + STENCIL_BACK_REF("stencilBackReference"),//$NON-NLS-1$ + STENCIL_BACK_MASK("stencilBackMask"),//$NON-NLS-1$ + STENCIL_BACK_S_FAIL("stencilBackStencilFailAction"),//$NON-NLS-1$ + STENCIL_BACK_D_FAIL("stencilBackDepthFailAction"),//$NON-NLS-1$ + STENCIL_BACK_D_PASS("stencilBackDepthPassAction"),//$NON-NLS-1$ + DEPTH_ENABLED("depthEnabled"),//$NON-NLS-1$ + DEPTH_FUNC("depthFunction"),//$NON-NLS-1$ + BLEND_ENABLED("blendingEnabled"),//$NON-NLS-1$ + BLEND_SRC_RGB("blendingSourceRGBFactor"),//$NON-NLS-1$ + BLEND_SRC_A("blendingSourceAlphaFactor"),//$NON-NLS-1$ + BLEND_DEST_RGB("blendingDestinationRGBFactor"),//$NON-NLS-1$ + BLEND_DEST_A("blendingDestinationAlphaFactor"),//$NON-NLS-1$ + BLEND_RGB_EQ("blendingRGBEquation"),//$NON-NLS-1$ + BLEND_A_EQ("blendingAlphaEquation"),//$NON-NLS-1$ + BLEND_COLOR("blendingColor"),//$NON-NLS-1$ + DITHER_ENABLED("ditherEnabled"),//$NON-NLS-1$ + PACK_ALIGN("packAlignment"),//$NON-NLS-1$ + UNPACK_ALIGN("unpackAlignment"),//$NON-NLS-1$ + TEXTURE_ACTIVE("textureActive"),//$NON-NLS-1$ + TEXTURE_UNIT_2D("textureUnit02dBinding"),//$NON-NLS-1$ + TEXTURE_UNIT_CUBE("textureUnit0CubemapBinding"),//$NON-NLS-1$ + TEXTURE_OBJ_ID("textureObjID"),//$NON-NLS-1$ + TEXTURE_OBJ_MAG_FUNC("textureObjMagFunc"),//$NON-NLS-1$ + TEXTURE_OBJ_MIN_FUNC("textureObjMinFunc"),//$NON-NLS-1$ + TEXTURE_OBJ_WRAP_S("textureObjWrapS"),//$NON-NLS-1$ + TEXTURE_OBJ_WRAP_T("textureObjWrapT"),//$NON-NLS-1$ + PROGRAM_OBJ_CURRENT("currentProgramObject"),//$NON-NLS-1$ + PROGRAM_OBJ_ID("programObjectID"),//$NON-NLS-1$ + PROGRAM_OBJ_V_SHADER("programVShader"),//$NON-NLS-1$ + PROGRAM_OBJ_F_SHADER("programFShader"),//$NON-NLS-1$ + PROGRAM_ATTRIB_INDEX("programAttribIndex"),//$NON-NLS-1$ + PROGRAM_ATTRIB_NAME("programAttribName"),//$NON-NLS-1$ + PROGRAM_ATTRIB_SIZE("programAttribSize"),//$NON-NLS-1$ + PROGRAM_ATTRIB_TYPE("programAttribType"),//$NON-NLS-1$ + PROGRAM_UNIFORM_INDEX("programUniformIndex"),//$NON-NLS-1$ + PROGRAM_UNIFORM_NAME("programUniformName"),//$NON-NLS-1$ + PROGRAM_UNIFORM_SIZE("programUniformSize"),//$NON-NLS-1$ + PROGRAM_UNIFORM_TYPE("programUniformType"),//$NON-NLS-1$ + FRAME_BUFFER_BINDING("frameBufferBinding"),//$NON-NLS-1$ + SHADER_OBJ_ID("shaderObjIndex"),//$NON-NLS-1$ + SHADER_TYPE("shaderType"),//$NON-NLS-1$ + SHADER_SRC("shaderSource"),//$NON-NLS-1$ + INVOLVED_ORDINAL("involvedOrdinal"),//$NON-NLS-1$ + INVOLVED_INDEX1("involvedIndex1"),//$NON-NLS-1$ + INVOLVED_INDEX2("involvedIndex2"),//$NON-NLS-1$ + FRAME_INDEX("frameIndex");//$NON-NLS-1$ + + private String columnName; + + private GLContextDBEnum(String columnName) { + this.columnName = columnName; + } + + public String getcolumnName() { + return columnName; + } +} diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/data/GLContextTreeNodeData.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/data/GLContextTreeNodeData.java new file mode 100644 index 0000000..f1684da --- /dev/null +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/data/GLContextTreeNodeData.java @@ -0,0 +1,90 @@ +/* + * Dynamic Analyzer + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * 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.opengl.data; + +import java.util.ArrayList; +import java.util.List; + +import org.tizen.dynamicanalyzer.ui.widgets.table.DATableDataFormat; + +public class GLContextTreeNodeData extends DATableDataFormat { + private List involvedDBColumnIndexList; + private int dbColumnIndex; + private int insideColumnIndex1; + private int insideColumnIndex2; + private String nodeName; + + public GLContextTreeNodeData(int selectionKey, int columnIndex, + String nodeName, int... involvedDBColumnIndexs) { + this(selectionKey, columnIndex, -1, -1, nodeName, + involvedDBColumnIndexs); + } + + public GLContextTreeNodeData(int selectionKey, int columnIndex, + int insideColumnIndex1, String nodeName, + int... involvedDBColumnIndexs) { + this(selectionKey, columnIndex, insideColumnIndex1, -1, nodeName, + involvedDBColumnIndexs); + } + + public GLContextTreeNodeData(int selectionKey, int columnIndex, + int insideColumnIndex1, int insideColumnIndex2, String nodeName, + int... involvedDBColumnIndexs) { + super(selectionKey); + involvedDBColumnIndexList = new ArrayList(); + involvedDBColumnIndexList.add(columnIndex); + this.dbColumnIndex = columnIndex; + this.insideColumnIndex1 = insideColumnIndex1; + this.insideColumnIndex2 = insideColumnIndex2; + this.nodeName = nodeName; + obj = nodeName; + + for (int involvedDBColumnIndex : involvedDBColumnIndexs) { + involvedDBColumnIndexList.add(involvedDBColumnIndex); + } + } + + public String getNodeName() { + return nodeName; + } + + public int getDBColumnIndex() { + return dbColumnIndex; + } + + public int getInsideColumnIndex1() { + return insideColumnIndex1; + } + + public int getInsideColumnIndex2() { + return insideColumnIndex2; + } + + public List getInvolvedDBColumnIndexList() { + return involvedDBColumnIndexList; + } +} diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/data/GLDataMaker.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/data/GLDataMaker.java new file mode 100644 index 0000000..7d44a48 --- /dev/null +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/data/GLDataMaker.java @@ -0,0 +1,990 @@ +/* + * Dynamic Analyzer + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * 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.opengl.data; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Set; + +import org.tizen.dynamicanalyzer.nl.GLPageLabels; +import org.tizen.dynamicanalyzer.swap.model.probe2.GLES20LogData; +import org.tizen.dynamicanalyzer.ui.opengl.GLConstantMap; +import org.tizen.dynamicanalyzer.ui.opengl.data.model.GLAPIData; +import org.tizen.dynamicanalyzer.ui.opengl.data.model.GLFrameData; +import org.tizen.dynamicanalyzer.ui.opengl.ui.chart.GLElapsedTimeChart; +import org.tizen.dynamicanalyzer.ui.opengl.ui.chart.GLFPSChart; +import org.tizen.dynamicanalyzer.ui.opengl.ui.chart.GLFrameRateChart; +import org.tizen.dynamicanalyzer.ui.opengl.ui.context.GLContextTreeTable; + +public class GLDataMaker { + public static final String DELIMITER = "`,"; + public static final String EMPTY = ""; + private static final String SPACE = " "; + public static final String COMMA = ","; + private static final String ZERO = "0"; + private static final String ONE = "1"; + private static final String FOUR = "4"; + private static final String ENABLED = "Enabled"; + private static final String DISABLED = "Disabled"; + private static final String FALSE = "False"; + private static final String GL_FLOAT = "GL_FLOAT"; + + private static int API_TYPE_INIT = 0; + private static int API_TYPE_CONTEXT = 1; + private static int API_TYPE_NO_CONTEXT = 2; + /* EnableCap */ + private static final String GL_TEXTURE_2D ="de1"; + private static final String GL_CULL_FACE ="b44"; + private static final String GL_BLEND ="be2"; + private static final String GL_DITHER ="bd0"; + private static final String GL_STENCIL_TEST ="b90"; + private static final String GL_DEPTH_TEST ="b71"; + private static final String GL_SCISSOR_TEST ="c11"; + private static final String GL_POLYGON_OFFSET_FILL ="8037"; + private static final String GL_SAMPLE_ALPHA_TO_COVERAGE ="809e"; + private static final String GL_SAMPLE_COVERAGE ="80a0"; + /* CullFaceMode */ + private static final String GL_FRONT ="404"; + private static final String GL_BACK ="405"; + private static final String GL_FRONT_AND_BACK ="408"; + /* Pixel */ + private static final String GL_PACK_ALIGNMENT ="d05"; + private static final String GL_UNPACK_ALIGNMENT ="cf5"; + /* TextureBinding */ + private static final String GL_TEXTURE_CUBE_MAP ="8513"; + /* TextureParameterName */ + private static final String GL_TEXTURE_MAG_FILTER ="2800"; + private static final String GL_TEXTURE_MIN_FILTER ="2801"; + private static final String GL_TEXTURE_WRAP_S ="2802"; + private static final String GL_TEXTURE_WRAP_T ="2803"; + + /* GL APIs */ + private static final String API_GL_BLEND_COLOR = "glBlendColor"; + private static final String API_GL_BLEND_EQ = "glBlendEquation"; + private static final String API_GL_BLEND_EQ_SEP = "glBlendEquationSeparate"; + private static final String API_GL_BLEND_FUNC = "glBlendFunc"; + private static final String API_GL_BLEND_FUNC_SEP = "glBlendFuncSeparate"; + private static final String API_GL_BUFFER_BIND = "glBindBuffer "; + private static final String API_GL_BUFFER_DATA = "glBufferData"; + private static final String API_GL_BUFFER_GEN = "glGenBuffers"; + private static final String API_GL_BUFFER_DEL = "glDeleteBuffers"; + private static final String API_GL_CULLFACE= "glFrontFace"; + private static final String API_GL_DEPTH_FUNC = "glDepthFunc"; + private static final String API_GL_DEPTH_RANGEF = "glDepthRangef"; + public static final String API_GL_DISABLE_VAA = "glDisableVertexAttribArray"; + private static final String API_GL_ENABLE = "glEnable"; + public static final String API_GL_ENABLE_VAA = "glEnableVertexAttribArray"; + private static final String API_GL_FLUSH = "glFlush"; + private static final String API_GL_FRONTFACE = "glFrontFace"; + private static final String API_GL_PIXEL_STOREI = "glPixelStorei"; + private static final String API_GL_POLY_OFFSET = "glPolygonOffset"; + private static final String API_GL_PROGRAM_CREATE = "glCreateProgram"; + private static final String API_GL_PROGRAM_DEL = "glDeleteProgram"; + private static final String API_GL_PROGRAM_LINK = "glLinkProgram"; + private static final String API_GL_PROGRAM_USE = "glUseProgram"; + private static final String API_GL_PROGRAM_ATTACH_SHADER = "glAttachShader"; + private static final String API_GL_PROGRAM_DETATCH_SHADER = "glDetachShader"; + private static final String API_GL_LINEWIDTH = "glLineWidth"; + private static final String API_GL_SCISSOR = "glScissor"; + private static final String API_GL_SHADER_CREATE = "glCreateShader"; + private static final String API_GL_SHADER_DEL = "glDeleteShader"; + private static final String API_GL_SHADER_SOURCE = "glShaderSource"; + private static final String API_GL_STENCIL_FUNC = "glStencilFunc"; + private static final String API_GL_STENCIL_FUNC_SEP = "glStencilFuncSeparate"; + private static final String API_GL_STENCIL_OP = "glStencilOp"; + private static final String API_GL_STENCIL_OP_SEP = "glStencilOpSeparate"; + private static final String API_GL_TEXTURE_BIND = "glBindTexture"; + private static final String API_GL_TEXTURE_ACTIVE = "glActiveTexture"; + private static final String API_GL_TEXTURE_GEN = "glGenTextures"; + private static final String API_GL_TEXTURE_DEL = "glDeleteTextures"; + private static final String API_GL_TEXTURE_PARAM_F = "glTexParameterf"; + private static final String API_GL_TEXTURE_PARAM_FV = "glTexParameterfv"; + private static final String API_GL_TEXTURE_PARAM_I = "glTexParameteri"; + private static final String API_GL_TEXTURE_PARAM_IV = "glTexParameteriv"; + private static final String API_GL_VERTEX_ATTRIB1F = "glVertexAttrib1f"; + private static final String API_GL_VERTEX_ATTRIB2F = "glVertexAttrib2f"; + private static final String API_GL_VERTEX_ATTRIB3F = "glVertexAttrib3f"; + private static final String API_GL_VERTEX_ATTRIB4F = "glVertexAttrib4f"; + private static final String API_GL_VERTEX_ATTRIB1FV = "glVertexAttrib1fv"; + private static final String API_GL_VERTEX_ATTRIB2FV = "glVertexAttrib2fv"; + private static final String API_GL_VERTEX_ATTRIB3FV = "glVertexAttrib3fv"; + private static final String API_GL_VERTEX_ATTRIB4FV = "glVertexAttrib4fv"; + private static final String API_GL_VERTEX_ATTRIB_POINTER = "glVertexAttribPointer"; + private static final String API_GL_VIEWPORT = "glViewport"; + + private static GLDataMaker instance = null; + private static final int CONTEXT_VALUE_SIZE = GLContextDBEnum.values().length; + + private int currentFrameIndex; + private List glFrameDataList; + private CurrentContextValueList currentContextValueList; + private ArrayList> contextValueDBInputList; + + private List gvaV0ValueList; + private List gvaV1ValueList; + private List gvaV2ValueList; + private List gvaV3ValueList; + + private List gvaEnabledValueList; + private List gvaSizeValueList; + private List gvaTypeValueList; + private List gvaNormalValueList; + private List gvaStrideValueList; + private List gvaPointerValueList; + + private LinkedHashMap programIDMap; + private LinkedHashMap programVShaderMap; + private LinkedHashMap programFShaderMap; + private LinkedHashMap> programAttribIndexMap; + private LinkedHashMap> programAttribNameMap; + private LinkedHashMap> programAttribSizeMap; + private LinkedHashMap> programAttribTypeMap; + private LinkedHashMap> programUniformIndexMap; + private LinkedHashMap> programUniformNameMap; + private LinkedHashMap> programUniformSizeMap; + private LinkedHashMap> programUniformTypeMap; + + private LinkedHashMap shaderIDMap; + private LinkedHashMap shaderTypeMap; + private LinkedHashMap shaderSourceMap; + + private String vboBindingArray; + private String vboBindingElementArray; + private LinkedHashMap vboIDMap; + private LinkedHashMap vboSizeMap; + private LinkedHashMap vboDataMap; + private LinkedHashMap vboUsageMap; + + private List textureUnit2dValueList; + private List textureUnitCubeValueList; + private LinkedHashMap textureObjIDMap; + private LinkedHashMap textureObjMagFuncMap; + private LinkedHashMap textureObjMinFuncMap; + private LinkedHashMap textureObjWrapSMap; + private LinkedHashMap textureObjWrapTMap; + + public static GLDataMaker getInstance() { + if (instance == null) { + instance = new GLDataMaker(); + } + + return instance; + } + + private GLDataMaker() { + currentFrameIndex = 0; + glFrameDataList = new ArrayList(); + glFrameDataList.add(new GLFrameData(1)); + + currentContextValueList = new CurrentContextValueList(); + for(int i = 0; i <= CONTEXT_VALUE_SIZE; i++) { + currentContextValueList.add(EMPTY); + } + + contextValueDBInputList = new ArrayList>(); + + gvaV0ValueList = new ArrayList(); + gvaV1ValueList = new ArrayList(); + gvaV2ValueList = new ArrayList(); + gvaV3ValueList = new ArrayList(); + + gvaEnabledValueList = new ArrayList(); + gvaSizeValueList = new ArrayList(); + gvaTypeValueList = new ArrayList(); + gvaNormalValueList = new ArrayList(); + gvaStrideValueList = new ArrayList(); + gvaPointerValueList = new ArrayList(); + programIDMap = new LinkedHashMap(); + programVShaderMap = new LinkedHashMap(); + programFShaderMap = new LinkedHashMap(); + programAttribIndexMap = new LinkedHashMap>(); + programAttribNameMap = new LinkedHashMap>(); + programAttribSizeMap = new LinkedHashMap>(); + programAttribTypeMap = new LinkedHashMap>(); + programUniformIndexMap = new LinkedHashMap>(); + programUniformNameMap = new LinkedHashMap>(); + programUniformSizeMap = new LinkedHashMap>(); + programUniformTypeMap = new LinkedHashMap>(); + shaderIDMap = new LinkedHashMap(); + shaderTypeMap = new LinkedHashMap(); + shaderSourceMap = new LinkedHashMap(); + vboBindingArray = ZERO; + vboBindingElementArray = ZERO; + vboIDMap = new LinkedHashMap(); + vboSizeMap = new LinkedHashMap(); + vboDataMap = new LinkedHashMap(); + vboUsageMap = new LinkedHashMap(); + textureUnit2dValueList = new ArrayList(); + textureUnitCubeValueList = new ArrayList(); + textureObjIDMap = new LinkedHashMap(); + textureObjMagFuncMap = new LinkedHashMap(); + textureObjMinFuncMap = new LinkedHashMap(); + textureObjWrapSMap = new LinkedHashMap(); + textureObjWrapTMap = new LinkedHashMap(); + } + + public void clear() { + currentFrameIndex = 0; + glFrameDataList.clear(); + glFrameDataList.add(new GLFrameData(0)); + + currentContextValueList.clear(); + for(int i = 0; i <= CONTEXT_VALUE_SIZE; i++) { + currentContextValueList.add(EMPTY); + } + + currentContextValueList.set(GLContextDBEnum.VBO_BINDING.ordinal(), "(0/0)"); + + currentContextValueList.set(GLContextDBEnum.VIEWPORT_X.ordinal(), ZERO); + currentContextValueList.set(GLContextDBEnum.VIEWPORT_Y.ordinal(), ZERO); + currentContextValueList.set(GLContextDBEnum.VIEWPORT_W.ordinal(), "?"); + currentContextValueList.set(GLContextDBEnum.VIEWPORT_H.ordinal(), "?"); + + currentContextValueList.set(GLContextDBEnum.DEPTH_RANGE_N.ordinal(), ZERO); + currentContextValueList.set(GLContextDBEnum.DEPTH_RANGE_F.ordinal(), ONE); + + currentContextValueList.set(GLContextDBEnum.LINE_W.ordinal(), "1"); + + currentContextValueList.set(GLContextDBEnum.CULLING_ENABLED.ordinal(), DISABLED); + currentContextValueList.set(GLContextDBEnum.CULLING_ORI.ordinal(), "GL_CCW"); + currentContextValueList.set(GLContextDBEnum.CULLING_MODE.ordinal(), "GL_BACK"); + + currentContextValueList.set(GLContextDBEnum.POLY_ENABLED.ordinal(), DISABLED); + currentContextValueList.set(GLContextDBEnum.POLY_FACTOR.ordinal(), ZERO); + currentContextValueList.set(GLContextDBEnum.POLY_UNITS.ordinal(), ZERO); + + currentContextValueList.set(GLContextDBEnum.SCISSOR_ENABLED.ordinal(), DISABLED); + currentContextValueList.set(GLContextDBEnum.SCISSOR_X.ordinal(), ZERO); + currentContextValueList.set(GLContextDBEnum.SCISSOR_Y.ordinal(), ZERO); + currentContextValueList.set(GLContextDBEnum.SCISSOR_W.ordinal(), "?"); + currentContextValueList.set(GLContextDBEnum.SCISSOR_H.ordinal(), "?"); + + currentContextValueList.set(GLContextDBEnum.STENCIL_ENABLED.ordinal(), DISABLED); + currentContextValueList.set(GLContextDBEnum.STENCIL_FRONT_FUNC.ordinal(), "GL_ALWAYS"); + currentContextValueList.set(GLContextDBEnum.STENCIL_FRONT_REF.ordinal(), "1"); + currentContextValueList.set(GLContextDBEnum.STENCIL_FRONT_MASK.ordinal(), "?"); + currentContextValueList.set(GLContextDBEnum.STENCIL_FRONT_S_FAIL.ordinal(), "GL_KEEP"); + currentContextValueList.set(GLContextDBEnum.STENCIL_FRONT_D_FAIL.ordinal(), "GL_KEEP"); + currentContextValueList.set(GLContextDBEnum.STENCIL_FRONT_D_PASS.ordinal(), "GL_KEEP"); + + currentContextValueList.set(GLContextDBEnum.STENCIL_BACK_FUNC.ordinal(), "GL_ALWAYS"); + currentContextValueList.set(GLContextDBEnum.STENCIL_BACK_REF.ordinal(), "1"); + currentContextValueList.set(GLContextDBEnum.STENCIL_BACK_MASK.ordinal(), "?"); + currentContextValueList.set(GLContextDBEnum.STENCIL_BACK_S_FAIL.ordinal(), "GL_KEEP"); + currentContextValueList.set(GLContextDBEnum.STENCIL_BACK_D_FAIL.ordinal(), "GL_KEEP"); + currentContextValueList.set(GLContextDBEnum.STENCIL_BACK_D_PASS.ordinal(), "GL_KEEP"); + + currentContextValueList.set(GLContextDBEnum.DEPTH_ENABLED.ordinal(), DISABLED); + currentContextValueList.set(GLContextDBEnum.DEPTH_FUNC.ordinal(), "GL_LESS"); + + currentContextValueList.set(GLContextDBEnum.BLEND_ENABLED.ordinal(), DISABLED); + currentContextValueList.set(GLContextDBEnum.BLEND_SRC_RGB.ordinal(), "GL_ONE"); + currentContextValueList.set(GLContextDBEnum.BLEND_SRC_A.ordinal(), "GL_ONE"); + currentContextValueList.set(GLContextDBEnum.BLEND_DEST_RGB.ordinal(), "GL_ZERO"); + currentContextValueList.set(GLContextDBEnum.BLEND_DEST_A.ordinal(), "GL_ZERO"); + currentContextValueList.set(GLContextDBEnum.BLEND_RGB_EQ.ordinal(), "GL_FUNC_ADD"); + currentContextValueList.set(GLContextDBEnum.BLEND_A_EQ.ordinal(), "GL_FUNC_ADD"); + currentContextValueList.set(GLContextDBEnum.BLEND_COLOR.ordinal(), "0,0,0,0"); + + currentContextValueList.set(GLContextDBEnum.DITHER_ENABLED.ordinal(), ENABLED); + + currentContextValueList.set(GLContextDBEnum.PACK_ALIGN.ordinal(), "4"); + currentContextValueList.set(GLContextDBEnum.UNPACK_ALIGN.ordinal(), "4"); + + currentContextValueList.set(GLContextDBEnum.TEXTURE_ACTIVE.ordinal(), "GL_TEXTURE0"); + + + contextValueDBInputList.clear(); + + gvaV0ValueList.clear(); + gvaV1ValueList.clear(); + gvaV2ValueList.clear(); + gvaV3ValueList.clear(); + + gvaEnabledValueList.clear(); + gvaSizeValueList.clear(); + gvaTypeValueList.clear(); + gvaNormalValueList.clear(); + gvaStrideValueList.clear(); + gvaPointerValueList.clear(); + + programIDMap.clear(); + programVShaderMap.clear(); + programFShaderMap.clear(); + programAttribIndexMap.clear(); + programAttribNameMap.clear(); + programAttribSizeMap.clear(); + programAttribTypeMap.clear(); + programUniformIndexMap.clear(); + programUniformNameMap.clear(); + programUniformSizeMap.clear(); + programUniformTypeMap.clear(); + + shaderIDMap.clear(); + shaderTypeMap.clear(); + shaderSourceMap.clear(); + + vboBindingArray = ZERO; + vboBindingElementArray = ZERO; + vboIDMap.clear(); + vboSizeMap.clear(); + vboDataMap.clear(); + vboUsageMap.clear(); + + textureUnit2dValueList.clear(); + textureUnitCubeValueList.clear(); + + textureObjIDMap.clear(); + textureObjMagFuncMap.clear(); + textureObjMinFuncMap.clear(); + textureObjWrapSMap.clear(); + textureObjWrapTMap.clear(); + } + + public void addGLAPIData(GLES20LogData logData) { + // String apiName = log.get(LogCenterConstants.APINAME_INDEX); + + // if (apiName.equals("_SglSwapBuffers")) { + // FrameData currentFrameData = frameDataList.get(currentFrameIndex); + // int frameNumber = currentFrameData.getFrameNumber(); + // + // GLTimeChart.getInstance().addData(frameNumber, + // currentFrameData.getEleapsedTime()); + // + // frameDataList.add(new FrameData(++currentFrameIndex)); + // } else { + int apiType = logData.getApiType(); + String seq = String.valueOf(logData.getSeq()); + String apiName = logData.getApiName(); + String parameter = logData.getArgs(); + long errorNo = logData.getErrno(); + + if (apiType != API_TYPE_INIT) { + glFrameDataList.get(currentFrameIndex).addGLAPIData( + new GLAPIData(logData)); + } + + if(apiType == API_TYPE_INIT) { + String parameters[] = parameter.split(COMMA); + int maxVertexAttribs = Integer.parseInt(parameters[0]); + int maxTextureUnits = Integer.parseInt(parameters[1]); + + /* GVA */ + for(int i = 0; i < maxVertexAttribs; i++) { + gvaV0ValueList.add(ZERO); + gvaV1ValueList.add(ZERO); + gvaV2ValueList.add(ZERO); + gvaV3ValueList.add(ONE); + + gvaEnabledValueList.add(DISABLED); + gvaSizeValueList.add(FOUR); + gvaTypeValueList.add(GL_FLOAT); + gvaNormalValueList.add(FALSE); + gvaStrideValueList.add(ONE); + gvaPointerValueList.add(ZERO); + } + currentContextValueList.set(GLContextDBEnum.GVA_V0.ordinal(), makeSeperatedString(gvaV0ValueList)); + currentContextValueList.set(GLContextDBEnum.GVA_V1.ordinal(), makeSeperatedString(gvaV1ValueList)); + currentContextValueList.set(GLContextDBEnum.GVA_V2.ordinal(), makeSeperatedString(gvaV2ValueList)); + currentContextValueList.set(GLContextDBEnum.GVA_V3.ordinal(), makeSeperatedString(gvaV3ValueList)); + currentContextValueList.set(GLContextDBEnum.GVA_ENABLED.ordinal(), makeSeperatedString(gvaEnabledValueList)); + currentContextValueList.set(GLContextDBEnum.GVA_SIZE.ordinal(), makeSeperatedString(gvaSizeValueList)); + currentContextValueList.set(GLContextDBEnum.GVA_TYPE.ordinal(), makeSeperatedString(gvaTypeValueList)); + currentContextValueList.set(GLContextDBEnum.GVA_NORMAL.ordinal(), makeSeperatedString(gvaNormalValueList)); + currentContextValueList.set(GLContextDBEnum.GVA_STRIDE.ordinal(), makeSeperatedString(gvaStrideValueList)); + currentContextValueList.set(GLContextDBEnum.GVA_POINTER.ordinal(), makeSeperatedString(gvaPointerValueList)); + GLContextTreeTable.getInstance().initGVA(maxVertexAttribs); + + /* texture unit */ + for(int i = 0; i < maxTextureUnits; i++) { + textureUnit2dValueList.add(ZERO); + textureUnitCubeValueList.add(ZERO); + } + currentContextValueList.set(GLContextDBEnum.TEXTURE_UNIT_2D.ordinal(), makeSeperatedString(textureUnit2dValueList)); + currentContextValueList.set(GLContextDBEnum.TEXTURE_UNIT_CUBE.ordinal(), makeSeperatedString(textureUnitCubeValueList)); + GLContextTreeTable.getInstance().initTextureUnit(maxTextureUnits); + } else if (apiType == API_TYPE_CONTEXT && errorNo == 0) { + currentContextValueList.clearSetIndexList(); + int involvedIndex1 = -1; + int involvedIndex2 = -1; + + String parameters[] = parameter.split(COMMA); + String contextValues[] = logData.getContextValue().split(COMMA); + + if (apiName.equals(API_GL_FLUSH)) { + GLFrameData currentFrameData = glFrameDataList.get(currentFrameIndex); + int frameNumber = currentFrameData.getFrameNumber(); + + GLFrameRateChart.getInstance().addData(frameNumber, + currentFrameData.getEleapsedTime(), + currentFrameData.hasError()); + + GLFPSChart.getInstance().addData(frameNumber, + currentFrameData.getEleapsedTime(), + currentFrameData.hasError()); + + GLElapsedTimeChart.getInstance().addData(frameNumber, + currentFrameData.getEleapsedTime(), + currentFrameData.hasError()); + + glFrameDataList.add(new GLFrameData(++currentFrameIndex)); + } else if(apiName.equals(API_GL_BLEND_COLOR)) { + currentContextValueList.set(GLContextDBEnum.BLEND_COLOR.ordinal(), parameters[0]+DELIMITER+parameters[1]+DELIMITER+parameters[2]+DELIMITER+parameters[3]); + } else if(apiName.equals(API_GL_BLEND_EQ)) { + currentContextValueList.set(GLContextDBEnum.BLEND_RGB_EQ.ordinal(), GLConstantMap.getConstantString(parameters[0])); + currentContextValueList.set(GLContextDBEnum.BLEND_A_EQ.ordinal(), GLConstantMap.getConstantString(parameters[0])); + } else if(apiName.equals(API_GL_BLEND_EQ_SEP)) { + currentContextValueList.set(GLContextDBEnum.BLEND_RGB_EQ.ordinal(), GLConstantMap.getConstantString(parameters[0])); + currentContextValueList.set(GLContextDBEnum.BLEND_A_EQ.ordinal(), GLConstantMap.getConstantString(parameters[1])); + } else if(apiName.equals(API_GL_BLEND_FUNC)) { + currentContextValueList.set(GLContextDBEnum.BLEND_SRC_RGB.ordinal(), GLConstantMap.getConstantString(parameters[0])); + currentContextValueList.set(GLContextDBEnum.BLEND_SRC_A.ordinal(), GLConstantMap.getConstantString(parameters[1])); + + currentContextValueList.set(GLContextDBEnum.BLEND_DEST_RGB.ordinal(), GLConstantMap.getConstantString(parameters[0])); + currentContextValueList.set(GLContextDBEnum.BLEND_DEST_A.ordinal(), GLConstantMap.getConstantString(parameters[1])); + } else if(apiName.equals(API_GL_BLEND_FUNC_SEP)) { + currentContextValueList.set(GLContextDBEnum.BLEND_SRC_RGB.ordinal(), GLConstantMap.getConstantString(parameters[0])); + currentContextValueList.set(GLContextDBEnum.BLEND_DEST_RGB.ordinal(), GLConstantMap.getConstantString(parameters[1])); + currentContextValueList.set(GLContextDBEnum.BLEND_SRC_A.ordinal(), GLConstantMap.getConstantString(parameters[2])); + currentContextValueList.set(GLContextDBEnum.BLEND_DEST_A.ordinal(), GLConstantMap.getConstantString(parameters[3])); + } else if(apiName.equals(API_GL_BUFFER_GEN)) { + int num = Integer.parseInt(parameters[0]); + + for (int i = 0; i < num; i++) { + vboIDMap.put(contextValues[i], contextValues[i]); + vboSizeMap.put(contextValues[i], "0"); + vboDataMap.put(contextValues[i], "?"); + vboUsageMap.put(contextValues[i], "GL_STATIC_DRAW"); + } + + currentContextValueList.set(GLContextDBEnum.VBO_ID.ordinal(), makeSeperatedString(vboIDMap)); + currentContextValueList.set(GLContextDBEnum.VBO_SIZE.ordinal(), makeSeperatedString(vboSizeMap)); + currentContextValueList.set(GLContextDBEnum.VBO_Data.ordinal(), makeSeperatedString(vboDataMap)); + currentContextValueList.set(GLContextDBEnum.VBO_Usage.ordinal(), makeSeperatedString(vboUsageMap)); + } else if(apiName.equals(API_GL_BUFFER_DEL)) { + int num = Integer.parseInt(parameters[0]); + + for (int i = 0; i < num; i++) { + vboIDMap.remove(contextValues[i]); + vboSizeMap.remove(contextValues[i]); + vboDataMap.remove(contextValues[i]); + vboUsageMap.remove(contextValues[i]); + } + + currentContextValueList.set(GLContextDBEnum.VBO_ID.ordinal(), makeSeperatedString(vboIDMap)); + currentContextValueList.set(GLContextDBEnum.VBO_SIZE.ordinal(), makeSeperatedString(vboSizeMap)); + currentContextValueList.set(GLContextDBEnum.VBO_Data.ordinal(), makeSeperatedString(vboDataMap)); + currentContextValueList.set(GLContextDBEnum.VBO_Usage.ordinal(), makeSeperatedString(vboUsageMap)); + } else if(apiName.equals(API_GL_BUFFER_BIND)) { + if(GLConstantMap.getConstantString(parameters[0]).equals("GL_ARRAY_BUFFER")) { + vboBindingArray = parameters[1]; + } else { + vboBindingElementArray = parameters[1]; + } + currentContextValueList.set(GLContextDBEnum.VBO_BINDING.ordinal(), vboBindingArray + "/" + vboBindingElementArray); + } else if(apiName.equals(API_GL_BUFFER_DATA)) { + String vboId; + if(GLConstantMap.getConstantString(parameters[0]).equals("GL_ARRAY_BUFFER")) { + vboId = vboBindingArray; + } else { + vboId = vboBindingElementArray; + } + vboSizeMap.put(vboId, parameters[1]); + vboDataMap.put(vboId, "?"); + vboUsageMap.put(vboId, GLConstantMap.getConstantString(parameters[3])); + + currentContextValueList.set(GLContextDBEnum.VBO_ID.ordinal(), makeSeperatedString(vboIDMap)); + currentContextValueList.set(GLContextDBEnum.VBO_SIZE.ordinal(), makeSeperatedString(vboSizeMap)); + currentContextValueList.set(GLContextDBEnum.VBO_Data.ordinal(), makeSeperatedString(vboDataMap)); + currentContextValueList.set(GLContextDBEnum.VBO_Usage.ordinal(), makeSeperatedString(vboUsageMap)); + } else if(apiName.equals(API_GL_CULLFACE)) { + currentContextValueList.set(GLContextDBEnum.CULLING_MODE.ordinal(), parameters[0]); + } else if(apiName.equals(API_GL_DEPTH_FUNC)) { + currentContextValueList.set(GLContextDBEnum.DEPTH_FUNC.ordinal(), GLConstantMap.getConstantString(parameters[0])); + } else if(apiName.equals(API_GL_DEPTH_RANGEF)) { + currentContextValueList.set(GLContextDBEnum.DEPTH_RANGE_N.ordinal(), parameters[0]); + currentContextValueList.set(GLContextDBEnum.DEPTH_RANGE_F.ordinal(), parameters[1]); + } else if(apiName.equals(API_GL_DISABLE_VAA)) { + involvedIndex1 = Integer.parseInt(parameter); + gvaEnabledValueList.set(involvedIndex1, DISABLED); + currentContextValueList.set(GLContextDBEnum.GVA_ENABLED.ordinal(), makeSeperatedString(gvaEnabledValueList)); + } else if(apiName.equals(API_GL_ENABLE)) { + if(parameter.equals(GL_BLEND)) { + currentContextValueList.set(GLContextDBEnum.BLEND_ENABLED.ordinal(), GLPageLabels.GL_CONTEXT_ENABLED); + } else if(parameter.equals(GL_CULL_FACE)) { + currentContextValueList.set(GLContextDBEnum.CULLING_ENABLED.ordinal(), GLPageLabels.GL_CONTEXT_ENABLED); + } else if(parameter.equals(GL_DEPTH_TEST)) { + currentContextValueList.set(GLContextDBEnum.DEPTH_ENABLED.ordinal(), GLPageLabels.GL_CONTEXT_ENABLED); + } else if(parameter.equals(GL_DITHER)) { + currentContextValueList.set(GLContextDBEnum.DITHER_ENABLED.ordinal(), GLPageLabels.GL_CONTEXT_ENABLED); + } else if(parameter.equals(GL_POLYGON_OFFSET_FILL)) { + currentContextValueList.set(GLContextDBEnum.POLY_ENABLED.ordinal(), GLPageLabels.GL_CONTEXT_ENABLED); + } else if(parameter.equals(GL_SCISSOR_TEST)) { + currentContextValueList.set(GLContextDBEnum.SCISSOR_ENABLED.ordinal(), GLPageLabels.GL_CONTEXT_ENABLED); + } else if(parameter.equals(GL_STENCIL_TEST)) { + currentContextValueList.set(GLContextDBEnum.STENCIL_ENABLED.ordinal(), GLPageLabels.GL_CONTEXT_ENABLED); + } + } else if(apiName.equals(API_GL_ENABLE_VAA)) { + involvedIndex1 = Integer.parseInt(parameter); + gvaEnabledValueList.set(involvedIndex1, ENABLED); + currentContextValueList.set(GLContextDBEnum.GVA_ENABLED.ordinal(), makeSeperatedString(gvaEnabledValueList)); + } else if(apiName.equals(API_GL_FRONTFACE)) { + currentContextValueList.set(GLContextDBEnum.CULLING_ORI.ordinal(), GLConstantMap.getConstantString(parameters[0])); + } else if(apiName.equals(API_GL_LINEWIDTH)) { + currentContextValueList.set(GLContextDBEnum.LINE_W.ordinal(), parameters[0]); + } else if(apiName.equals(API_GL_PIXEL_STOREI)) { + if(parameters[0].equals(GL_PACK_ALIGNMENT)) { + currentContextValueList.set(GLContextDBEnum.PACK_ALIGN.ordinal(), GLConstantMap.getConstantString(parameters[1])); + } else if(parameters[0].equals(GL_UNPACK_ALIGNMENT)) { + currentContextValueList.set(GLContextDBEnum.UNPACK_ALIGN.ordinal(), GLConstantMap.getConstantString(parameters[1])); + } + } else if(apiName.equals(API_GL_PROGRAM_CREATE)) { + String programID = String.valueOf(logData.getReturn()); + programIDMap.put(programID, programID); + programVShaderMap.put(programID, EMPTY); + programFShaderMap.put(programID, EMPTY); + + involvedIndex1 = programIDMap.size() - 1; + currentContextValueList.set(GLContextDBEnum.PROGRAM_OBJ_ID.ordinal(), makeSeperatedString(programIDMap)); + currentContextValueList.set(GLContextDBEnum.PROGRAM_OBJ_V_SHADER.ordinal(), makeSeperatedString(programVShaderMap)); + currentContextValueList.set(GLContextDBEnum.PROGRAM_OBJ_F_SHADER.ordinal(), makeSeperatedString(programFShaderMap)); + } else if(apiName.equals(API_GL_PROGRAM_DEL)) { + programIDMap.remove(parameter); + programVShaderMap.remove(parameter); + programFShaderMap.remove(parameter); + + currentContextValueList.set(GLContextDBEnum.PROGRAM_OBJ_ID.ordinal(), makeSeperatedString(programIDMap)); + currentContextValueList.set(GLContextDBEnum.PROGRAM_OBJ_V_SHADER.ordinal(), makeSeperatedString(programVShaderMap)); + currentContextValueList.set(GLContextDBEnum.PROGRAM_OBJ_F_SHADER.ordinal(), makeSeperatedString(programFShaderMap)); + } else if (apiName.equals(API_GL_PROGRAM_LINK)) { + String programID = parameter; + int contextValueIndex = 0; + if (contextValues.length > 0) { + int attribNum = Integer.parseInt(contextValues[contextValueIndex++]); + for (int i = 0; i < attribNum; i++) { + String index = contextValues[contextValueIndex++]; + String name = contextValues[contextValueIndex++]; + String size = contextValues[contextValueIndex++]; + String type = GLConstantMap + .getConstantString(contextValues[contextValueIndex++]); + + putMapValue(programAttribIndexMap, programID, index, index); + putMapValue(programAttribNameMap, programID, name, index); + putMapValue(programAttribSizeMap, programID, size, index); + putMapValue(programAttribTypeMap, programID, type, index); + } + + involvedIndex1 = getIndexByKey(programIDMap, programID); + currentContextValueList.set(GLContextDBEnum.PROGRAM_ATTRIB_INDEX.ordinal(), makeSeperatedString2(programAttribIndexMap)); + currentContextValueList.set(GLContextDBEnum.PROGRAM_ATTRIB_NAME.ordinal(), makeSeperatedString2(programAttribNameMap)); + currentContextValueList.set(GLContextDBEnum.PROGRAM_ATTRIB_SIZE.ordinal(), makeSeperatedString2(programAttribSizeMap)); + currentContextValueList.set(GLContextDBEnum.PROGRAM_ATTRIB_TYPE.ordinal(), makeSeperatedString2(programAttribTypeMap)); + } + + if (contextValues.length > 0) { + int uniformNum = Integer.parseInt(contextValues[contextValueIndex++]); + for (int i = 0; i < uniformNum; i++) { + String index = contextValues[contextValueIndex++]; + String name = contextValues[contextValueIndex++]; + String size = contextValues[contextValueIndex++]; + String type = GLConstantMap + .getConstantString(contextValues[contextValueIndex++]); + + putMapValue(programUniformIndexMap, programID, index, index); + putMapValue(programUniformNameMap, programID, name, index); + putMapValue(programUniformSizeMap, programID, size, index); + putMapValue(programUniformTypeMap, programID, type, index); + } + + involvedIndex1 = getIndexByKey(programIDMap, programID); + currentContextValueList.set(GLContextDBEnum.PROGRAM_UNIFORM_INDEX.ordinal(), makeSeperatedString2(programUniformIndexMap)); + currentContextValueList.set(GLContextDBEnum.PROGRAM_UNIFORM_NAME.ordinal(), makeSeperatedString2(programUniformNameMap)); + currentContextValueList.set(GLContextDBEnum.PROGRAM_UNIFORM_SIZE.ordinal(), makeSeperatedString2(programUniformSizeMap)); + currentContextValueList.set(GLContextDBEnum.PROGRAM_UNIFORM_TYPE.ordinal(), makeSeperatedString2(programUniformTypeMap)); + } + } else if(apiName.equals(API_GL_PROGRAM_USE)) { + currentContextValueList.set(GLContextDBEnum.PROGRAM_OBJ_CURRENT.ordinal(), parameter); + } else if(apiName.equals(API_GL_PROGRAM_ATTACH_SHADER)) { + String programID = parameters[0]; + String shaderID = parameters[1]; + involvedIndex1 = getIndexByKey(programIDMap, programID); + + if(shaderTypeMap.get(shaderID).equals("GL_VERTEX_SHADER")) { + programVShaderMap.put(programID, shaderID); + currentContextValueList.set(GLContextDBEnum.PROGRAM_OBJ_V_SHADER.ordinal(), makeSeperatedString(programVShaderMap)); + } else if (shaderTypeMap.get(shaderID).equals("GL_FRAGMENT_SHADER")) { + programFShaderMap.put(programID, shaderID); + currentContextValueList.set(GLContextDBEnum.PROGRAM_OBJ_F_SHADER.ordinal(), makeSeperatedString(programFShaderMap)); + } + } else if (apiName.equals(API_GL_PROGRAM_DETATCH_SHADER)) { + String programID = parameters[0]; + String shaderID = parameters[1]; + involvedIndex1 = getIndexByKey(programIDMap, programID); + + if (programVShaderMap.get(programID).equals(shaderID)) { + programVShaderMap.put(programID, EMPTY); + currentContextValueList.set(GLContextDBEnum.PROGRAM_OBJ_V_SHADER.ordinal(), makeSeperatedString(programVShaderMap)); + } else if (programFShaderMap.get(programID).equals(shaderID)) { + programFShaderMap.put(programID, EMPTY); + currentContextValueList.set(GLContextDBEnum.PROGRAM_OBJ_F_SHADER.ordinal(), makeSeperatedString(programFShaderMap)); + } + } else if (apiName.equals(API_GL_POLY_OFFSET)) { + currentContextValueList.set(GLContextDBEnum.POLY_FACTOR.ordinal(), parameters[0]); + currentContextValueList.set(GLContextDBEnum.POLY_UNITS.ordinal(), parameters[1]); + } else if(apiName.equals(API_GL_SCISSOR)) { + currentContextValueList.set(GLContextDBEnum.SCISSOR_X.ordinal(), parameters[0]); + currentContextValueList.set(GLContextDBEnum.SCISSOR_Y.ordinal(), parameters[1]); + currentContextValueList.set(GLContextDBEnum.SCISSOR_W.ordinal(), parameters[2]); + currentContextValueList.set(GLContextDBEnum.SCISSOR_H.ordinal(), parameters[3]); + } else if(apiName.equals(API_GL_SHADER_CREATE)) { + String shaderID = String.valueOf(logData.getReturn()); + shaderIDMap.put(shaderID, shaderID); + shaderTypeMap.put(shaderID, GLConstantMap.getConstantString(parameter)); + shaderSourceMap.put(shaderID, SPACE); + involvedIndex1 = shaderIDMap.size() - 1; + + currentContextValueList.set(GLContextDBEnum.SHADER_OBJ_ID.ordinal(), makeSeperatedString(shaderIDMap)); + currentContextValueList.set(GLContextDBEnum.SHADER_TYPE.ordinal(), makeSeperatedString(shaderTypeMap)); + currentContextValueList.originalSet(GLContextDBEnum.SHADER_SRC.ordinal(), makeSeperatedString(shaderSourceMap)); + } else if(apiName.equals(API_GL_SHADER_DEL)) { + shaderIDMap.remove(parameter); + shaderTypeMap.remove(parameter); + shaderSourceMap.remove(parameter); + + currentContextValueList.set(GLContextDBEnum.SHADER_OBJ_ID.ordinal(), makeSeperatedString(shaderIDMap)); + currentContextValueList.set(GLContextDBEnum.SHADER_TYPE.ordinal(), makeSeperatedString(shaderTypeMap)); + currentContextValueList.set(GLContextDBEnum.SHADER_SRC.ordinal(), makeSeperatedString(shaderSourceMap)); + } else if(apiName.equals(API_GL_SHADER_SOURCE)) { + shaderSourceMap.put(parameters[0], logData.getContextValue()); + + int i = 0; + for (String shaderID : shaderIDMap.values()) { + if (shaderID.equals(parameters[0])) { + involvedIndex1 = i; + break; + } + i++; + } + currentContextValueList.set(GLContextDBEnum.SHADER_SRC.ordinal(), makeSeperatedString(shaderSourceMap)); + } else if(apiName.equals(API_GL_STENCIL_FUNC)) { + currentContextValueList.set(GLContextDBEnum.STENCIL_FRONT_FUNC.ordinal(), GLConstantMap.getConstantString(parameters[0])); + currentContextValueList.set(GLContextDBEnum.STENCIL_FRONT_REF.ordinal(), parameters[1]); + currentContextValueList.set(GLContextDBEnum.STENCIL_FRONT_MASK.ordinal(), parameters[2]); + + currentContextValueList.set(GLContextDBEnum.STENCIL_BACK_FUNC.ordinal(), GLConstantMap.getConstantString(parameters[0])); + currentContextValueList.set(GLContextDBEnum.STENCIL_BACK_REF.ordinal(), parameters[1]); + currentContextValueList.set(GLContextDBEnum.STENCIL_BACK_MASK.ordinal(), parameters[2]); + } else if(apiName.equals(API_GL_STENCIL_FUNC_SEP)) { + if(parameters[0].equals(GL_FRONT)) { + currentContextValueList.set(GLContextDBEnum.STENCIL_FRONT_FUNC.ordinal(), GLConstantMap.getConstantString(parameters[0])); + currentContextValueList.set(GLContextDBEnum.STENCIL_FRONT_REF.ordinal(), parameters[1]); + currentContextValueList.set(GLContextDBEnum.STENCIL_FRONT_MASK.ordinal(), parameters[2]); + } else if(parameters[0].equals(GL_BACK)) { + currentContextValueList.set(GLContextDBEnum.STENCIL_BACK_FUNC.ordinal(), GLConstantMap.getConstantString(parameters[0])); + currentContextValueList.set(GLContextDBEnum.STENCIL_BACK_REF.ordinal(), parameters[1]); + currentContextValueList.set(GLContextDBEnum.STENCIL_BACK_MASK.ordinal(), parameters[2]); + } else if(parameters[0].equals(GL_FRONT_AND_BACK)) { + currentContextValueList.set(GLContextDBEnum.STENCIL_FRONT_FUNC.ordinal(), GLConstantMap.getConstantString(parameters[0])); + currentContextValueList.set(GLContextDBEnum.STENCIL_FRONT_REF.ordinal(), parameters[1]); + currentContextValueList.set(GLContextDBEnum.STENCIL_FRONT_MASK.ordinal(), parameters[2]); + + currentContextValueList.set(GLContextDBEnum.STENCIL_BACK_FUNC.ordinal(), GLConstantMap.getConstantString(parameters[0])); + currentContextValueList.set(GLContextDBEnum.STENCIL_BACK_REF.ordinal(), parameters[1]); + currentContextValueList.set(GLContextDBEnum.STENCIL_BACK_MASK.ordinal(), parameters[2]); + } + } else if(apiName.equals(API_GL_STENCIL_OP)) { + currentContextValueList.set(GLContextDBEnum.STENCIL_FRONT_S_FAIL.ordinal(), GLConstantMap.getConstantString(parameters[0])); + currentContextValueList.set(GLContextDBEnum.STENCIL_FRONT_D_FAIL.ordinal(), GLConstantMap.getConstantString(parameters[1])); + currentContextValueList.set(GLContextDBEnum.STENCIL_FRONT_D_PASS.ordinal(), GLConstantMap.getConstantString(parameters[2])); + + currentContextValueList.set(GLContextDBEnum.STENCIL_BACK_S_FAIL.ordinal(), GLConstantMap.getConstantString(parameters[0])); + currentContextValueList.set(GLContextDBEnum.STENCIL_BACK_D_FAIL.ordinal(), GLConstantMap.getConstantString(parameters[1])); + currentContextValueList.set(GLContextDBEnum.STENCIL_BACK_D_PASS.ordinal(), GLConstantMap.getConstantString(parameters[2])); + } else if(apiName.equals(API_GL_STENCIL_OP_SEP)) { + if(apiName.equals(GL_FRONT)) { + currentContextValueList.set(GLContextDBEnum.STENCIL_FRONT_S_FAIL.ordinal(), GLConstantMap.getConstantString(parameters[0])); + currentContextValueList.set(GLContextDBEnum.STENCIL_FRONT_D_FAIL.ordinal(), GLConstantMap.getConstantString(parameters[1])); + currentContextValueList.set(GLContextDBEnum.STENCIL_FRONT_D_PASS.ordinal(), GLConstantMap.getConstantString(parameters[2])); + } else if(apiName.equals(GL_BACK)) { + currentContextValueList.set(GLContextDBEnum.STENCIL_BACK_S_FAIL.ordinal(), GLConstantMap.getConstantString(parameters[0])); + currentContextValueList.set(GLContextDBEnum.STENCIL_BACK_D_FAIL.ordinal(), GLConstantMap.getConstantString(parameters[1])); + currentContextValueList.set(GLContextDBEnum.STENCIL_BACK_D_PASS.ordinal(), GLConstantMap.getConstantString(parameters[2])); + } else if(apiName.equals(GL_FRONT_AND_BACK)) { + currentContextValueList.set(GLContextDBEnum.STENCIL_FRONT_S_FAIL.ordinal(), GLConstantMap.getConstantString(parameters[0])); + currentContextValueList.set(GLContextDBEnum.STENCIL_FRONT_D_FAIL.ordinal(), GLConstantMap.getConstantString(parameters[1])); + currentContextValueList.set(GLContextDBEnum.STENCIL_FRONT_D_PASS.ordinal(), GLConstantMap.getConstantString(parameters[2])); + + currentContextValueList.set(GLContextDBEnum.STENCIL_BACK_S_FAIL.ordinal(), GLConstantMap.getConstantString(parameters[0])); + currentContextValueList.set(GLContextDBEnum.STENCIL_BACK_D_FAIL.ordinal(), GLConstantMap.getConstantString(parameters[1])); + currentContextValueList.set(GLContextDBEnum.STENCIL_BACK_D_PASS.ordinal(), GLConstantMap.getConstantString(parameters[2])); + } + } else if(apiName.equals(API_GL_TEXTURE_ACTIVE)) { + currentContextValueList.set(GLContextDBEnum.TEXTURE_ACTIVE.ordinal(), GLConstantMap.getConstantString(parameters[0])); + } else if (apiName.equals(API_GL_TEXTURE_BIND)) { + int activeTextureUnit = Integer.parseInt( + currentContextValueList.get(GLContextDBEnum.TEXTURE_ACTIVE.ordinal()).split("GL_TEXTURE")[1]); + involvedIndex1 = activeTextureUnit; + if (parameters[0].equals(GL_TEXTURE_2D)) { + textureUnit2dValueList.set(activeTextureUnit, parameters[1]); + currentContextValueList.set(GLContextDBEnum.TEXTURE_UNIT_2D.ordinal(), makeSeperatedString(textureUnit2dValueList)); + } else if (parameters[0].equals(GL_TEXTURE_CUBE_MAP)) { + textureUnitCubeValueList.set(activeTextureUnit, parameters[1]); + currentContextValueList.set(GLContextDBEnum.TEXTURE_UNIT_CUBE.ordinal(), makeSeperatedString(textureUnitCubeValueList)); + } + } else if(apiName.equals(API_GL_TEXTURE_GEN)) { + int num = Integer.parseInt(parameters[0]); + + for (int i = 0; i < num; i++) { + textureObjIDMap.put(contextValues[i], contextValues[i]); + textureObjMagFuncMap.put(contextValues[i], "GL_LINEAR"); + textureObjMinFuncMap.put(contextValues[i], "GL_NEAREST_MIPMAP_LINEAR"); + textureObjWrapSMap.put(contextValues[i], "GL_REPEAT"); + textureObjWrapTMap.put(contextValues[i], "GL_REPEAT"); + } + + currentContextValueList.set(GLContextDBEnum.TEXTURE_OBJ_ID.ordinal(), makeSeperatedString(textureObjIDMap)); + currentContextValueList.set(GLContextDBEnum.TEXTURE_OBJ_MAG_FUNC.ordinal(), makeSeperatedString(textureObjMagFuncMap)); + currentContextValueList.set(GLContextDBEnum.TEXTURE_OBJ_MIN_FUNC.ordinal(), makeSeperatedString(textureObjMinFuncMap)); + currentContextValueList.set(GLContextDBEnum.TEXTURE_OBJ_WRAP_S.ordinal(), makeSeperatedString(textureObjWrapSMap)); + currentContextValueList.set(GLContextDBEnum.TEXTURE_OBJ_WRAP_T.ordinal(), makeSeperatedString(textureObjWrapTMap)); + } else if(apiName.equals(API_GL_TEXTURE_DEL)) { + int num = Integer.parseInt(parameters[0]); + + for (int i = 0; i < num; i++) { + textureObjIDMap.remove(contextValues[i]); + textureObjMagFuncMap.remove(contextValues[i]); + textureObjMinFuncMap.remove(contextValues[i]); + textureObjWrapSMap.remove(contextValues[i]); + textureObjWrapTMap.remove(contextValues[i]); + } + + currentContextValueList.set(GLContextDBEnum.TEXTURE_OBJ_ID.ordinal(), makeSeperatedString(textureObjIDMap)); + currentContextValueList.set(GLContextDBEnum.TEXTURE_OBJ_MAG_FUNC.ordinal(), makeSeperatedString(textureObjMagFuncMap)); + currentContextValueList.set(GLContextDBEnum.TEXTURE_OBJ_MIN_FUNC.ordinal(), makeSeperatedString(textureObjMinFuncMap)); + currentContextValueList.set(GLContextDBEnum.TEXTURE_OBJ_WRAP_S.ordinal(), makeSeperatedString(textureObjWrapSMap)); + currentContextValueList.set(GLContextDBEnum.TEXTURE_OBJ_WRAP_T.ordinal(), makeSeperatedString(textureObjWrapTMap)); + } else if(apiName.equals(API_GL_TEXTURE_PARAM_F) || + apiName.equals(API_GL_TEXTURE_PARAM_I)) { + String textureObjID; + int activeTextureUnit = Integer.parseInt( + currentContextValueList.get(GLContextDBEnum.TEXTURE_ACTIVE.ordinal()).split("GL_TEXTURE")[1]); + if(parameters[0].equals(GL_TEXTURE_2D)) { + textureObjID = textureUnit2dValueList.get(activeTextureUnit); + } else { + textureObjID = textureUnitCubeValueList.get(activeTextureUnit); + } + + involvedIndex1 = getIndexByKey(textureObjIDMap, textureObjID); + + if(parameters[1].equals(GL_TEXTURE_MAG_FILTER)) { + textureObjMagFuncMap.put(textureObjID, GLConstantMap.getConstantString(parameters[2])); + currentContextValueList.set(GLContextDBEnum.TEXTURE_OBJ_MAG_FUNC.ordinal(), makeSeperatedString(textureObjMagFuncMap)); + } else if (parameters[1].equals(GL_TEXTURE_MIN_FILTER)) { + textureObjMinFuncMap.put(textureObjID, GLConstantMap.getConstantString(parameters[2])); + currentContextValueList.set(GLContextDBEnum.TEXTURE_OBJ_MIN_FUNC.ordinal(), makeSeperatedString(textureObjMinFuncMap)); + } else if (parameters[1].equals(GL_TEXTURE_WRAP_S)) { + textureObjWrapSMap.put(textureObjID, GLConstantMap.getConstantString(parameters[2])); + currentContextValueList.set(GLContextDBEnum.TEXTURE_OBJ_WRAP_S.ordinal(), makeSeperatedString(textureObjWrapSMap)); + } else if (parameters[1].equals(GL_TEXTURE_WRAP_T)) { + textureObjWrapTMap.put(textureObjID, GLConstantMap.getConstantString(parameters[2])); + currentContextValueList.set(GLContextDBEnum.TEXTURE_OBJ_WRAP_T.ordinal(), makeSeperatedString(textureObjWrapTMap)); + } + } else if(apiName.equals(API_GL_TEXTURE_PARAM_FV) || + apiName.equals(API_GL_TEXTURE_PARAM_IV)) { + //TODO + String textureObjID; + int activeTextureUnit = Integer.parseInt( + currentContextValueList.get(GLContextDBEnum.TEXTURE_ACTIVE.ordinal()).split("GL_TEXTURE")[1]); + if(parameters[0].equals(GL_TEXTURE_2D)) { + textureObjID = textureUnit2dValueList.get(activeTextureUnit); + } else { + textureObjID = textureUnitCubeValueList.get(activeTextureUnit); + } + + involvedIndex1 = getIndexByKey(textureObjIDMap, textureObjID); + + if(parameters[1].equals(GL_TEXTURE_MAG_FILTER)) { + textureObjMagFuncMap.put(textureObjID, GLConstantMap.getConstantString(contextValues[0])); + currentContextValueList.set(GLContextDBEnum.TEXTURE_OBJ_MAG_FUNC.ordinal(), makeSeperatedString(textureObjMagFuncMap)); + } else if (parameters[1].equals(GL_TEXTURE_MIN_FILTER)) { + textureObjMinFuncMap.put(textureObjID, GLConstantMap.getConstantString(contextValues[0])); + currentContextValueList.set(GLContextDBEnum.TEXTURE_OBJ_MIN_FUNC.ordinal(), makeSeperatedString(textureObjMinFuncMap)); + } else if (parameters[1].equals(GL_TEXTURE_WRAP_S)) { + textureObjWrapSMap.put(textureObjID, GLConstantMap.getConstantString(contextValues[0])); + currentContextValueList.set(GLContextDBEnum.TEXTURE_OBJ_WRAP_S.ordinal(), makeSeperatedString(textureObjWrapSMap)); + } else if (parameters[1].equals(GL_TEXTURE_WRAP_T)) { + textureObjWrapTMap.put(textureObjID, GLConstantMap.getConstantString(contextValues[0])); + currentContextValueList.set(GLContextDBEnum.TEXTURE_OBJ_WRAP_T.ordinal(), makeSeperatedString(textureObjWrapTMap)); + } + } else if(apiName.equals(API_GL_VERTEX_ATTRIB1F) || + apiName.equals(API_GL_VERTEX_ATTRIB2F) || + apiName.equals(API_GL_VERTEX_ATTRIB3F) || + apiName.equals(API_GL_VERTEX_ATTRIB4F) || + apiName.equals(API_GL_VERTEX_ATTRIB1FV) || + apiName.equals(API_GL_VERTEX_ATTRIB2FV) || + apiName.equals(API_GL_VERTEX_ATTRIB3FV) || + apiName.equals(API_GL_VERTEX_ATTRIB4FV)) { + // TODO IndexOutOfBoundsException + involvedIndex1 = Integer.parseInt(parameters[0]); + gvaV0ValueList.set(involvedIndex1, contextValues[0]); + gvaV1ValueList.set(involvedIndex1, contextValues[1]); + gvaV2ValueList.set(involvedIndex1, contextValues[2]); + gvaV3ValueList.set(involvedIndex1, contextValues[3]); + currentContextValueList.set(GLContextDBEnum.GVA_V0.ordinal(), makeSeperatedString(gvaV0ValueList)); + currentContextValueList.set(GLContextDBEnum.GVA_V1.ordinal(), makeSeperatedString(gvaV1ValueList)); + currentContextValueList.set(GLContextDBEnum.GVA_V2.ordinal(), makeSeperatedString(gvaV2ValueList)); + currentContextValueList.set(GLContextDBEnum.GVA_V3.ordinal(), makeSeperatedString(gvaV3ValueList)); + } else if(apiName.equals(API_GL_VERTEX_ATTRIB_POINTER)) { + involvedIndex1 = Integer.parseInt(parameters[0]); + gvaSizeValueList.set(involvedIndex1, parameters[1]); + gvaTypeValueList.set(involvedIndex1, GLConstantMap.getConstantString(parameters[2])); + gvaNormalValueList.set(involvedIndex1, parameters[3]); + gvaStrideValueList.set(involvedIndex1, parameters[4]); + gvaPointerValueList.set(involvedIndex1, parameters[5]); + currentContextValueList.set(GLContextDBEnum.GVA_SIZE.ordinal(), makeSeperatedString(gvaSizeValueList)); + currentContextValueList.set(GLContextDBEnum.GVA_TYPE.ordinal(), makeSeperatedString(gvaTypeValueList)); + currentContextValueList.set(GLContextDBEnum.GVA_NORMAL.ordinal(), makeSeperatedString(gvaNormalValueList)); + currentContextValueList.set(GLContextDBEnum.GVA_STRIDE.ordinal(), makeSeperatedString(gvaStrideValueList)); + currentContextValueList.set(GLContextDBEnum.GVA_POINTER.ordinal(), makeSeperatedString(gvaPointerValueList)); + } else if(apiName.equals(API_GL_VIEWPORT)) { + currentContextValueList.set(GLContextDBEnum.VIEWPORT_X.ordinal(), parameters[0]); + currentContextValueList.set(GLContextDBEnum.VIEWPORT_Y.ordinal(), parameters[1]); + currentContextValueList.set(GLContextDBEnum.VIEWPORT_W.ordinal(), parameters[2]); + currentContextValueList.set(GLContextDBEnum.VIEWPORT_H.ordinal(), parameters[3]); + } + + currentContextValueList.set(GLContextDBEnum.INVOLVED_ORDINAL.ordinal(), makeSeperatedString(currentContextValueList.getSetIndexList())); + currentContextValueList.set(GLContextDBEnum.INVOLVED_INDEX1.ordinal(), String.valueOf(involvedIndex1)); + currentContextValueList.set(GLContextDBEnum.INVOLVED_INDEX2.ordinal(), String.valueOf(involvedIndex2)); + } else { + currentContextValueList.set(GLContextDBEnum.INVOLVED_ORDINAL.ordinal(), EMPTY); + currentContextValueList.set(GLContextDBEnum.INVOLVED_INDEX1.ordinal(), EMPTY); + currentContextValueList.set(GLContextDBEnum.INVOLVED_INDEX2.ordinal(), EMPTY); + } + + currentContextValueList.set(CONTEXT_VALUE_SIZE, seq); + currentContextValueList.set(GLContextDBEnum.FRAME_INDEX.ordinal(), String.valueOf(currentFrameIndex)); + contextValueDBInputList.add((List)currentContextValueList.clone()); + } + + public GLFrameData getFrameData(int index) { + return glFrameDataList.get(index); + } + + public int getFrameSize() { + return glFrameDataList.size(); + } + + public List> getContextValueDAInputListAndClear() { + List> ret = (List>) contextValueDBInputList + .clone(); + contextValueDBInputList.clear(); + + return ret; + } + + private String makeSeperatedString(List list) { + if (list.size() == 0) { + return EMPTY; + } + + StringBuilder sb = new StringBuilder(); + for (String string : list) { + sb.append(string); + sb.append(DELIMITER); + } + + sb.deleteCharAt(sb.length() - 1); + sb.deleteCharAt(sb.length() - 1); + return sb.toString(); + } + + private String makeSeperatedString2( + LinkedHashMap> map) { + if (map.size() == 0) { + return EMPTY; + } + + StringBuilder sb = new StringBuilder(); + for (LinkedHashMap mapValue : map.values()) { + for (String string : mapValue.values()) { + sb.append(string); + sb.append(COMMA); + } + sb.append(DELIMITER); + } + + sb.deleteCharAt(sb.length() - 1); + sb.deleteCharAt(sb.length() - 1); + sb.deleteCharAt(sb.length() - 1); + return sb.toString(); + } + + private String makeSeperatedString(LinkedHashMap map) { + if (map.size() == 0) { + return EMPTY; + } + + StringBuilder sb = new StringBuilder(); + for (String string : map.values()) { + sb.append(string); + sb.append(DELIMITER); + } + + sb.deleteCharAt(sb.length() - 1); + sb.deleteCharAt(sb.length() - 1); + return sb.toString(); + } + + private int getIndexByKey(LinkedHashMap map, + String key) { + Set keySet = map.keySet(); + Iterator iter = keySet.iterator(); + int i = -1; + + while(iter.hasNext()) { + i++; + if(iter.next().equals(key)) { + return i; + } + } + + return -1; + } + + private void putMapValue( + LinkedHashMap> map, + String key, String value, String index) { + if (map.get(key) == null) { + map.put(key, new LinkedHashMap()); + } + + map.get(key).put(index, value); + } +} diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/data/GLSelectionData.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/data/GLSelectionData.java new file mode 100644 index 0000000..751d25a --- /dev/null +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/data/GLSelectionData.java @@ -0,0 +1,18 @@ +package org.tizen.dynamicanalyzer.ui.opengl.data; + +import org.eclipse.swt.widgets.Control; +import org.tizen.dynamicanalyzer.common.DASelectionData; + +public class GLSelectionData extends DASelectionData { + private int frameIndex; + + public GLSelectionData(String id, long start, long end, Object data, + Control ctrl, int frameIndex) { + super(id, start, end, data, ctrl); + this.frameIndex = frameIndex; + } + + public int getFrameIndex() { + return frameIndex; + } +} diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/data/inserter/GLContextDataInserter.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/data/inserter/GLContextDataInserter.java new file mode 100644 index 0000000..aac4463 --- /dev/null +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/data/inserter/GLContextDataInserter.java @@ -0,0 +1,93 @@ +/* + * Dynamic Analyzer + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * 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.opengl.data.inserter; + +import java.util.List; + +import org.tizen.dynamicanalyzer.common.AnalyzerManager; +import org.tizen.dynamicanalyzer.sql.DBTableManager; +import org.tizen.dynamicanalyzer.sql.SqlManager; + +public class GLContextDataInserter implements Runnable { + private static GLContextDataQueue contextDatasQueue = new GLContextDataQueue(); + private static volatile Thread inserterThread = null; + + public static void startinserterThread() { + if (inserterThread == null || !inserterThread.isAlive()) { + synchronized (GLContextDataInserter.class) { + if (inserterThread == null || !inserterThread.isAlive()) { + inserterThread = new Thread(null, + new GLContextDataInserter()); + inserterThread.start(); + } + } + } + } + + public static void stopinserterThread() { + if (inserterThread != null && inserterThread.isAlive()) { + try { + sendNotify(); + inserterThread.join(AnalyzerManager.THREAD_JOIN_WAIT_TIME); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + } + + public static GLContextDataQueue getContextDataQueue() { + return contextDatasQueue; + } + + public static void clear() { + stopinserterThread(); + } + + @Override + public void run() { + while (!AnalyzerManager.isExit()) { + List> contextDatas = contextDatasQueue + .getFirstContextDatas(); + + SqlManager + .getInstance() + .insertQuery( + DBTableManager + .getInstance() + .getTableInfo( + DBTableManager.TABLE_INDEX_GLES20_CONTEXT_DATA) + .insertQuery(), contextDatas); + } + } + + public static void sendNotify() { + GLContextDataQueue contextDataQueue = getContextDataQueue(); + synchronized (contextDataQueue) { + contextDataQueue.notifyAll(); + } + } +} diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/data/inserter/GLContextDataQueue.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/data/inserter/GLContextDataQueue.java new file mode 100644 index 0000000..ba7ed7b --- /dev/null +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/data/inserter/GLContextDataQueue.java @@ -0,0 +1,84 @@ +/* + * Dynamic Analyzer + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * 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.opengl.data.inserter; + +import java.util.ArrayList; +import java.util.List; + +public class GLContextDataQueue { + private static final int FULL_COUNT = 300; + private List>> contextDatasList; + + public GLContextDataQueue() { + contextDatasList = new ArrayList>>(); + } + + public synchronized List> getFirstContextDatas() { + while (isEmpty()) { + try { + wait(); + } catch (InterruptedException e) { + e.printStackTrace(); + break; + } + } + + List> contextDatas = contextDatasList.get(0); + contextDatasList.remove(0); + notifyAll(); + + return contextDatas; + } + + public synchronized void push(List> contextDatas) { + while (isFull()) { + try { + wait(); + } catch (InterruptedException e) { + e.printStackTrace(); + break; + } + } + contextDatasList.add(contextDatas); + notifyAll(); + } + + private boolean isEmpty() { + return contextDatasList.isEmpty(); + } + + private boolean isFull() { + if (size() > FULL_COUNT) { + return true; + } + return false; + } + + private int size() { + return contextDatasList.size(); + } +} diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/data/model/GLAPIData.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/data/model/GLAPIData.java new file mode 100644 index 0000000..c7f99e2 --- /dev/null +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/data/model/GLAPIData.java @@ -0,0 +1,69 @@ +/* + * Dynamic Analyzer + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * 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.opengl.data.model; + +import org.tizen.dynamicanalyzer.swap.model.probe2.GLES20LogData; + +public class GLAPIData { + private GLES20LogData logData; + + public GLAPIData(GLES20LogData logData) { + this.logData = logData; + } + + public int getSeq() { + return logData.getSeq(); + } + + public String getName() { + return logData.getApiName(); + } + + public String getParameter() { + return logData.getArgs(); + } + + public long getTime() { + return logData.getTime(); + } + + public long getElapsedTime() { + return logData.getElapsedTime(); + } + + public long getErrorNo() { + return logData.getErrno(); + } + + public long getReturnValue() { + return logData.getReturn(); + } + + public GLES20LogData getLogData() { + return logData; + } +} diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/data/model/GLFrameData.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/data/model/GLFrameData.java new file mode 100644 index 0000000..4445d9b --- /dev/null +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/data/model/GLFrameData.java @@ -0,0 +1,80 @@ +/* + * Dynamic Analyzer + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * 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.opengl.data.model; + +import java.util.ArrayList; +import java.util.List; + +public class GLFrameData { + private int frameNumber; + private List glAPIDataList; + private int errorCount; + + public GLFrameData(int frameNumber) { + glAPIDataList = new ArrayList(); + this.frameNumber = frameNumber; + errorCount = 0; + } + + public int getFrameNumber() { + return frameNumber; + } + + public void addGLAPIData(GLAPIData glAPIData) { + glAPIDataList.add(glAPIData); + + if (glAPIData.getErrorNo() != 0) { + errorCount++; + } + } + + public List getGLApiDataList() { + return glAPIDataList; + } + + public long getEleapsedTime() { + long elapsedTime = 0; + + for (GLAPIData glAPIData : glAPIDataList) { + elapsedTime += glAPIData.getElapsedTime(); + } + + return elapsedTime; + } + + public int getErrorCount() { + return errorCount; + } + + public boolean hasError() { + if (errorCount != 0) { + return true; + } else { + return false; + } + } +} \ No newline at end of file diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/eventListner/BoundLineEventListener.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/eventListner/BoundLineEventListener.java new file mode 100644 index 0000000..bd592fb --- /dev/null +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/eventListner/BoundLineEventListener.java @@ -0,0 +1,245 @@ +package org.tizen.dynamicanalyzer.ui.opengl.eventListner; + +import java.util.Timer; +import java.util.TimerTask; + +import org.eclipse.swt.events.MouseEvent; +import org.eclipse.swt.events.MouseListener; +import org.eclipse.swt.events.MouseMoveListener; +import org.eclipse.swt.events.MouseTrackListener; +import org.eclipse.swt.events.PaintEvent; +import org.eclipse.swt.events.PaintListener; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Path; +import org.eclipse.swt.widgets.Display; +import org.tizen.dynamicanalyzer.resources.ColorResources; +import org.tizen.dynamicanalyzer.widgets.chart.DAChart; +import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlot; + +public class BoundLineEventListener implements MouseListener, MouseMoveListener, + MouseTrackListener { + private static final int POINT_MAX_SIZE = 12; + private static final int HOLE_INIT_SIZE = -4; + private static final int LINE_MAX_WIDTH = 3; + private static final int LINE_INIT_WIDTH = 1; + private static final double UPPER_LINE_INIT_POSITION = 0.01; + private static final double UNDER_LINE_INIT_POSITION = 0.99; + private static final Color LINE_COLOR = ColorResources.BLUE; + + private DAChart chart; + private DAChartPlot plot; + private Timer timer; + private int pointSize = 0; + private int holeSize = HOLE_INIT_SIZE; + private int pointPositionX; + private int pointPositionY; + private int boundLineWidth = LINE_INIT_WIDTH; + private double boundValue = -1; + private boolean isExpanded = false; + + public BoundLineEventListener(final DAChart chart, + DAChartPlot.BoundType boundType) { + this.chart = chart; + plot = chart.getPlot(); + plot.setBoundType(boundType); + + this.chart.addPaintListener(new PaintListener() { + @Override + public void paintControl(PaintEvent e) { + if (!isExpanded) { + plot.setBoundExpanded(false); + + drawBoundLine(e.gc, LINE_COLOR, boundLineWidth, boundValue); + + // draw bound value + if (pointSize == POINT_MAX_SIZE) { + double max = plot.getVisibleEndY(); + int chartHeight = chart.getBounds().height; + + if (boundLineWidth == LINE_MAX_WIDTH) { + String boundText = String.valueOf(boundValue) + + plot.getAxisUnit(); + plot.setBoundValue(boundValue); + chart.redrawForce(); + int boundTextHeight = e.gc.textExtent(boundText).y; + int boundTextPosition; + + double linePosition = 1.0 - (boundValue / max); + if (chartHeight * linePosition > chartHeight + - boundTextHeight) { + boundTextPosition = (int) Math + .round(chartHeight * linePosition + - boundTextHeight); + } else { + boundTextPosition = (int) Math + .round(chartHeight * linePosition); + } + + e.gc.setForeground(LINE_COLOR); + if (boundTextPosition > 0) { + e.gc.drawString(boundText, 0, + boundTextPosition, true); + } else { + e.gc.drawString("^" + boundText, 0, 0, true); + } + } + } + } // end of !isExpanded + else { + plot.setBoundExpanded(true); + } + + // draw point + e.gc.setBackground(ColorResources.RED); + + if (pointSize > 3) { + Path path = new Path(Display.getDefault()); + path.addArc(pointPositionX - pointSize / 2, pointPositionY + - pointSize / 2, pointSize, pointSize, 0, 360); + + path.addArc(pointPositionX - holeSize / 2, pointPositionY + - holeSize / 2, holeSize, holeSize, 0, 360); + + e.gc.fillPath(path); + path.dispose(); + } + } + }); + } + + private void drawBoundLine(GC gc, Color lineColor, int lineWidth, + double lineValue) { + gc.setForeground(lineColor); + gc.setLineWidth(lineWidth); + + int y = (int) (Math.round(chart.getBounds().height + * (1.0 - lineValue / plot.getVisibleEndY()))); + gc.drawLine(1, y, chart.getBounds().width - 1, y); + } + + @Override + public void mouseDoubleClick(MouseEvent e) { + } + + @Override + public void mouseDown(final MouseEvent e) { + if (e.button == 3) { + if (timer != null) { + timer.cancel(); + pointSize = 0; + holeSize = HOLE_INIT_SIZE; + boundLineWidth = LINE_INIT_WIDTH; + } + + return; + } + + timer = new Timer(); + timer.schedule(new TimerTask() { + @Override + public void run() { + if (pointSize != POINT_MAX_SIZE) { + pointPositionX = e.x; + pointPositionY = e.y; + pointSize += 2; + holeSize += 2; + + Display.getDefault().asyncExec(new Runnable() { + @Override + public void run() { + double max = plot.getVisibleEndY(); + double linePosition = 1.0 - boundValue / max; + int gap = (int) Math.round(Math.abs(e.y + - chart.getBounds().height * linePosition)); + if (gap < 5 || (boundValue > max && e.y <= 5)) { + boundLineWidth = (int) ((double) LINE_MAX_WIDTH / ((double) POINT_MAX_SIZE / (double) pointSize)); + redrawLineArea(); + } + + redrawPointArea(); + } + }); + } else if (boundLineWidth == LINE_INIT_WIDTH) { + if (holeSize < POINT_MAX_SIZE) { + holeSize += 2; + Display.getDefault().asyncExec(new Runnable() { + @Override + public void run() { + redrawPointArea(); + } + }); + } + } + } + }, 0, 40); + } + + @Override + public void mouseUp(MouseEvent e) { + if (timer != null) { + timer.cancel(); + pointSize = 0; + holeSize = HOLE_INIT_SIZE; + boundLineWidth = LINE_INIT_WIDTH; + redrawPointArea(); + redrawLineArea(); + } + } + + @Override + public void mouseMove(MouseEvent e) { + if (timer != null) { + timer.cancel(); + } + + if (boundLineWidth == LINE_MAX_WIDTH && !isExpanded) { + pointPositionX = e.x; + pointPositionY = e.y; + + double position = (double) e.y / (double) chart.getBounds().height; + if (boundLineWidth == LINE_MAX_WIDTH) { + if (position > UNDER_LINE_INIT_POSITION) { + position = UNDER_LINE_INIT_POSITION; + } else if (position < UPPER_LINE_INIT_POSITION) { + position = UPPER_LINE_INIT_POSITION + 0.01; + } + boundValue = Math.round(plot.getVisibleEndY() * (1 - position)); + } + + } else { + pointSize = 0; + holeSize = HOLE_INIT_SIZE; + boundLineWidth = LINE_INIT_WIDTH; + } + + redrawPointArea(); + redrawLineArea(); + } + + @Override + public void mouseEnter(MouseEvent e) { + } + + @Override + public void mouseExit(MouseEvent e) { + } + + @Override + public void mouseHover(MouseEvent e) { + } + + private void redrawPointArea() { + chart.redraw(pointPositionX - POINT_MAX_SIZE / 2, pointPositionY + - POINT_MAX_SIZE / 2, POINT_MAX_SIZE, POINT_MAX_SIZE, false); + } + + private void redrawLineArea() { + double linePosition = 1.0 - boundValue / plot.getVisibleEndY(); + chart.redraw(0, + (int) Math.round(chart.getBounds().height * linePosition) + - LINE_MAX_WIDTH, chart.getBounds().width, + (int) Math.round(chart.getBounds().height * linePosition) + + LINE_MAX_WIDTH, false); + } +} diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/eventListner/GLFrameChartMouseEventListener.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/eventListner/GLFrameChartMouseEventListener.java new file mode 100644 index 0000000..f5bfe22 --- /dev/null +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/eventListner/GLFrameChartMouseEventListener.java @@ -0,0 +1,176 @@ +package org.tizen.dynamicanalyzer.ui.opengl.eventListner; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.MouseEvent; +import org.tizen.dynamicanalyzer.common.AnalyzerManager; +import org.tizen.dynamicanalyzer.common.DASelectionData; +import org.tizen.dynamicanalyzer.ui.opengl.data.GLDataMaker; +import org.tizen.dynamicanalyzer.ui.opengl.data.GLSelectionData; +import org.tizen.dynamicanalyzer.ui.opengl.ui.GLDetailsView; +import org.tizen.dynamicanalyzer.ui.opengl.ui.apiList.GLAPIListView; +import org.tizen.dynamicanalyzer.ui.opengl.ui.chart.GLChartView; +import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants; +import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineView; +import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea; +import org.tizen.dynamicanalyzer.widgets.chart.DAChart; +import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlot; +import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlotIntervalMarker; +import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlotMarker; +import org.tizen.dynamicanalyzer.widgets.popupMenu.DAPopupMenu; +import org.tizen.dynamicanalyzer.widgets.popupMenu.DAPopupMenuItem; +import org.tizen.dynamicanalyzer.widgets.timeline.DATimeline; + +public class GLFrameChartMouseEventListener extends + GLFramerateChartMouseEventListener { + + public GLFrameChartMouseEventListener(DAPopupMenu menu, DATimeline timeline) { + super(menu, timeline); + } + + @Override + public void mouseDown(MouseEvent e) { + DAChart chart = (DAChart) e.widget; + DAChartPlot plot = chart.getPlot(); + DAChartPlotMarker marker = plot.getMarkers() + .get(SELECTION_MARKER_INDEX); + if (!(marker instanceof DAChartPlotIntervalMarker)) { + return; + } + DAChartPlotIntervalMarker intervalMarker = (DAChartPlotIntervalMarker) marker; + + double eventFrameIndex = plot.getXFromXPixcel(e.x); + + if (e.button == 3) { + List itemList = menu.getItems(); + DAPopupMenuItem startItem = itemList.get(0); + DAPopupMenuItem endItem = itemList.get(1); + DAPopupMenuItem fromSelectionItem = itemList.get(2); + DAPopupMenuItem analysisItem = itemList.get(3); + DAPopupMenuItem clearItem = itemList.get(4); + + if (ToolbarArea.getInstance() == null) { + System.out.println("toolbar area is null");//$NON-NLS-1$ + return; + } + + if (eventFrameIndex * TimelineConstants.MEGA_DOUBLE <= ToolbarArea.getInstance() + .getTime()) { + startItem.setEnabled(true); + endItem.setEnabled(true); + analysisItem.setEnabled(rangeDataManager.isAnalyzable()); + clearItem.setEnabled(rangeDataManager.isBeingAnalyzed()); + + startItem.setDoubleData(eventFrameIndex); + endItem.setDoubleData(eventFrameIndex); + } else { + startItem.setEnabled(false); + endItem.setEnabled(false); + analysisItem.setEnabled(rangeDataManager.isAnalyzable()); + clearItem.setEnabled(rangeDataManager.isBeingAnalyzed()); + } + + if (intervalMarker.getStartVal() != intervalMarker.getEndVal()) { + fromSelectionItem.setEnabled(true); + } else { + fromSelectionItem.setEnabled(false); + } + + return; + } + + boolean bShift = false; + if ((e.stateMask & SWT.SHIFT) != 0) { + bShift = true; + } + + if (bShift && intervalMarker.getStartVal() != -1) { + if (baseTime > eventFrameIndex) { + intervalMarker.setStartVal(eventFrameIndex); + intervalMarker.setEndVal(baseTime); + } else { + intervalMarker.setStartVal(baseTime); + intervalMarker.setEndVal(eventFrameIndex); + } + } else { + intervalMarker.setInterval(eventFrameIndex, eventFrameIndex); + baseTime = eventFrameIndex; + } + + chart.redraw(); + + int index = chart.getSeriesList().get(0) + .getPrevIndexByXvalue(plot.getXFromXPixcel(e.x)); + if (index < 0) { + return; + } + + List viewNameList = new ArrayList(); + viewNameList.add(GLAPIListView.class.getName()); + viewNameList.add(GLDetailsView.class.getName()); + AnalyzerManager.getCurrentPage().updateSelectedViews( + new GLSelectionData(GLChartView.ID, 0, 0, null, null, index), viewNameList); + } + @Override + public void mouseUp(MouseEvent e) { + if (e.button == 3) { + return; + } + + DAChart chart = (DAChart) e.widget; + DAChartPlot plot = chart.getPlot(); + DAChartPlotMarker marker = plot.getMarkers() + .get(SELECTION_MARKER_INDEX); + if (!(marker instanceof DAChartPlotIntervalMarker)) { + return; + } + DAChartPlotIntervalMarker intervalMarker = (DAChartPlotIntervalMarker) marker; + + double eventFrameIndex = plot.getXFromXPixcel(e.x); + double markerStartVal; + double markerEndVal; + + if (intervalMarker.getStartVal() >= eventFrameIndex) { + markerStartVal = eventFrameIndex; + markerEndVal = intervalMarker.getEndVal(); + } else { + markerStartVal = intervalMarker.getStartVal(); + markerEndVal = eventFrameIndex; + } + + int lastFrame = GLDataMaker.getInstance().getFrameSize() - 1; + + if (markerStartVal < 0) { + markerStartVal = 0; + } else if (markerStartVal > lastFrame) { + markerStartVal = lastFrame; + } + + if (markerEndVal > lastFrame) { + markerEndVal = lastFrame; + } else if (markerEndVal < 0) { + markerEndVal = 0; + } + + if (markerEndVal <= plot.getVisibleEndX()) { + intervalMarker.setInterval(markerStartVal, markerEndVal); + } else { + intervalMarker.setInterval(markerStartVal, plot.getVisibleEndX()); + } + + int frame = (int) eventFrameIndex <= lastFrame ? (int) eventFrameIndex + : lastFrame; + try { + long time = GLDataMaker.getInstance().getFrameData(frame) + .getGLApiDataList().get(0).getTime(); + AnalyzerManager.getCurrentPage() + .updatePage( + new DASelectionData(TimelineView.ID, time, time, + null, null)); + timeline.setDetailedFrame(frame); + } catch (IndexOutOfBoundsException ie) { + } + } +} diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/eventListner/GLFramerateChartMouseEventListener.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/eventListner/GLFramerateChartMouseEventListener.java new file mode 100644 index 0000000..916826a --- /dev/null +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/eventListner/GLFramerateChartMouseEventListener.java @@ -0,0 +1,264 @@ +package org.tizen.dynamicanalyzer.ui.opengl.eventListner; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.MouseAdapter; +import org.eclipse.swt.events.MouseEvent; +import org.eclipse.swt.events.MouseMoveListener; +import org.tizen.dynamicanalyzer.common.AnalyzerManager; +import org.tizen.dynamicanalyzer.common.DASelectionData; +import org.tizen.dynamicanalyzer.ui.opengl.ui.GLDetailsView; +import org.tizen.dynamicanalyzer.ui.opengl.ui.apiList.GLAPIListView; +import org.tizen.dynamicanalyzer.ui.opengl.ui.chart.GLChartView; +import org.tizen.dynamicanalyzer.ui.range.RangeDataManager; +import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants; +import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineView; +import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea; +import org.tizen.dynamicanalyzer.widgets.chart.DAChart; +import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlot; +import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlotIntervalMarker; +import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlotMarker; +import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlotTooltip; +import org.tizen.dynamicanalyzer.widgets.chart.DAChartSeries; +import org.tizen.dynamicanalyzer.widgets.chart.DAUIEventChartPlot; +import org.tizen.dynamicanalyzer.widgets.popupMenu.DAPopupMenu; +import org.tizen.dynamicanalyzer.widgets.popupMenu.DAPopupMenuItem; +import org.tizen.dynamicanalyzer.widgets.timeline.DATimeline; + +public class GLFramerateChartMouseEventListener extends MouseAdapter implements + MouseMoveListener { + protected RangeDataManager rangeDataManager = RangeDataManager.getInstance(); + protected DAPopupMenu menu; + protected DATimeline timeline; + protected double baseTime = TimelineConstants.NOT_INITED; + + protected static final int SELECTION_MARKER_INDEX = 0; // FIXME + + public GLFramerateChartMouseEventListener(DAPopupMenu menu, DATimeline timeline) { + this.menu = menu; + this.timeline = timeline; + } + + @Override + public void mouseDown(MouseEvent e) { + DAChart chart = (DAChart) e.widget; + DAChartPlot plot = chart.getPlot(); + DAChartPlotMarker marker = plot.getMarkers() + .get(SELECTION_MARKER_INDEX); + if (!(marker instanceof DAChartPlotIntervalMarker)) { + return; + } + DAChartPlotIntervalMarker intervalMarker = (DAChartPlotIntervalMarker) marker; + + double eventTime = plot.getXFromXPixcel(e.x); + + if (e.button == 3) { + List itemList = menu.getItems(); + DAPopupMenuItem startItem = itemList.get(0); + DAPopupMenuItem endItem = itemList.get(1); + DAPopupMenuItem fromSelectionItem = itemList.get(2); + DAPopupMenuItem analysisItem = itemList.get(3); + DAPopupMenuItem clearItem = itemList.get(4); + + if (ToolbarArea.getInstance() == null) { + System.out.println("toolbar area is null");//$NON-NLS-1$ + return; + } + + if (eventTime * TimelineConstants.MEGA_DOUBLE <= ToolbarArea.getInstance() + .getTime()) { + startItem.setEnabled(true); + endItem.setEnabled(true); + analysisItem.setEnabled(rangeDataManager.isAnalyzable()); + clearItem.setEnabled(rangeDataManager.isBeingAnalyzed()); + + startItem.setDoubleData(eventTime); + endItem.setDoubleData(eventTime); + } else { + startItem.setEnabled(false); + endItem.setEnabled(false); + analysisItem.setEnabled(rangeDataManager.isAnalyzable()); + clearItem.setEnabled(rangeDataManager.isBeingAnalyzed()); + } + + if (intervalMarker.getStartVal() != intervalMarker.getEndVal()) { + fromSelectionItem.setEnabled(true); + } else { + fromSelectionItem.setEnabled(false); + } + + return; + } + + boolean bShift = false; + if ((e.stateMask & SWT.SHIFT) != 0) { + bShift = true; + } + + if (bShift == true && intervalMarker.getStartVal() != -1) { + if (baseTime > eventTime) { + intervalMarker.setStartVal(eventTime); + intervalMarker.setEndVal(baseTime); + } else { + intervalMarker.setStartVal(baseTime); + intervalMarker.setEndVal(eventTime); + } + } else { + intervalMarker.setInterval(eventTime, eventTime); + baseTime = eventTime; + } + + chart.redraw(); + + int index = chart.getSeriesList().get(0) + .getPrevIndexByXvalue(plot.getXFromXPixcel(e.x)); + if (index < 0) { + return; + } + + List viewNameList = new ArrayList(); + viewNameList.add(GLAPIListView.class.getName()); + viewNameList.add(GLDetailsView.class.getName()); + AnalyzerManager.getCurrentPage().updateSelectedViews( + new DASelectionData(GLChartView.ID, 0, 0, new Integer( + index), null), viewNameList); + } + + @Override + public void mouseUp(MouseEvent e) { + if (e.button == 3) { + return; + } + + DAChart chart = (DAChart) e.widget; + DAChartPlot plot = chart.getPlot(); + DAChartPlotMarker marker = plot.getMarkers() + .get(SELECTION_MARKER_INDEX); + if (!(marker instanceof DAChartPlotIntervalMarker)) { + return; + } + DAChartPlotIntervalMarker intervalMarker = (DAChartPlotIntervalMarker) marker; + + double eventTime = plot.getXFromXPixcel(e.x); + double markerStartTime; + double markerEndTime; + int frame = (int) eventTime; + + if (intervalMarker.getStartVal() >= eventTime) { + markerStartTime = eventTime; + markerEndTime = intervalMarker.getEndVal(); + } else { + markerStartTime = intervalMarker.getStartVal(); + markerEndTime = eventTime; + } + + double toolbarTime = ToolbarArea.getInstance().getTime() + / TimelineConstants.MEGA_DOUBLE; + + if (markerStartTime < 0) { + markerStartTime = 0; + } else if (markerStartTime > toolbarTime) { + markerStartTime = toolbarTime; + } + + if (markerEndTime > toolbarTime) { + markerEndTime = toolbarTime; + } else if (markerEndTime < 0) { + markerEndTime = 0; + } + + if (markerEndTime <= plot.getVisibleEndX()) { + intervalMarker.setInterval(markerStartTime, markerEndTime); + } else { + intervalMarker.setInterval(markerStartTime, plot.getVisibleEndX()); + } + + sendSelectionTimes(intervalMarker.getStartVal(), + intervalMarker.getEndVal()); + timeline.setDetailedFrame(frame); + } + + @Override + public void mouseMove(MouseEvent e) { + DAChart chart = (DAChart) e.widget; + DAChartPlot plot = chart.getPlot(); + DAChartPlotMarker marker = plot.getMarkers() + .get(SELECTION_MARKER_INDEX); + if (!(marker instanceof DAChartPlotIntervalMarker)) { + System.out.println("mouseMove !IntervalMarker"); + return; + } + DAChartPlotIntervalMarker intervalMarker = (DAChartPlotIntervalMarker) marker; + DAChartPlotTooltip tooltip; + + if ((e.stateMask & SWT.BUTTON1) != 0) { + double eventTime = plot.getXFromXPixcel(e.x); + + if (baseTime > eventTime) { + intervalMarker.setStartVal(eventTime); + intervalMarker.setEndVal(baseTime); + } else { + intervalMarker.setStartVal(baseTime); + intervalMarker.setEndVal(eventTime); + } + } + tooltip = plot.getTooltip(); + if (null == tooltip) { + return; + } + + double oldStartVal = tooltip.getStartVal(); + double newStartVal = getTooltipStartX(plot, chart.getSeriesList(), e.x); + + if (oldStartVal != newStartVal) { + tooltip.setStartVal(newStartVal); + } + + timeline.setDetailedTime(plot.getXFromXPixcel(e.x)); + timeline.setDetailedTimePosition(e.x); + timeline.setDrawDetailedTime(true); + timeline.redraw(); + } + + private void sendSelectionTimes(double start, double end) { + long startTime = (long) (start * TimelineConstants.MEGA_DOUBLE); + long endTime = (long) (end * TimelineConstants.MEGA_DOUBLE); + if (endTime < startTime) { + long temp = startTime; + startTime = endTime; + endTime = temp; + } + if (startTime < 0) { + startTime = 0; + } + AnalyzerManager.getCurrentPage().updatePage( + new DASelectionData(TimelineView.ID, startTime, endTime, null, + null)); + } + + private double getTooltipStartX(DAChartPlot plot, + List seriesList, int x) { + double ret = -1; + for (int i = 0; i < seriesList.size(); i++) { + DAChartSeries series = seriesList.get(i); + int index = series.getPrevIndexByXvalue(plot.getXFromXPixcel(x)); + if (-1 == index) { + if (plot instanceof DAUIEventChartPlot) { + break; + } + continue; + } + double startVal = series.getSeriesItemList().get(index).getX(); + if (ret < startVal) { + ret = startVal; + } + + if (plot instanceof DAUIEventChartPlot) { + break; + } + } + return ret; + } +} diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/ui/GLDetailsView.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/ui/GLDetailsView.java new file mode 100644 index 0000000..68ad644 --- /dev/null +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/ui/GLDetailsView.java @@ -0,0 +1,291 @@ +/* + * Dynamic Analyzer + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * 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.opengl.ui; + +import org.eclipse.nebula.widgets.grid.GridItem; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.PaintEvent; +import org.eclipse.swt.events.PaintListener; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.layout.FillLayout; +import org.eclipse.swt.widgets.Canvas; +import org.eclipse.swt.widgets.Composite; +import org.tizen.dynamicanalyzer.common.DASelectionData; +import org.tizen.dynamicanalyzer.model.DAView; +import org.tizen.dynamicanalyzer.nl.GLPageLabels; +import org.tizen.dynamicanalyzer.resources.ColorResources; +import org.tizen.dynamicanalyzer.resources.FontResources; +import org.tizen.dynamicanalyzer.swap.model.probe2.GLES20LogData; +import org.tizen.dynamicanalyzer.ui.opengl.GLES20ErrorInformation; +import org.tizen.dynamicanalyzer.ui.opengl.data.GLDataMaker; +import org.tizen.dynamicanalyzer.ui.opengl.data.GLSelectionData; +import org.tizen.dynamicanalyzer.ui.opengl.data.model.GLFrameData; +import org.tizen.dynamicanalyzer.ui.opengl.ui.apiList.GLAPIListView; +import org.tizen.dynamicanalyzer.ui.opengl.ui.chart.GLChartView; +import org.tizen.dynamicanalyzer.ui.opengl.ui.context.GLContextView; +import org.tizen.dynamicanalyzer.ui.widgets.ViewContainer; +import org.tizen.dynamicanalyzer.ui.widgets.table.DATableDataFormat; + +public class GLDetailsView extends DAView { + public static final String ID = GLDetailsView.class.getName(); + public static final int LEFT_MARGIN = 10; + public static final int HEIGHT_MARGIN = 20; + + private static final int DETAIL_FRAME = 0; + private static final int DETAIL_API = 1; + private static final int DETAIL_CONTEXT = 2; + + private Canvas canvas = null; + private int detail = -1; + + private String frameNumber; + private String elapsedTime; + private String apiCount; + private String errorCount; + + private String api; + private String state; + + private String m_txt; + private int m_length; + private int m_width; + private int m_position; + private int m_start; + private GC m_gc; + + public GLDetailsView(Composite parent, int style) { + super(parent, style); + this.setLayout(new FillLayout()); + + ViewContainer viewContainer = new ViewContainer(this, true); + viewContainer.setTitleText(GLPageLabels.GL_DETAILS_VIEW_TITLE); + + int[] innerMaxWeight = { 0, 100 }; + int[] outerMaxWeight = { 0, 100 }; + setMaxWeight(innerMaxWeight, outerMaxWeight); + + Composite contents = viewContainer.getContentArea(); + contents.setBackground(ColorResources.VIEW_BG_COLOR); + contents.setLayout(new FillLayout()); + canvas = new Canvas(contents, SWT.TRANSPARENT); + canvas.addPaintListener(new PaintListener() { + @Override + public void paintControl(PaintEvent e) { + Rectangle rect = canvas.getBounds(); + e.gc.setBackground(ColorResources.VIEW_BG_COLOR); + e.gc.fillRectangle(rect.x, rect.y, rect.width, rect.height); + e.gc.setForeground(ColorResources.TABLE_CONTENTS_FONT_COLOR); + e.gc.setFont(FontResources.DETAIL_INFO_FONT); + + if (detail == DETAIL_FRAME) { + int y = HEIGHT_MARGIN; + Point p = e.gc.textExtent(frameNumber, SWT.DRAW_MNEMONIC); + e.gc.drawText(frameNumber, LEFT_MARGIN, y); + y += (p.y + HEIGHT_MARGIN); + + e.gc.drawText(elapsedTime, LEFT_MARGIN, y); + y += (p.y + HEIGHT_MARGIN); + + e.gc.drawText(apiCount, LEFT_MARGIN, y); + y += (p.y + HEIGHT_MARGIN); + + e.gc.drawText(errorCount, LEFT_MARGIN, y); + } else if (detail == DETAIL_API) { + int y = HEIGHT_MARGIN; + Point p = e.gc.textExtent(api, SWT.DRAW_MNEMONIC); + e.gc.drawText(api, LEFT_MARGIN, y); + y += (p.y + HEIGHT_MARGIN); + + if (state != null) { + writeWithWrap(e.gc, state, LEFT_MARGIN, y, rect.width + - LEFT_MARGIN * 2); + } + } else if (detail == DETAIL_CONTEXT) { + // TODO + } + } + }); + } + + @Override + public void updateView(DASelectionData data) { + String id = data.getViewId(); + if (id.equals(GLChartView.ID)) { + detail = DETAIL_FRAME; + + int frameIndex = ((GLSelectionData)data).getFrameIndex(); + GLFrameData glFrameData = GLDataMaker.getInstance().getFrameData( + frameIndex); + + frameNumber = "Frame# : " + String.valueOf(frameIndex + 1); + elapsedTime = "Elapsed time : " + glFrameData.getEleapsedTime(); + apiCount = glFrameData.getGLApiDataList().size() + " API(s)"; + errorCount = glFrameData.getErrorCount() + " error(s)"; + + } else if (id.equals(GLAPIListView.ID)) { + detail = DETAIL_API; + + GridItem[] gridItems = (GridItem[]) data.getData(); + DATableDataFormat tableDataFormat = (DATableDataFormat) gridItems[0] + .getData(); + GLES20LogData logData = (GLES20LogData)tableDataFormat.getLogData(); + + api = logData.getApiName(); + long error = logData.getErrno(); + if (error == 0) { + state = GLES20ErrorInformation.getErrorDescription(String.valueOf(error)); + } else { + state = getErrorDescription(api, + GLES20ErrorInformation.getError(error)); + } + } else if (id.equals(GLContextView.ID)) { + detail = DETAIL_CONTEXT; + // TODO + } + + canvas.redraw(); + } + + private String getErrorDescription(String apiName, String errorName) { + if (apiName.equals("glDisable")) { + apiName.equals("glEnable"); + } else if (apiName.equals(GLDataMaker.API_GL_DISABLE_VAA)) { + apiName = GLDataMaker.API_GL_ENABLE_VAA; + } else if (apiName.equals("glGetBooleanv") + || apiName.equals("glGetFloatv") + || apiName.equals("glGetIntegerv")) { + apiName = "glGet"; + } else if (apiName.startsWith("glGetTexParameter")) { + apiName = "glGetTexParameter"; + } else if (apiName.startsWith("glGetUniform") && !apiName.endsWith("n")) { + apiName = "glGetUniform"; + } else if (apiName.startsWith("glGetVertexAttrib") + && !apiName.endsWith("rv")) { + apiName = "glGetVertexAttrib"; + } else if (apiName.startsWith("glTexParameter")) { + apiName = "glTexParameter"; + } else if (apiName.startsWith("glUniform")) { + apiName = "glUniform"; + } else if (apiName.startsWith("glVertexAttrib") + && (apiName.endsWith("f") || apiName.endsWith("v"))) { + apiName = "glVertexAttrib"; + } + + String errorDescription = GLES20ErrorInformation + .getErrorDescription(apiName + errorName); + + if(errorDescription == null) { + return errorName; + } else { + return errorDescription; + } + } + + private int writeWithWrap(GC gc, String txt, int x, int y, int width) { + m_txt = txt; + m_length = txt.length(); + m_width = width; + m_position = 0; + m_start = 0; + m_gc = gc; + + int fontHight = gc.textExtent(m_txt.split("\n")[0]).y; + String s; + while (hasMoreLines()) { + s = nextLine().trim(); + gc.drawString(s, x, y); + y += fontHight; + } + return y; + } + + private boolean hasMoreLines() { + return (m_position < (m_length - 1)); + } + + private String nextLine() { + int maxLength = m_txt.length(); + int next = next(); + if (m_start >= maxLength || next > maxLength) { + return ""; + } + + String s = m_txt.substring(m_start, next); + m_start = next; + if ((m_txt.length() - 1 > m_start) + && ((m_txt.charAt(m_start) == '\n') || (m_txt.charAt(m_start) == ' '))) { + m_position++; + m_start++; + } + return s; + } + + private int next() { + int i = getNextWord(m_position); + int lastBreak = -1; + String line; + line = m_txt.substring(m_position, i); + int lineWidth = m_gc.textExtent(line, SWT.DRAW_MNEMONIC).x; + while (i < m_length && lineWidth <= m_width) { + if (m_txt.charAt(i) == ' ') + lastBreak = i; + else if (m_txt.charAt(i) == '\n') { + lastBreak = i; + break; + } + if (++i < m_length) { + i = getNextWord(i); + line = m_txt.substring(m_position, i); + lineWidth = m_gc.textExtent(line, SWT.DRAW_MNEMONIC).x; + } + } + if (i == m_length && lineWidth <= m_width) + m_position = i; + else if (lastBreak == m_position) + m_position++; + else if (lastBreak < m_position) + m_position = i; + else + m_position = lastBreak; + return m_position; + } + + private int getNextWord(int startIndex) { + int space = m_txt.indexOf(' ', startIndex); + int newLine = m_txt.indexOf('\n', startIndex); + if (space == -1) + space = m_length; + if (newLine == -1) + newLine = m_length; + if (space < newLine) + return space; + else + return newLine; + } +} diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/ui/GLPage.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/ui/GLPage.java new file mode 100644 index 0000000..c4562e6 --- /dev/null +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/ui/GLPage.java @@ -0,0 +1,144 @@ +/* + * Dynamic Analyzer + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * 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.opengl.ui; + +import java.util.List; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.SashForm; +import org.eclipse.swt.layout.FillLayout; +import org.eclipse.swt.widgets.Composite; +import org.tizen.dynamicanalyzer.logparser.LogCenterConstants; +import org.tizen.dynamicanalyzer.nl.AnalyzerLabels; +import org.tizen.dynamicanalyzer.shortcut.ShortCutManager; +import org.tizen.dynamicanalyzer.swap.logparser.LogPackage; +import org.tizen.dynamicanalyzer.swap.logparser.Logs; +import org.tizen.dynamicanalyzer.swap.model.probe2.GLES20LogData; +import org.tizen.dynamicanalyzer.swap.model.probe2.LogData; +import org.tizen.dynamicanalyzer.ui.info.callstack.CallstackView; +import org.tizen.dynamicanalyzer.ui.info.snapshot.SnapshotView; +import org.tizen.dynamicanalyzer.ui.opengl.data.GLDataMaker; +import org.tizen.dynamicanalyzer.ui.opengl.data.inserter.GLContextDataInserter; +import org.tizen.dynamicanalyzer.ui.opengl.ui.apiList.GLAPIListView; +import org.tizen.dynamicanalyzer.ui.opengl.ui.chart.GLChartView; +import org.tizen.dynamicanalyzer.ui.opengl.ui.context.GLContextView; +import org.tizen.dynamicanalyzer.ui.page.DAPageComposite; +import org.tizen.dynamicanalyzer.ui.widgets.DATabComposite; + +public class GLPage extends DAPageComposite { + public static final String ID = GLPage.class.getName(); + private GLDataMaker glDataMaker; + + SashForm baseForm; + SashForm leftForm; + SashForm bottomForm; + SashForm rightForm; + + GLChartView glChartView; + GLAPIListView glAPIListView; + GLContextView glStateView; + + public GLPage(Composite parent, int style) { + super(parent, style); + + glDataMaker = GLDataMaker.getInstance(); + + name = AnalyzerLabels.COOLBAR_AREA_GRAPHICS; + this.setData(DAPageComposite.KEY_TOOLTIP, + ShortCutManager.COOLBAR_AREA_GRAPHICS_TOOLTIP); + this.setLayout(new FillLayout()); + + baseForm = new SashForm(this, SWT.HORIZONTAL); + + leftForm = new SashForm(baseForm, SWT.VERTICAL); + + glChartView = new GLChartView(leftForm, SWT.NONE); + addView(glChartView); + + bottomForm = new SashForm(leftForm, SWT.HORIZONTAL); + + glAPIListView = new GLAPIListView(bottomForm, SWT.NONE); + addView(glAPIListView); + + glStateView = new GLContextView(bottomForm, SWT.NONE); + addView(glStateView); + + leftForm.setWeights(new int[] { 30, 70 }); + bottomForm.setWeights(new int[] { 50, 50 }); + + rightForm = new SashForm(baseForm, SWT.VERTICAL); + + DATabComposite tabView = new DATabComposite(rightForm, SWT.NONE); + addView(tabView); + SnapshotView snapshotView = new SnapshotView( + tabView.getContentComposite(), SWT.NONE, false); + snapshotView.setObservingViews(new String[] { GLAPIListView.ID }); + tabView.addView(snapshotView, false); + + CallstackView callstackView = new CallstackView( + tabView.getContentComposite(), SWT.NONE); + callstackView.setObservingViews(new String[] { GLAPIListView.ID }); + tabView.addView(callstackView, false); + + GLDetailsView detailsView = new GLDetailsView(rightForm, SWT.NONE); + addView(detailsView); + + rightForm.setWeights(new int[] { 50, 50 }); + baseForm.setWeights(new int[] { 75, 25 }); + } + + @Override + protected void setFormWeights() { + baseForm.setWeights(new int[] { 100 - wRate, wRate }); + rightForm.setWeights(new int[] { hRate, 100 - hRate }); + } + + @Override + public void updateLog(LogPackage logPack) { + super.updateLog(logPack); + + Logs glesLogs = logPack.getLogs(LogCenterConstants.LOG_GLES20); + if (glesLogs != null && glesLogs.getLogs() != null + && glesLogs.getLogs().size() > 0) { + List logDataList = glesLogs.getLogs(); + + for (LogData logData : logDataList) { + glDataMaker.addGLAPIData((GLES20LogData)logData); + } + + GLContextDataInserter.getContextDataQueue().push( + glDataMaker.getContextValueDAInputListAndClear()); + GLContextDataInserter.startinserterThread(); + } + } + + @Override + public void clear() { + super.clear(); + glDataMaker.clear(); + } +} diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/ui/apiList/GLAPIListTable.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/ui/apiList/GLAPIListTable.java new file mode 100644 index 0000000..56a8983 --- /dev/null +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/ui/apiList/GLAPIListTable.java @@ -0,0 +1,365 @@ +/* + * Dynamic Analyzer + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * 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.opengl.ui.apiList; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.eclipse.nebula.widgets.grid.Grid; +import org.eclipse.nebula.widgets.grid.GridItem; +import org.eclipse.swt.SWT; +import org.eclipse.swt.dnd.DND; +import org.eclipse.swt.dnd.DragSource; +import org.eclipse.swt.dnd.DragSourceAdapter; +import org.eclipse.swt.dnd.DragSourceEvent; +import org.eclipse.swt.dnd.TextTransfer; +import org.eclipse.swt.dnd.Transfer; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Composite; +import org.tizen.dynamicanalyzer.common.AnalyzerConstants; +import org.tizen.dynamicanalyzer.common.AnalyzerManager; +import org.tizen.dynamicanalyzer.logparser.LogCenterConstants; +import org.tizen.dynamicanalyzer.model.TableInput; +import org.tizen.dynamicanalyzer.nl.GLPageLabels; +import org.tizen.dynamicanalyzer.resources.ImageResources; +import org.tizen.dynamicanalyzer.sql.DBTableInfo; +import org.tizen.dynamicanalyzer.sql.DBTableManager; +import org.tizen.dynamicanalyzer.sql.SqlManager; +import org.tizen.dynamicanalyzer.ui.opengl.GLES20ErrorInformation; +import org.tizen.dynamicanalyzer.ui.opengl.data.GLContextDBEnum; +import org.tizen.dynamicanalyzer.ui.opengl.data.GLDataMaker; +import org.tizen.dynamicanalyzer.ui.opengl.data.GLSelectionData; +import org.tizen.dynamicanalyzer.ui.opengl.data.model.GLAPIData; +import org.tizen.dynamicanalyzer.ui.opengl.data.model.GLFrameData; +import org.tizen.dynamicanalyzer.ui.widgets.table.DAApiListTableComposite; +import org.tizen.dynamicanalyzer.ui.widgets.table.DATableDataFormat; + +public class GLAPIListTable extends DAApiListTableComposite { + private String[] columnNames = { GLPageLabels.GL_API_LIST_VIEW_INDEX, + GLPageLabels.GL_API_LIST_VIEW_TIME, + GLPageLabels.GL_API_LIST_VIEW_NAME, + GLPageLabels.GL_API_LIST_VIEW_PARAMETER, + GLPageLabels.GL_API_LIST_VIEW_ELAPSED_TIME, + GLPageLabels.GL_API_LIST_VIEW_ERROR }; + + private int[] columnSizes = { 40, 70, 120, 250, 100, 100 }; + private int[] columnAlignment = { SWT.RIGHT, SWT.LEFT, SWT.LEFT, SWT.LEFT, + SWT.LEFT, SWT.LEFT }; + + private int[] sortTypes = { AnalyzerConstants.SORT_TYPE_NUM, + AnalyzerConstants.SORT_TYPE_NUM, + AnalyzerConstants.SORT_TYPE_STRING, + AnalyzerConstants.SORT_TYPE_STRING, + AnalyzerConstants.SORT_TYPE_NUM, AnalyzerConstants.SORT_TYPE_STRING }; + + private int[] sourceColumns = { LogCenterConstants.SEQUENCE_NUMBER_INDEX, + LogCenterConstants.TIME_INDEX, LogCenterConstants.APINAME_INDEX, + LogCenterConstants.INPUTPARM_INDEX, LogCenterConstants.TIME_INDEX, + LogCenterConstants.ERROR_INDEX }; + + private boolean clearSecondSelection = false; + private int frameIndex = 0; + private List selectedTreeInvolvedOrdinalList = null; + private int selectedTreeInvolvedInsideColumnIndex = -1; + + public GLAPIListTable(Composite parent, int compStyle, int tableStyle) { + super(parent, compStyle, tableStyle); + + setTableName(GLPageLabels.GL_API_LIST_VIEW_TITLE); + setSortTypes(sortTypes); + setSourceColumns(sourceColumns); +// setFailedAPIColor(true); +// setColumnAlignment(columnAlignment); + setColumns(columnNames); + setColumnSize(columnSizes); + + table.addSelectionListener(new SelectionListener() { + @Override + public void widgetSelected(SelectionEvent e) { + int selectionIndex = table.getSelectionIndex(); + + GridItem[] items = table.getSelection(); + if (items == null) { + return; + } + + DATableDataFormat dataFormat = (DATableDataFormat) items[0] + .getData(); + long time = Long.parseLong(dataFormat.getData().get( + LogCenterConstants.TIME_INDEX)); + + GLSelectionData selData = new GLSelectionData(GLAPIListView.ID, + time, time, items, table, frameIndex); + AnalyzerManager.getCurrentPage().updatePage(selData); + AnalyzerManager.getCurrentPage().controlSelection( + GLAPIListView.ID); + updateTable(true); + table.setSelection(selectionIndex); + } + + @Override + public void widgetDefaultSelected(SelectionEvent e) { + } + }); + + DragSource dragSource = new DragSource(table, DND.DROP_COPY | DND.DROP_MOVE); + dragSource.setTransfer(new Transfer[] { TextTransfer.getInstance() }); + + dragSource.addDragListener(new DragSourceAdapter() { + public void dragSetData(DragSourceEvent event) { + DragSource ds = (DragSource) event.widget; + Grid grid = (Grid) ds.getControl(); + GridItem[] selection = grid.getSelection(); + event.data = frameIndex + GLDataMaker.DELIMITER + + selection[0].getText(); + } + + public void dragStart(DragSourceEvent event) { + event.image = ImageResources.GL_DROP_LEFT_ARROW; + } + }); + } + + public void updateTable(int index) { + if (index >= 0) { + frameIndex = index; + } + + selectedTreeInvolvedOrdinalList = null; + updateTable(false); + } + + public void updateTable(List treeOrdinalList, int insideColumnIndex) { + this.selectedTreeInvolvedOrdinalList = treeOrdinalList; + this.selectedTreeInvolvedInsideColumnIndex = insideColumnIndex; + updateTable(false); + } + + @Override + protected List makeTableInput() { + if (frameIndex < 0) { + return null; + } + + Map involvedMap = null; + Map insideColumnMap = null; + List> involvedInfoList = null; + if (!clearSecondSelection) { + if (selectedTreeInvolvedOrdinalList != null) { + DBTableManager dbManager = DBTableManager.getInstance(); + DBTableInfo tableInfo = dbManager + .getTableInfo(DBTableManager.TABLE_INDEX_GLES20_CONTEXT_DATA); + String[] colmunNames = { "Seq", + GLContextDBEnum.INVOLVED_ORDINAL.getcolumnName(), + GLContextDBEnum.INVOLVED_INDEX1.getcolumnName() }; + involvedInfoList = SqlManager.getInstance().selectQuery( + null, + colmunNames, + tableInfo.getTableName(), + "where " + GLContextDBEnum.FRAME_INDEX.getcolumnName() + + " = " + frameIndex); + } + + if (involvedInfoList != null) { + involvedMap = makeInvolveMap(involvedInfoList); + insideColumnMap = makeInsideColumnIndexMap(involvedInfoList); + } + } + + GLFrameData glFrameData = GLDataMaker.getInstance().getFrameData( + frameIndex); + List glAPIDataList = glFrameData.getGLApiDataList(); + List inputList = new ArrayList(); + for (GLAPIData glAPIData : glAPIDataList) { + List texts = new ArrayList(); + DATableDataFormat tableData = new DATableDataFormat( + glAPIData.getTime()); + tableData.setLogData(glAPIData.getLogData()); + + String seq = String.valueOf(glAPIData.getSeq()); + texts.add(seq); + texts.add(String.valueOf(glAPIData.getTime())); + texts.add(glAPIData.getName()); + texts.add(glAPIData.getParameter()); + texts.add(String.valueOf(glAPIData.getElapsedTime())); + texts.add(GLES20ErrorInformation.getError(glAPIData.getErrorNo())); + + TableInput tableInput = new TableInput(); + tableInput.setText(texts); + tableInput.setData(tableData); + inputList.add(tableInput); + + if (involvedMap != null) { + Boolean isInvolved = involvedMap.get(seq); + if (isInvolved != null) { + if (isInvolved) { + int insideColumnIndex = insideColumnMap.get(seq); + if (selectedTreeInvolvedInsideColumnIndex == -1) { + tableInput.setSecondSelection(true); + } else if (selectedTreeInvolvedInsideColumnIndex == insideColumnIndex) { + tableInput.setSecondSelection(true); + } else { + tableInput.setSecondSelection(false); + } + } else { + tableInput.setSecondSelection(false); + } + } else { + tableInput.setSecondSelection(false); + } + } else { + tableInput.setSecondSelection(false); + } + } + + return inputList; + } + + private Map makeInvolveMap( + List> involvedInfoList) { + Map map = new HashMap(); + + for (List involvedInfo : involvedInfoList) { + List involvedOrdinalList = Arrays.asList(involvedInfo + .get(1).split(GLDataMaker.DELIMITER)); + + for (int selectedTreeOrdinal : selectedTreeInvolvedOrdinalList) { + map.put(involvedInfo.get(0), false); + if (involvedOrdinalList.contains(String + .valueOf(selectedTreeOrdinal))) { + map.put(involvedInfo.get(0), true); + break; + } + } + } + + return map; + } + + private Map makeInsideColumnIndexMap( + List> involvedInfoList) { + Map map = new HashMap(); + + for (List involvedInfo : involvedInfoList) { + String seq = involvedInfo.get(0); + try { + int insideColumnIndex = Integer.parseInt(involvedInfo.get(2)); + map.put(seq, insideColumnIndex); + } catch (NumberFormatException e) { + System.out.println("init log"); + } + } + + return map; + } + + public void updateTable(boolean clearSecondSelection) { + this.clearSecondSelection = clearSecondSelection; + updateTable(); + } + + @Override + public void updateTable() { + GridItem[] selections = table.getSelection(); + List selSeqs = new ArrayList(); + for (int i = 0; i < selections.length; i++) { + DATableDataFormat tableData = (DATableDataFormat) selections[i] + .getData(); + List data = tableData.getData(); + selSeqs.add(data.get(LogCenterConstants.SEQUENCE_NUMBER_INDEX)); + } + table.removeAll(); + + List input = makeTableInput(); + if (null == input) { + return; + } + if (null != comparator) { + Collections.sort(input, comparator); + } + int[] sels = new int[selSeqs.size()]; + int iii = 0; + int focusIndex = -1; + int size = input.size(); + for (int i = 0; i < size; i++) { + GridItem gridItem = new GridItem(table, SWT.NONE); + DATableDataFormat gridData = (DATableDataFormat) input.get(i) + .getData(); + gridItem.setData(gridData); + + List text = input.get(i).getText(); + List images = input.get(i).getImages(); + int columnCount = text.size(); + for (int index = 0; index < columnCount; index++) { + gridItem.setText(index, text.get(index)); + + if (null != images && !images.isEmpty()) { + gridItem.setImage(index, images.get(index)); + } + } + + if (input.get(i).isInRange() && input.get(i).isSecondSelection()) { + gridItem.setBackground(intersectColor); + } else if (input.get(i).isSecondSelection()) { + gridItem.setBackground(secondSelectionColor); + } else if (input.get(i).isInRange()) { + gridItem.setBackground(rangeColor); + } + + if (gridData != null) { + long seqNum = gridData.getSelectionKey(); + for (int ii = 0; ii < selSeqs.size(); ii++) { + if (seqNum == Long.parseLong(selSeqs.get(ii))) { + sels[iii++] = i; + selSeqs.remove(ii); + } + } + if (seqNum == focusSeq) { + focusIndex = i; + } + } + } + +// table.setSelection(sels); + if (table.isFocusControl() && focusIndex > 0) { + table.setFocusItem(table.getItem(focusIndex)); + } + table.update(); + } + + @Override + public void clear() { + super.clear(); + frameIndex = 0; + } +} diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/ui/apiList/GLAPIListView.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/ui/apiList/GLAPIListView.java new file mode 100644 index 0000000..e8f3cb6 --- /dev/null +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/ui/apiList/GLAPIListView.java @@ -0,0 +1,102 @@ +/* + * Dynamic Analyzer + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * 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.opengl.ui.apiList; + +import org.eclipse.nebula.widgets.grid.GridItem; +import org.eclipse.swt.SWT; +import org.eclipse.swt.layout.FillLayout; +import org.eclipse.swt.widgets.Composite; +import org.tizen.dynamicanalyzer.common.DASelectionData; +import org.tizen.dynamicanalyzer.model.DAView; +import org.tizen.dynamicanalyzer.nl.GLPageLabels; +import org.tizen.dynamicanalyzer.resources.ColorResources; +import org.tizen.dynamicanalyzer.ui.opengl.data.GLContextTreeNodeData; +import org.tizen.dynamicanalyzer.ui.opengl.data.GLSelectionData; +import org.tizen.dynamicanalyzer.ui.opengl.ui.chart.GLChartView; +import org.tizen.dynamicanalyzer.ui.opengl.ui.context.GLContextView; +import org.tizen.dynamicanalyzer.ui.widgets.ViewContainer; + +public class GLAPIListView extends DAView { + public static final String ID = GLAPIListView.class.getName(); + + private ViewContainer viewContainer; + + private int[] innerMaxWeight = { 0, 100 }; + private int[] outerMaxWeight = { 100, 0 }; + + GLAPIListTable glAPIListTable; + + public GLAPIListView(Composite parent, int style) { + super(parent, style); + setLayout(new FillLayout()); + + viewContainer = new ViewContainer(this, true); + viewContainer.setTitleText(GLPageLabels.GL_API_LIST_VIEW_TITLE); + setMaxWeight(innerMaxWeight, outerMaxWeight); + + Composite contents = viewContainer.getContentArea(); + contents.setBackground(ColorResources.WINDOW_BG_COLOR); + contents.setLayout(new FillLayout()); + + glAPIListTable = new GLAPIListTable(contents, SWT.NONE, SWT.SINGLE + | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL); + } + + @Override + public void updateView() { + glAPIListTable.updateTable(false); + } + + @Override + public void updateView(DASelectionData data) { + String id = data.getViewId(); + if (id.equals(GLChartView.ID)) { + int frameIndex = ((GLSelectionData)data).getFrameIndex(); + + viewContainer.setTitleText(GLPageLabels.GL_API_LIST_VIEW_TITLE + + "(" + frameIndex + "frame)"); + glAPIListTable.updateTable(frameIndex); + } else if (id.equals(GLContextView.ID)) { + GridItem gridItem = (GridItem) data.getData(); + GLContextTreeNodeData nodeData = (GLContextTreeNodeData) gridItem + .getData(); + glAPIListTable.updateTable(nodeData.getInvolvedDBColumnIndexList(), + nodeData.getInsideColumnIndex1()); + } + } + + @Override + public void otherViewSelectionOccured() { + glAPIListTable.deselectAll(); + } + + @Override + public void clear() { + viewContainer.setTitleText(GLPageLabels.GL_API_LIST_VIEW_TITLE); + glAPIListTable.clear(); + } +} diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/ui/chart/GLChartView.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/ui/chart/GLChartView.java new file mode 100644 index 0000000..f862f83 --- /dev/null +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/ui/chart/GLChartView.java @@ -0,0 +1,360 @@ +/* + * Dynamic Analyzer + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * 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.opengl.ui.chart; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.StackLayout; +import org.eclipse.swt.layout.FillLayout; +import org.eclipse.swt.widgets.Composite; +import org.tizen.dynamicanalyzer.model.DAView; +import org.tizen.dynamicanalyzer.nl.GLPageLabels; +import org.tizen.dynamicanalyzer.nl.ThreadPageLabels; +import org.tizen.dynamicanalyzer.resources.ColorResources; +import org.tizen.dynamicanalyzer.resources.FontResources; +import org.tizen.dynamicanalyzer.resources.ImageResources; +import org.tizen.dynamicanalyzer.ui.common.SetRangeMarkerMouseMoveListener; +import org.tizen.dynamicanalyzer.ui.common.TimelineChartMouseTrackAdapter; +import org.tizen.dynamicanalyzer.ui.common.UICommonConstants; +import org.tizen.dynamicanalyzer.ui.opengl.data.GLDataMaker; +import org.tizen.dynamicanalyzer.ui.opengl.eventListner.BoundLineEventListener; +import org.tizen.dynamicanalyzer.ui.opengl.eventListner.GLFrameChartMouseEventListener; +import org.tizen.dynamicanalyzer.ui.opengl.eventListner.GLFramerateChartMouseEventListener; +import org.tizen.dynamicanalyzer.ui.range.RangeDataManager; +import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants; +import org.tizen.dynamicanalyzer.ui.timeline.logparser.LifecycleLogParser; +import org.tizen.dynamicanalyzer.ui.widgets.TitleComboPopupRenderer; +import org.tizen.dynamicanalyzer.ui.widgets.TitleComboRenderer; +import org.tizen.dynamicanalyzer.ui.widgets.ViewContainer; +import org.tizen.dynamicanalyzer.widgets.button.DACustomButtonRenderer; +import org.tizen.dynamicanalyzer.widgets.chart.DAChart; +import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlot; +import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlotIntervalMarker; +import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoard; +import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoardItem; +import org.tizen.dynamicanalyzer.widgets.combo.DACustomCombo; +import org.tizen.dynamicanalyzer.widgets.combo.DACustomComboSelectionListener; +import org.tizen.dynamicanalyzer.widgets.timeline.DATimeline; + +public class GLChartView extends DAView { + public static final String ID = GLChartView.class.getName(); + private static final int COMBO_HEIGHT = 24; + + private final RangeDataManager rangeDataManager = RangeDataManager + .getInstance(); + private final Composite contents; + private DAChartBoard frameChartBoard; + private DAChartBoard timeChartBoard; + private DACustomCombo frameCombo; + private DACustomCombo timeCombo; + private final StackLayout stackLayout; + + public GLChartView(Composite parent, int style) { + super(parent, style); + setLayout(new FillLayout()); + + ViewContainer viewContainer = new ViewContainer(this, false); + viewContainer.setTitleText(ThreadPageLabels.THREAD_CHART_TITLE); + + contents = viewContainer.getContentArea(); + contents.setBackground(ColorResources.WINDOW_BG_COLOR); + + stackLayout = new StackLayout(); + contents.setLayout(stackLayout); + + frameChartBoard = new DAChartBoard(contents, + GLPageLabels.GL_CHART_TITLE_FRAME, DAChartBoard.BOARD_STYLE_FRAME); + frameChartBoard.setNameFont(FontResources.CHART_NAME_FONT); + + timeChartBoard = new DAChartBoard(contents, + GLPageLabels.GL_CHART_TITLE_TIME); + timeChartBoard.setNameFont(FontResources.CHART_NAME_FONT); + + stackLayout.topControl = frameChartBoard; + + frameCombo = new DACustomCombo(frameChartBoard.getTitleComp(), SWT.NONE); + frameCombo.setImages(ImageResources.TIMELINE_DROPDOWN_NORMAL, + ImageResources.TIMELINE_DROPDOWN_HOVER, + ImageResources.TIMELINE_DROPDOWN_PUSH, + ImageResources.TIMELINE_DROPDOWN_NORMAL); + frameCombo.add(GLPageLabels.GL_CHART_TITLE_FRAME); + frameCombo.add(GLPageLabels.GL_CHART_TITLE_TIME); + frameCombo.setTextAlign(DACustomCombo.TEXT_ALIGN_CENTER); + frameCombo.select(0); + frameCombo.setComboButtonGradation( + ColorResources.DEVICE_APPLICATION_BUTTON_NORMAL_START, + ColorResources.DEVICE_APPLICATION_BUTTON_NORMAL_END, + ColorResources.DEVICE_APPLICATION_BUTTON_PUSH_START, + ColorResources.DEVICE_APPLICATION_BUTTON_PUSH_END, + ColorResources.DEVICE_APPLICATION_BUTTON_HOVER_START, + ColorResources.DEVICE_APPLICATION_BUTTON_HOVER_END, + ColorResources.DEVICE_APPLICATION_BUTTON_DISABLE_START, + ColorResources.DEVICE_APPLICATION_BUTTON_DISABLE_END); + frameCombo.setButtonImages(ImageResources.COMBO_DROPDOWN_UP, + ImageResources.COMBO_DROPDOWN_DOWN); + frameCombo.setEnabled(true); + frameCombo.setItemHeight(COMBO_HEIGHT); + frameCombo.setComboRender(new TitleComboRenderer()); + frameCombo.setComboPopupRender(new TitleComboPopupRenderer()); + frameCombo.setButtonRenderer(new DACustomButtonRenderer()); + frameCombo.addSelectionListener(new DACustomComboSelectionListener() { + @Override + public void selectionEvent(DACustomCombo combo) { + String selected = combo.getText(); + if (null == selected || selected.isEmpty()) { + return; + } + if (selected + .equals(GLPageLabels.GL_CHART_TITLE_TIME)) { + changeComboFrameToTime(); + } else { + return; + } + } + }); + + timeCombo = new DACustomCombo(timeChartBoard.getTitleComp(), SWT.NONE); + + timeCombo.setImages(ImageResources.TIMELINE_DROPDOWN_NORMAL, + ImageResources.TIMELINE_DROPDOWN_HOVER, + ImageResources.TIMELINE_DROPDOWN_PUSH, + ImageResources.TIMELINE_DROPDOWN_NORMAL); + timeCombo.add(GLPageLabels.GL_CHART_TITLE_FRAME); + timeCombo.add(GLPageLabels.GL_CHART_TITLE_TIME); + timeCombo.setTextAlign(DACustomCombo.TEXT_ALIGN_CENTER); + timeCombo.select(1); + timeCombo.setComboButtonGradation( + ColorResources.DEVICE_APPLICATION_BUTTON_NORMAL_START, + ColorResources.DEVICE_APPLICATION_BUTTON_NORMAL_END, + ColorResources.DEVICE_APPLICATION_BUTTON_PUSH_START, + ColorResources.DEVICE_APPLICATION_BUTTON_PUSH_END, + ColorResources.DEVICE_APPLICATION_BUTTON_HOVER_START, + ColorResources.DEVICE_APPLICATION_BUTTON_HOVER_END, + ColorResources.DEVICE_APPLICATION_BUTTON_DISABLE_START, + ColorResources.DEVICE_APPLICATION_BUTTON_DISABLE_END); + timeCombo.setButtonImages(ImageResources.COMBO_DROPDOWN_UP, + ImageResources.COMBO_DROPDOWN_DOWN); + timeCombo.setEnabled(true); + timeCombo.setItemHeight(COMBO_HEIGHT); + timeCombo.setComboRender(new TitleComboRenderer()); + timeCombo.setComboPopupRender(new TitleComboPopupRenderer()); + timeCombo.setButtonRenderer(new DACustomButtonRenderer()); + timeCombo.addSelectionListener(new DACustomComboSelectionListener() { + @Override + public void selectionEvent(DACustomCombo combo) { + String selected = combo.getText(); + if (null == selected || selected.isEmpty()) { + return; + } + if (selected + .equals(GLPageLabels.GL_CHART_TITLE_FRAME)) { + changeComboTimeToFrame(); + } else { + return; + } + } + }); + + frameChartBoard.setSelection(false); + initializeCharts(); + + DATimeline frameTimeline = frameChartBoard.getTimeline(); + DATimeline timeTimeline = timeChartBoard.getTimeline(); + + frameTimeline.setTimeTickFont(FontResources.TIMELINE_TICK_FONT); + frameTimeline.setTimeBalloonFont(FontResources.TIMELINE_BALLOON_FONT); + frameTimeline.addMouseMoveListener(new SetRangeMarkerMouseMoveListener( + rangeDataManager, frameChartBoard, frameTimeline)); + timeTimeline.setTimeTickFont(FontResources.TIMELINE_TICK_FONT); + timeTimeline.setTimeBalloonFont(FontResources.TIMELINE_BALLOON_FONT); + + LifecycleLogParser.getInstance().registerLifecycleBar( + frameChartBoard.getLifecycleBar()); + LifecycleLogParser.getInstance().registerTimeline(frameTimeline); + LifecycleLogParser.getInstance().registerLifecycleBar( + timeChartBoard.getLifecycleBar()); + LifecycleLogParser.getInstance().registerTimeline(timeTimeline); + + setTimelineMouseListener(frameTimeline, frameChartBoard); + setTimelineMouseListener(timeTimeline, timeChartBoard); + + } + + private void setTimelineMouseListener(final DATimeline timeline, + DAChartBoard chartBoard) { + timeline.addMouseMoveListener(new SetRangeMarkerMouseMoveListener( + rangeDataManager, chartBoard, timeline)); + } + + private void changeComboFrameToTime() { + stackLayout.topControl = timeChartBoard; + contents.layout(); + timeCombo.setText(GLPageLabels.GL_CHART_TITLE_TIME); + timeChartBoard.setScaleVal(frameChartBoard.getScaleVal()); + timeChartBoard.setVisibleStart(frameChartBoard.getVisibleStart()); + timeChartBoard.setZoomout(frameChartBoard.isZoomout()); + // callUpdatePage(frameChartBoard.getSelectItem()); + updateView(); + } + + private void changeComboTimeToFrame() { + stackLayout.topControl = frameChartBoard; + contents.layout(); + frameCombo.setText(GLPageLabels.GL_CHART_TITLE_FRAME); + frameChartBoard.setScaleVal(timeChartBoard.getScaleVal()); + frameChartBoard.setVisibleStart(timeChartBoard.getVisibleStart()); + frameChartBoard.setZoomout(timeChartBoard.isZoomout()); + // callUpdatePage(timeChartBoard.getSelectItem()); + updateView(); + } + + @Override + public void updateView() { + frameChartBoard.setTotalEndTime(GLDataMaker.getInstance().getFrameSize() + * TimelineConstants.MEGA_LONG); + timeChartBoard.setTotalEndTime(GLDataMaker.getInstance().getFrameSize() + * TimelineConstants.MEGA_LONG); + + frameChartBoard.setTimelineMarkerStartTime(rangeDataManager + .getMarkerStartTime() / TimelineConstants.MEGA_DOUBLE); + frameChartBoard.setTimelineMarkerEndTime(rangeDataManager + .getMarkerEndTime() / TimelineConstants.MEGA_DOUBLE); + timeChartBoard.setTimelineMarkerStartTime(rangeDataManager + .getMarkerStartTime() / TimelineConstants.MEGA_DOUBLE); + timeChartBoard.setTimelineMarkerEndTime(rangeDataManager + .getMarkerEndTime() / TimelineConstants.MEGA_DOUBLE); + + if (RangeDataManager.getInstance().isBeingAnalyzed()) { + ((DAChartPlotIntervalMarker) frameChartBoard.getMarkers().get( + UICommonConstants.RANGE_ANALYSIS_MARKER_INDEX)) + .setInterval(rangeDataManager.getAnalysisStartTime() + / TimelineConstants.MEGA_DOUBLE, + rangeDataManager.getAnalysisEndTime() + / TimelineConstants.MEGA_DOUBLE); + + ((DAChartPlotIntervalMarker) timeChartBoard.getMarkers().get( + UICommonConstants.RANGE_ANALYSIS_MARKER_INDEX)) + .setInterval(rangeDataManager.getAnalysisStartTime() + / TimelineConstants.MEGA_DOUBLE, + rangeDataManager.getAnalysisEndTime() + / TimelineConstants.MEGA_DOUBLE); + } else { + ((DAChartPlotIntervalMarker) frameChartBoard.getMarkers().get( + UICommonConstants.RANGE_ANALYSIS_MARKER_INDEX)) + .setInterval(-1, -1); + } + + ((DAChartPlotIntervalMarker) frameChartBoard.getMarkers().get( + UICommonConstants.RANGE_MARKER_INDEX)).setInterval( + rangeDataManager.getMarkerStartTime() / TimelineConstants.MEGA_DOUBLE, + rangeDataManager.getMarkerEndTime() / TimelineConstants.MEGA_DOUBLE); + } + + @Override + public void clear() { + frameChartBoard.contentsClear(); + frameChartBoard.clear(); + timeChartBoard.contentsClear(); + timeChartBoard.clear(); + initializeCharts(); + } + + private void initializeCharts() { + initIntervalMarkers(frameChartBoard); + + GLFPSChart fpsChart = GLFPSChart.getInstance(); + DAChartBoardItem fpsChartItem = fpsChart.createBoardItem(frameChartBoard); + DAChart fpsChartWidget = fpsChartItem.getChart(); + + GLFrameChartMouseEventListener glFrameChartMouseEventListener = new GLFrameChartMouseEventListener( + fpsChart.getPopupMenu(), frameChartBoard.getTimeline()); + + fpsChartWidget.getPlot().setMarkers(frameChartBoard.getMarkers()); + fpsChartWidget.addMouseListener(glFrameChartMouseEventListener); + fpsChartWidget.addMouseMoveListener(glFrameChartMouseEventListener); + fpsChartWidget.addMouseTrackListener(new TimelineChartMouseTrackAdapter( + frameChartBoard.getTimeline())); + + BoundLineEventListener tempListener = new BoundLineEventListener(fpsChartWidget, DAChartPlot.BoundType.UNDER); + fpsChartWidget.addMouseListener(tempListener); + fpsChartWidget.addMouseMoveListener(tempListener); + fpsChartWidget.addMouseTrackListener(tempListener); + + GLElapsedTimeChart elapsedTimeChart = GLElapsedTimeChart.getInstance(); + DAChartBoardItem elapsedTimeChartItem = elapsedTimeChart.createBoardItem(frameChartBoard); + DAChart elapsedChartWidget = elapsedTimeChartItem.getChart(); + + elapsedChartWidget.getPlot().setMarkers(frameChartBoard.getMarkers()); + elapsedChartWidget.addMouseListener(glFrameChartMouseEventListener); + elapsedChartWidget.addMouseMoveListener(glFrameChartMouseEventListener); + elapsedChartWidget.addMouseTrackListener(new TimelineChartMouseTrackAdapter( + frameChartBoard.getTimeline())); + + BoundLineEventListener tempListener2 = new BoundLineEventListener(elapsedChartWidget, DAChartPlot.BoundType.UPPER); + elapsedChartWidget.addMouseListener(tempListener2); + elapsedChartWidget.addMouseMoveListener(tempListener2); + elapsedChartWidget.addMouseTrackListener(tempListener2); + + + initIntervalMarkers(timeChartBoard); + + GLFrameRateChart glTimeChart = GLFrameRateChart.getInstance(); + DAChartBoardItem glTimeChartItem = glTimeChart.createBoardItem(timeChartBoard); + DAChart glTimeChartWidget = glTimeChartItem.getChart(); + + GLFramerateChartMouseEventListener glTimeChartMouseEventListener = new GLFramerateChartMouseEventListener( + glTimeChart.getPopupMenu(), timeChartBoard.getTimeline()); + + glTimeChartWidget.getPlot().setMarkers(timeChartBoard.getMarkers()); + glTimeChartWidget.addMouseListener(glTimeChartMouseEventListener); + glTimeChartWidget.addMouseMoveListener(glTimeChartMouseEventListener); + glTimeChartWidget.addMouseTrackListener(new TimelineChartMouseTrackAdapter( + timeChartBoard.getTimeline())); + } + + private void initIntervalMarkers(DAChartBoard board) { + // selection marker + DAChartPlotIntervalMarker selectionMarker = new DAChartPlotIntervalMarker( + -1, -1, DAChartPlotIntervalMarker.INTERVAL_MARKER_STYLE_AREA); + selectionMarker.setBackgroundColor(ColorResources.SELECTION_RANGE); + selectionMarker.setAlpha((int) (255 * 0.25)); + board.addIntervalMarker(selectionMarker); + + // range analysis marker + DAChartPlotIntervalMarker rangeAnalyzeMarker = new DAChartPlotIntervalMarker( + -1, -1, DAChartPlotIntervalMarker.INTERVAL_MARKER_STYLE_AREA); + rangeAnalyzeMarker.setBackgroundColor(ColorResources.YELLOW); + rangeAnalyzeMarker.setAlpha((int) (255 * 0.25)); + board.addIntervalMarker(rangeAnalyzeMarker); + + // range marker + DAChartPlotIntervalMarker rangeMarker = new DAChartPlotIntervalMarker( + -1, -1, DAChartPlotIntervalMarker.INTERVAL_MARKER_STYLE_LINE); + rangeMarker.setForegroundColor(ColorResources.RED); + rangeMarker.setAlpha((int) (255 * 0.25)); + board.addIntervalMarker(rangeMarker); + } +} diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/ui/chart/GLElapsedTimeChart.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/ui/chart/GLElapsedTimeChart.java new file mode 100644 index 0000000..ace1eac --- /dev/null +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/ui/chart/GLElapsedTimeChart.java @@ -0,0 +1,68 @@ +package org.tizen.dynamicanalyzer.ui.opengl.ui.chart; + +import org.tizen.dynamicanalyzer.resources.ColorResources; +import org.tizen.dynamicanalyzer.resources.ImageResources; +import org.tizen.dynamicanalyzer.swap.logparser.LogPackage; +import org.tizen.dynamicanalyzer.ui.timeline.chart.TimelineChart; +import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlot; +import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlot.AutoRangeType; +import org.tizen.dynamicanalyzer.widgets.chart.DAChartSeries; +import org.tizen.dynamicanalyzer.widgets.chart.DAChartSeriesItem; +import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoard; +import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoardItem; + +public class GLElapsedTimeChart extends TimelineChart { + private static GLElapsedTimeChart instance = null; + private static final String MS = "ms"; + + private DAChartSeries elapsedTimeSeries; + + public static GLElapsedTimeChart getInstance() { + if (instance == null) { + instance = new GLElapsedTimeChart(); + } + + return instance; + } + + private GLElapsedTimeChart() { + chartName = "Elapsed time"; + chartIcon = ImageResources.CHART_CPU; + elapsedTimeSeries = new DAChartSeries(chartName, + DAChartSeries.SERIES_STYLE_BAR, + ColorResources.SERIES_COLOR_CPU_APP); + } + + @Override + public DAChartBoardItem createBoardItem(DAChartBoard chartBoard) { + DAChartBoardItem item = super.createBoardItem(chartBoard); + + chart.addSeries(elapsedTimeSeries); + + chart.getPlot().setSeriesHeightRange(true); + chart.getPlot().setAutoHeightRange(AutoRangeType.AUTO); + chart.getPlot().setAxisUnit(MS); + chart.getPlot().setAxisUnitType(DAChartPlot.UnitType.GL_MS); + chart.getPlot().setShowAxis(true); + + return item; + } + + @Override + public void parseLogPackage(LogPackage logPack) { + } + + public void addData(final int frameNumber, long elapsedTime, + boolean drawError) { + double fps = Math.round(1000 / (double) elapsedTime); + if (drawError) { + elapsedTimeSeries.addSeriesItem(new DAChartSeriesItem(frameNumber, + elapsedTime, ColorResources.RED, String + .valueOf(elapsedTime) + MS + "(" + fps + "fps)")); + } else { + elapsedTimeSeries.addSeriesItem(new DAChartSeriesItem(frameNumber, + elapsedTime, String.valueOf(elapsedTime) + MS + "(" + fps + + "fps)")); + } + } +} diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/ui/chart/GLFPSChart.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/ui/chart/GLFPSChart.java new file mode 100644 index 0000000..adfaf34 --- /dev/null +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/ui/chart/GLFPSChart.java @@ -0,0 +1,84 @@ +package org.tizen.dynamicanalyzer.ui.opengl.ui.chart; + +import org.tizen.dynamicanalyzer.resources.ColorResources; +import org.tizen.dynamicanalyzer.resources.ImageResources; +import org.tizen.dynamicanalyzer.swap.logparser.LogPackage; +import org.tizen.dynamicanalyzer.ui.timeline.chart.TimelineChart; +import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlot; +import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlot.AutoRangeType; +import org.tizen.dynamicanalyzer.widgets.chart.DAChartSeries; +import org.tizen.dynamicanalyzer.widgets.chart.DAChartSeriesItem; +import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoard; +import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoardItem; +import org.tizen.dynamicanalyzer.widgets.helper.Formatter; + +public class GLFPSChart extends TimelineChart { + private static GLFPSChart instance = null; + private static final String FPS = "fps"; + + private DAChartSeries fpsSeries; + + public static GLFPSChart getInstance() { + if (instance == null) { + instance = new GLFPSChart(); + } + + return instance; + } + + private GLFPSChart() { + chartName = "FPS"; + chartIcon = ImageResources.CHART_CPU; + fpsSeries = new DAChartSeries(chartName, + DAChartSeries.SERIES_STYLE_BAR, + ColorResources.SERIES_COLOR_CPU_APP); + } + + @Override + public DAChartBoardItem createBoardItem(DAChartBoard chartBoard) { + DAChartBoardItem item = super.createBoardItem(chartBoard); + + chart.addSeries(fpsSeries); + + chart.getPlot().setSeriesHeightRange(true); + chart.getPlot().setAutoHeightRange(AutoRangeType.AUTO); + chart.getPlot().setAxisUnit(FPS); + chart.getPlot().setAxisUnitType(DAChartPlot.UnitType.GL_FPS); + chart.getPlot().setShowAxis(true); + + return item; + } + + @Override + public void parseLogPackage(LogPackage logPack) { + } + + public void addData(final int frameNumber, long elapsedTime, + boolean drawError) { + double fps = Math.round(1000 / (double) elapsedTime); + if (drawError) { + fpsSeries + .addSeriesItem(new DAChartSeriesItem( + frameNumber, + fps, + ColorResources.RED, + String.valueOf(fps) + + FPS + + "(" + + Formatter + .toByteFormatConvertDecimalPrefix(elapsedTime) + + "ms)")); + } else { + fpsSeries + .addSeriesItem(new DAChartSeriesItem( + frameNumber, + fps, + String.valueOf(fps) + + FPS + + "(" + + Formatter + .toByteFormatConvertDecimalPrefix(elapsedTime) + + "ms)")); + } + } +} diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/ui/chart/GLFrameRateChart.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/ui/chart/GLFrameRateChart.java new file mode 100644 index 0000000..7670f10 --- /dev/null +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/ui/chart/GLFrameRateChart.java @@ -0,0 +1,109 @@ +/* + * Dynamic Analyzer + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * 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.opengl.ui.chart; + +import org.tizen.dynamicanalyzer.resources.ColorResources; +import org.tizen.dynamicanalyzer.resources.ImageResources; +import org.tizen.dynamicanalyzer.swap.logparser.LogPackage; +import org.tizen.dynamicanalyzer.ui.timeline.chart.TimelineChart; +import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlot; +import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlot.AutoRangeType; +import org.tizen.dynamicanalyzer.widgets.chart.DAChartSeries; +import org.tizen.dynamicanalyzer.widgets.chart.DAChartSeriesItem; +import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoard; +import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoardItem; +import org.tizen.dynamicanalyzer.widgets.helper.Formatter; + +public class GLFrameRateChart extends TimelineChart { + private static GLFrameRateChart instance = null; + private static final String MS = "ms"; + + private DAChartSeries framerateSeries; + private int selectedFrameIndex; + + public int getSelectedFrameIndex() { + return selectedFrameIndex; + } + + public void setSelectedFrameIndex(int index) { + selectedFrameIndex = index; + } + + public static GLFrameRateChart getInstance() { + if (instance == null) { + instance = new GLFrameRateChart(); + } + + return instance; + } + + private GLFrameRateChart() { + chartName = "Framerate"; + chartIcon = ImageResources.CHART_CPU; + framerateSeries = new DAChartSeries(chartName, + DAChartSeries.SERIES_STYLE_BAR, + ColorResources.SERIES_COLOR_CPU_APP); + } + + @Override + public DAChartBoardItem createBoardItem(DAChartBoard chartBoard) { + DAChartBoardItem item = super.createBoardItem(chartBoard); + + chart.addSeries(framerateSeries); + + chart.getPlot().setSeriesHeightRange(true); + chart.getPlot().setAutoHeightRange(AutoRangeType.AUTO); + chart.getPlot().setAxisUnit(MS); + chart.getPlot().setAxisUnitType(DAChartPlot.UnitType.GL_MS); + chart.getPlot().setShowAxis(true); + + return item; + } + + @Override + public void parseLogPackage(LogPackage logPack) { + } + + public void addData(final int frameNumber, long elapsedTime, + boolean drawError) { + double fps = Math.round(1000 / (double) elapsedTime); + if (drawError) { + framerateSeries.addSeriesItem(new DAChartSeriesItem(frameNumber, + elapsedTime, ColorResources.RED, String + .valueOf(elapsedTime) + + MS + + "(" + + Formatter.toByteFormatConvertDecimalPrefix(fps) + + "fps)")); + } else { + framerateSeries.addSeriesItem(new DAChartSeriesItem(frameNumber, + elapsedTime, String.valueOf(elapsedTime) + MS + "(" + + Formatter.toByteFormatConvertDecimalPrefix(fps) + + "fps)")); + } + } +} diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/ui/context/GLContextTreeTable.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/ui/context/GLContextTreeTable.java new file mode 100644 index 0000000..18087f5 --- /dev/null +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/ui/context/GLContextTreeTable.java @@ -0,0 +1,1349 @@ +/* + * Dynamic Analyzer + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * 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.opengl.ui.context; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Timer; +import java.util.TimerTask; + +import org.eclipse.nebula.widgets.grid.GridItem; +import org.eclipse.swt.SWT; +import org.eclipse.swt.dnd.DND; +import org.eclipse.swt.dnd.DropTarget; +import org.eclipse.swt.dnd.DropTargetAdapter; +import org.eclipse.swt.dnd.DropTargetEvent; +import org.eclipse.swt.dnd.TextTransfer; +import org.eclipse.swt.dnd.Transfer; +import org.eclipse.swt.events.MouseEvent; +import org.eclipse.swt.events.MouseListener; +import org.eclipse.swt.events.PaintEvent; +import org.eclipse.swt.events.PaintListener; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Listener; +import org.tizen.dynamicanalyzer.common.AnalyzerConstants; +import org.tizen.dynamicanalyzer.common.AnalyzerManager; +import org.tizen.dynamicanalyzer.common.DASelectionData; +import org.tizen.dynamicanalyzer.model.TreeInput; +import org.tizen.dynamicanalyzer.nl.GLPageLabels; +import org.tizen.dynamicanalyzer.resources.ColorResources; +import org.tizen.dynamicanalyzer.sql.DBTableInfo; +import org.tizen.dynamicanalyzer.sql.DBTableManager; +import org.tizen.dynamicanalyzer.sql.SqlManager; +import org.tizen.dynamicanalyzer.ui.opengl.data.GLContextDBEnum; +import org.tizen.dynamicanalyzer.ui.opengl.data.GLContextTreeNodeData; +import org.tizen.dynamicanalyzer.ui.opengl.data.GLDataMaker; +import org.tizen.dynamicanalyzer.ui.widgets.table.DATableDataFormat; +import org.tizen.dynamicanalyzer.ui.widgets.table.DATreeComposite; + +public class GLContextTreeTable extends DATreeComposite { + private static final int BASE_TREE_SELECTION_SEQ = 0; + private static final int GVA_TREE_SELECTION_SEQ = 100; + private static final int TEXTURE_UNIT_TREE_SELECTION_SEQ = 500; + private static final int TEXTURE_OBJ_TREE_SELECTION_SEQ = 600; + private static final int SHADER_OBJ_TREE_SELECTION_SEQ = 1000; + private static final int PROGRMA_OBJ_TREE_SELECTION_SEQ = 2000; + private static GLContextTreeTable instance = null; + + private static final int COLUMN_SIZE_NAME = 200; + private static final int COLUMN_SIZE_VALUE = 100; + private static final int COLUMN_SIZE_DIFF = 100; + + private String[] columnNames = { GLPageLabels.GL_CONTEXT_VIEW_NAME, + GLPageLabels.GL_CONTEXT_VIEW_VALUE, + GLPageLabels.GL_CONTEXT_VIEW_PREV }; + private int[] columnSizes = { COLUMN_SIZE_NAME, COLUMN_SIZE_VALUE, + COLUMN_SIZE_DIFF }; + private int[] sortTypes = { AnalyzerConstants.SORT_TYPE_NONE, + AnalyzerConstants.SORT_TYPE_NONE, AnalyzerConstants.SORT_TYPE_NONE }; + + private String seq; + private List contextValueList; + private List prevContextValueList; + private List contextTree; + TreeInput nodeGVAs; + TreeInput nodeGVAArrays; + TreeInput nodeTextureUnits; + TreeInput nodeTextureObject; + TreeInput nodeProgramObject; + TreeInput nodeShaderObject; + + private Timer timer; + private boolean drawDiffArea = false; + private int diffAreaAlpha = 0; + + public static GLContextTreeTable getInstance(Composite parent, + int compStyle, int tableStyle) { + if (instance == null) { + instance = new GLContextTreeTable(parent, compStyle, tableStyle); + } + + return instance; + } + + public static GLContextTreeTable getInstance() { + return instance; + } + + private GLContextTreeTable(Composite parent, int compStyle, int tableStyle) { + super(parent, compStyle, tableStyle); + setTree(true); + setSortTypes(sortTypes); + setColumns(columnNames); + setColumnSize(columnSizes); + + + table.addListener(SWT.Expand, new Listener() { + @Override + public void handleEvent(Event event) { + GridItem item = (GridItem) event.item; + setExpand(item, true); + } + }); + + table.addListener(SWT.Collapse, new Listener() { + @Override + public void handleEvent(Event event) { + GridItem item = (GridItem) event.item; + setExpand(item, false); + } + }); + + table.addSelectionListener(new SelectionListener() { + @Override + public void widgetSelected(SelectionEvent e) { + int selectionIndex = table.getSelectionIndex(); + + GridItem[] items = table.getSelection(); + if (items == null || items.length <= 0) { + return; + } + + DASelectionData selData = new DASelectionData(GLContextView.ID, + 0, 0, items[0], table); + AnalyzerManager.getCurrentPage().updatePage(selData); + AnalyzerManager.getCurrentPage().controlSelection( + GLContextView.ID); + + for (TreeInput treeInput : contextTree) { + clearSecondSelection(treeInput); + } + seq = null; + updateTree(); + table.setSelection(selectionIndex); + } + + @Override + public void widgetDefaultSelected(SelectionEvent e) { + } + }); + + table.addMouseListener(new MouseListener() { + @Override + public void mouseUp(MouseEvent e) { + } + + @Override + public void mouseDown(MouseEvent e) { + } + + @Override + public void mouseDoubleClick(MouseEvent e) { + GridItem[] items = (GridItem[]) table.getSelection(); + if (null == items || items.length == 0) { + return; + } + GridItem item = items[0]; + if (item.isExpanded()) { + setExpand(item, false); + } else { + setExpand(item, true); + } + updateTree(); + } + }); + + DropTarget target = new DropTarget(table, DND.DROP_COPY | DND.DROP_MOVE); + target.setTransfer(new Transfer[] { TextTransfer.getInstance() }); + target.addDropListener(new DropTargetAdapter() { + public void dragEnter(DropTargetEvent event) { + drawDiffArea = true; + + timer = new Timer(); + timer.schedule(new TimerTask() { + @Override + public void run() { + if (diffAreaAlpha < 80) { + diffAreaAlpha += 10; + + redrawDiffArea(); + } + } + }, 0, 50); + } + + public void dragLeave(DropTargetEvent event) { + drawDiffArea = false; + + if(timer != null) { + timer.cancel(); + diffAreaAlpha = 0; + + redrawDiffArea(); + } + } + + public void drop(DropTargetEvent event) { + drawDiffArea = false; + + if (timer != null) { + timer.cancel(); + diffAreaAlpha = 0; + } + + String[] data = ((String) event.data) + .split(GLDataMaker.DELIMITER); + String frameIndex = data[0]; + String seq = data[1]; + + DBTableManager dbManager = DBTableManager.getInstance(); + DBTableInfo tableInfo = dbManager + .getTableInfo(DBTableManager.TABLE_INDEX_GLES20_CONTEXT_DATA); + prevContextValueList = SqlManager + .getInstance() + .selectQuery(null, tableInfo.getColumnNames(), + tableInfo.getTableName(), "where Seq = " + seq) + .get(0); + getTable().getColumn(2).setText( + GLPageLabels.GL_CONTEXT_VIEW_PREV + "(" + frameIndex + + "f #" + seq + ")"); + } + }); + + table.addPaintListener(new PaintListener() { + @Override + public void paintControl(PaintEvent e) { + if (drawDiffArea) { + GC gc = e.gc; + Color oriColor = gc.getForeground(); + int oriAlpha = gc.getAlpha(); + + gc.setBackground(ColorResources.RED); + gc.setAlpha(diffAreaAlpha); + + e.gc.fillRectangle(table.getColumn(0).getWidth() + + table.getColumn(1).getWidth(), 20, table + .getColumn(2).getWidth(), table.getBounds().height); + + gc.setBackground(oriColor); + gc.setAlpha(oriAlpha); + } + } + }); + + contextTree = new ArrayList(); + + initContextTree(); + } + + private void redrawDiffArea() { + Display.getDefault().asyncExec(new Runnable() { + @Override + public void run() { + table.redraw(table.getColumn(0).getWidth() + + table.getColumn(1).getWidth(), 20, table.getColumn(2) + .getWidth(), table.getBounds().height, false); + } + }); + } + + private void setNodeProperty(TreeInput treeInput) { + List textList = new ArrayList(); + GLContextTreeNodeData nodeData = (GLContextTreeNodeData) treeInput + .getData(); + textList.add(nodeData.getNodeName()); + + String value; + String diff = null; + + int columnIndex = nodeData.getDBColumnIndex(); + if (columnIndex == -1) { + textList.add(value = GLDataMaker.EMPTY); + treeInput.setSecondSelection(false); + } else { + int insideColmunIndex1 = nodeData.getInsideColumnIndex1(); + if (insideColmunIndex1 >= 0) { + int insideColmunIndex2 = nodeData.getInsideColumnIndex2(); + if (insideColmunIndex2 >= 0) { + textList.add(value = contextValueList.get(columnIndex).split( + GLDataMaker.DELIMITER)[insideColmunIndex1] + .split(GLDataMaker.COMMA)[insideColmunIndex2]); + } else { + textList.add(value = contextValueList.get(columnIndex).split( + GLDataMaker.DELIMITER)[insideColmunIndex1]); + } + } else { + textList.add(value = contextValueList.get(columnIndex)); + } + + List involvedOrdinalList = new ArrayList( + Arrays.asList(contextValueList.get( + GLContextDBEnum.INVOLVED_ORDINAL.ordinal()).split( + GLDataMaker.DELIMITER))); + if (involvedOrdinalList.contains(String.valueOf(columnIndex))) { + int involvedIndex1 = Integer.parseInt(contextValueList + .get(GLContextDBEnum.INVOLVED_INDEX1.ordinal())); + if (involvedIndex1 == -1 || involvedIndex1 == insideColmunIndex1) { + treeInput.setSecondSelection(true); + setAncestorSecondSelection(treeInput); + } else { + treeInput.setSecondSelection(false); + } + } else { + treeInput.setSecondSelection(false); + } + } + treeInput.setText(textList); + + // diff + if (columnIndex == -1 || prevContextValueList == null) { + textList.add(GLDataMaker.EMPTY); + } else { + try { + int insideColmunIndex1 = nodeData.getInsideColumnIndex1(); + if (insideColmunIndex1 >= 0) { + int insideColmunIndex2 = nodeData.getInsideColumnIndex2(); + if (insideColmunIndex2 >= 0) { + diff = prevContextValueList.get(columnIndex).split( + GLDataMaker.DELIMITER)[insideColmunIndex1] + .split(GLDataMaker.COMMA)[insideColmunIndex2]; + } else { + diff = prevContextValueList.get(columnIndex).split( + GLDataMaker.DELIMITER)[insideColmunIndex1]; + } + } else { + diff = prevContextValueList.get(columnIndex); + } + } catch(ArrayIndexOutOfBoundsException e) { + diff = GLDataMaker.EMPTY; + } finally { + if(diff.equals(value)) { + textList.add(GLDataMaker.EMPTY); + } else { + textList.add(diff); + } + } + } + treeInput.setText(textList); + // end of diff + + for (TreeInput child : treeInput.getChildren()) { + setNodeProperty(child); + } + } + + private void clearSecondSelection(TreeInput treeInput) { + treeInput.setSecondSelection(false); + for (TreeInput child : treeInput.getChildren()) { + clearSecondSelection(child); + } + } + + private void setAncestorSecondSelection(TreeInput child) { + TreeInput parent = child.getParentInput(); + if (parent != null) { + parent.setSecondSelection(true); + setAncestorSecondSelection(parent); + } + } + + public void initGVA(int maxVertexAttrib) { + int treeSelectionSeq = GVA_TREE_SELECTION_SEQ; + + for (int i = 0; i < maxVertexAttrib; i++) { + TreeInput nodeGVAIndex = new TreeInput(); + nodeGVAIndex.setData(new GLContextTreeNodeData(++treeSelectionSeq, -1, i, String + .valueOf(i), + GLContextDBEnum.GVA_V0.ordinal(), + GLContextDBEnum.GVA_V1.ordinal(), + GLContextDBEnum.GVA_V2.ordinal(), + GLContextDBEnum.GVA_V3.ordinal())); + nodeGVAs.addChild(nodeGVAIndex); + { + TreeInput nodeV0 = new TreeInput(); + nodeV0.setData(new GLContextTreeNodeData(++treeSelectionSeq, GLContextDBEnum.GVA_V0 + .ordinal(), i, GLPageLabels.GL_CONTEXT_V0)); + nodeGVAIndex.addChild(nodeV0); + + TreeInput nodeV1 = new TreeInput(); + nodeV1.setData(new GLContextTreeNodeData(++treeSelectionSeq, GLContextDBEnum.GVA_V1 + .ordinal(), i, GLPageLabels.GL_CONTEXT_V1)); + nodeGVAIndex.addChild(nodeV1); + + TreeInput nodeV2 = new TreeInput(); + nodeV2.setData(new GLContextTreeNodeData(++treeSelectionSeq, GLContextDBEnum.GVA_V2 + .ordinal(), i, GLPageLabels.GL_CONTEXT_V2)); + nodeGVAIndex.addChild(nodeV2); + + TreeInput nodeV3 = new TreeInput(); + nodeV3.setData(new GLContextTreeNodeData(++treeSelectionSeq, GLContextDBEnum.GVA_V3 + .ordinal(), i, GLPageLabels.GL_CONTEXT_V3)); + nodeGVAIndex.addChild(nodeV3); + } + + TreeInput nodeGVAArrayIndex = new TreeInput(); + nodeGVAArrayIndex.setData(new GLContextTreeNodeData(++treeSelectionSeq, + GLContextDBEnum.GVA_ENABLED.ordinal(), i, + String.valueOf(i), + GLContextDBEnum.GVA_SIZE.ordinal(), + GLContextDBEnum.GVA_TYPE.ordinal(), + GLContextDBEnum.GVA_NORMAL.ordinal(), + GLContextDBEnum.GVA_STRIDE.ordinal(), + GLContextDBEnum.GVA_POINTER.ordinal())); + nodeGVAArrays.addChild(nodeGVAArrayIndex); + { + TreeInput nodeSize = new TreeInput(); + nodeSize.setData(new GLContextTreeNodeData(++treeSelectionSeq, + GLContextDBEnum.GVA_SIZE.ordinal(), i, + GLPageLabels.GL_CONTEXT_SIZE)); + nodeGVAArrayIndex.addChild(nodeSize); + + TreeInput nodeType = new TreeInput(); + nodeType.setData(new GLContextTreeNodeData(++treeSelectionSeq, + GLContextDBEnum.GVA_TYPE.ordinal(), i, + GLPageLabels.GL_CONTEXT_TYPE)); + nodeGVAArrayIndex.addChild(nodeType); + + TreeInput nodeNormal = new TreeInput(); + nodeNormal.setData(new GLContextTreeNodeData(++treeSelectionSeq, + GLContextDBEnum.GVA_NORMAL.ordinal(), i, + GLPageLabels.GL_CONTEXT_NORMALIZED)); + nodeGVAArrayIndex.addChild(nodeNormal); + + TreeInput nodeStride = new TreeInput(); + nodeStride.setData(new GLContextTreeNodeData(++treeSelectionSeq, + GLContextDBEnum.GVA_STRIDE.ordinal(), i, + GLPageLabels.GL_CONTEXT_STRIDE)); + nodeGVAArrayIndex.addChild(nodeStride); + + TreeInput nodePointer = new TreeInput(); + nodePointer.setData(new GLContextTreeNodeData(++treeSelectionSeq, + GLContextDBEnum.GVA_POINTER.ordinal(), i, + GLPageLabels.GL_CONTEXT_POINTER)); + nodeGVAArrayIndex.addChild(nodePointer); + } + } + } + + public void initTextureUnit(int maxTextureUnit) { + int treeSelectionSeq = TEXTURE_UNIT_TREE_SELECTION_SEQ; + + for (int i = 0; i < maxTextureUnit; i++) { + TreeInput nodeTextureUnitIndex = new TreeInput(); + nodeTextureUnitIndex.setData(new GLContextTreeNodeData(++treeSelectionSeq, -1, i, + String.valueOf(i), + GLContextDBEnum.TEXTURE_UNIT_2D.ordinal(), + GLContextDBEnum.TEXTURE_UNIT_CUBE.ordinal())); + nodeTextureUnits.addChild(nodeTextureUnitIndex); + { + TreeInput node2D = new TreeInput(); + node2D.setData(new GLContextTreeNodeData(++treeSelectionSeq, + GLContextDBEnum.TEXTURE_UNIT_2D.ordinal(), i, + GLPageLabels.GL_CONTEXT_2D_BINDING)); + nodeTextureUnitIndex.addChild(node2D); + + TreeInput nodeCube = new TreeInput(); + nodeCube.setData(new GLContextTreeNodeData(++treeSelectionSeq, + GLContextDBEnum.TEXTURE_UNIT_CUBE.ordinal(), i, + GLPageLabels.GL_CONTEXT_CUBEMAP_BINDING)); + nodeTextureUnitIndex.addChild(nodeCube); + } + } + } + + private void makeTextureObejctTree() { + int treeSelectionSeq = TEXTURE_OBJ_TREE_SELECTION_SEQ; + nodeTextureObject.getChildren().clear(); + String[] textureIDs = contextValueList.get( + GLContextDBEnum.TEXTURE_OBJ_ID.ordinal()).split( + GLDataMaker.DELIMITER); + + if (textureIDs.length == 1 && textureIDs[0].equals(GLDataMaker.EMPTY)) { + return; + } + + for (int i = 0; i < textureIDs.length; i++) { + TreeInput nodeTextureObjID = new TreeInput(); + nodeTextureObjID.setData(new GLContextTreeNodeData( + ++treeSelectionSeq, -1, i, textureIDs[i], + GLContextDBEnum.TEXTURE_OBJ_MAG_FUNC.ordinal(), + GLContextDBEnum.TEXTURE_OBJ_MIN_FUNC.ordinal(), + GLContextDBEnum.TEXTURE_OBJ_WRAP_S.ordinal(), + GLContextDBEnum.TEXTURE_OBJ_WRAP_T.ordinal())); + nodeTextureObject.addChild(nodeTextureObjID); + { + TreeInput nodeTextureMagFunc = new TreeInput(); + nodeTextureMagFunc.setData(new GLContextTreeNodeData( + ++treeSelectionSeq, + GLContextDBEnum.TEXTURE_OBJ_MAG_FUNC.ordinal(), i, + GLPageLabels.GL_CONTEXT_MAG_FUNCTION)); + nodeTextureObjID.addChild(nodeTextureMagFunc); + + TreeInput nodeTextureMinFunc = new TreeInput(); + nodeTextureMinFunc.setData(new GLContextTreeNodeData( + ++treeSelectionSeq, + GLContextDBEnum.TEXTURE_OBJ_MIN_FUNC.ordinal(), i, + GLPageLabels.GL_CONTEXT_MIN_FUNCTION)); + nodeTextureObjID.addChild(nodeTextureMinFunc); + + TreeInput nodeTextureWrapS = new TreeInput(); + nodeTextureWrapS.setData(new GLContextTreeNodeData( + ++treeSelectionSeq, + GLContextDBEnum.TEXTURE_OBJ_WRAP_S.ordinal(), i, + GLPageLabels.GL_CONTEXT_WRAP_MODE_S)); + nodeTextureObjID.addChild(nodeTextureWrapS); + + TreeInput nodeTextureWrapT = new TreeInput(); + nodeTextureWrapT.setData(new GLContextTreeNodeData( + ++treeSelectionSeq, + GLContextDBEnum.TEXTURE_OBJ_WRAP_T.ordinal(), i, + GLPageLabels.GL_CONTEXT_WRAP_MODE_T)); + nodeTextureObjID.addChild(nodeTextureWrapT); + } + } + } + + private void makeProgramObjectTree() { + int treeSelectionSeq = PROGRMA_OBJ_TREE_SELECTION_SEQ; + nodeProgramObject.getChildren().clear(); + + String[] programIDs = contextValueList.get( + GLContextDBEnum.PROGRAM_OBJ_ID.ordinal()).split( + GLDataMaker.DELIMITER); + String[] allAttribIndices = contextValueList.get( + GLContextDBEnum.PROGRAM_ATTRIB_INDEX.ordinal()).split( + GLDataMaker.DELIMITER); + String[] allUniformIndices = contextValueList.get( + GLContextDBEnum.PROGRAM_UNIFORM_INDEX.ordinal()).split( + GLDataMaker.DELIMITER); + + if (programIDs.length == 1 && programIDs[0].equals(GLDataMaker.EMPTY)) { + return; + } + + for (int i = 0; i < programIDs.length; i++) { + TreeInput nodeProgramObjID = new TreeInput(); + nodeProgramObjID.setData(new GLContextTreeNodeData( + ++treeSelectionSeq, -1, i, programIDs[i], + GLContextDBEnum.PROGRAM_OBJ_V_SHADER.ordinal(), + GLContextDBEnum.PROGRAM_OBJ_F_SHADER.ordinal(), + GLContextDBEnum.PROGRAM_ATTRIB_INDEX.ordinal(), + GLContextDBEnum.PROGRAM_ATTRIB_NAME.ordinal(), + GLContextDBEnum.PROGRAM_ATTRIB_SIZE.ordinal(), + GLContextDBEnum.PROGRAM_ATTRIB_TYPE.ordinal(), + GLContextDBEnum.PROGRAM_UNIFORM_INDEX.ordinal(), + GLContextDBEnum.PROGRAM_UNIFORM_NAME.ordinal(), + GLContextDBEnum.PROGRAM_UNIFORM_SIZE.ordinal(), + GLContextDBEnum.PROGRAM_UNIFORM_TYPE.ordinal())); + nodeProgramObject.addChild(nodeProgramObjID); + { + TreeInput nodeVertexShader = new TreeInput(); + nodeVertexShader.setData(new GLContextTreeNodeData( + ++treeSelectionSeq, + GLContextDBEnum.PROGRAM_OBJ_V_SHADER.ordinal(), i, + GLPageLabels.GL_CONTEXT_VERTEX_SHADER)); + nodeProgramObjID.addChild(nodeVertexShader); + + TreeInput nodeFragmentShader = new TreeInput(); + nodeFragmentShader.setData(new GLContextTreeNodeData( + ++treeSelectionSeq, + GLContextDBEnum.PROGRAM_OBJ_F_SHADER.ordinal(), i, + GLPageLabels.GL_CONTEXT_FRAGMENT_SHADER)); + nodeProgramObjID.addChild(nodeFragmentShader); + + TreeInput nodeAttribute = new TreeInput(); + nodeAttribute.setData(new GLContextTreeNodeData( + ++treeSelectionSeq, -1, i, + GLPageLabels.GL_CONTEXT_ATTRIBUTE, + GLContextDBEnum.PROGRAM_ATTRIB_INDEX.ordinal(), + GLContextDBEnum.PROGRAM_ATTRIB_NAME.ordinal(), + GLContextDBEnum.PROGRAM_ATTRIB_SIZE.ordinal(), + GLContextDBEnum.PROGRAM_ATTRIB_TYPE.ordinal())); + nodeProgramObjID.addChild(nodeAttribute); + { + if(!allAttribIndices[i].equals(GLDataMaker.EMPTY)) { + String[] attribIndices = allAttribIndices[i].split(GLDataMaker.COMMA); + for(int j = 0; j < attribIndices.length; j++) { + TreeInput nodeAttribIndex = new TreeInput(); + nodeAttribIndex.setData(new GLContextTreeNodeData( + ++treeSelectionSeq, -1, i, j, + attribIndices[j], + GLContextDBEnum.PROGRAM_ATTRIB_INDEX.ordinal(), + GLContextDBEnum.PROGRAM_ATTRIB_NAME.ordinal(), + GLContextDBEnum.PROGRAM_ATTRIB_SIZE.ordinal(), + GLContextDBEnum.PROGRAM_ATTRIB_TYPE.ordinal())); + nodeAttribute.addChild(nodeAttribIndex); + { + TreeInput nodeAttribName = new TreeInput(); + nodeAttribName + .setData(new GLContextTreeNodeData( + ++treeSelectionSeq, + GLContextDBEnum.PROGRAM_ATTRIB_NAME.ordinal(), + i, j, + GLPageLabels.GL_CONTEXT_NAME)); + nodeAttribIndex.addChild(nodeAttribName); + + TreeInput nodeAttribSize = new TreeInput(); + nodeAttribSize + .setData(new GLContextTreeNodeData( + ++treeSelectionSeq, + GLContextDBEnum.PROGRAM_ATTRIB_SIZE.ordinal(), + i, j, + GLPageLabels.GL_CONTEXT_SIZE)); + nodeAttribIndex.addChild(nodeAttribSize); + + TreeInput nodeAttribType= new TreeInput(); + nodeAttribType + .setData(new GLContextTreeNodeData( + ++treeSelectionSeq, + GLContextDBEnum.PROGRAM_ATTRIB_TYPE.ordinal(), + i, j, + GLPageLabels.GL_CONTEXT_TYPE)); + nodeAttribIndex.addChild(nodeAttribType); + } + } + } + } + + //TODO uniforms + TreeInput nodeUniform = new TreeInput(); + nodeUniform.setData(new GLContextTreeNodeData( + ++treeSelectionSeq, -1, i, + GLPageLabels.GL_CONTEXT_UNIFORM, + GLContextDBEnum.PROGRAM_UNIFORM_INDEX.ordinal(), + GLContextDBEnum.PROGRAM_UNIFORM_NAME.ordinal(), + GLContextDBEnum.PROGRAM_UNIFORM_SIZE.ordinal(), + GLContextDBEnum.PROGRAM_UNIFORM_TYPE.ordinal())); + nodeProgramObjID.addChild(nodeUniform); + { + if(!allUniformIndices[i].equals(GLDataMaker.EMPTY)) { + String[] uniformIndices = allUniformIndices[i].split(GLDataMaker.COMMA); + for(int j = 0; j < uniformIndices.length; j++) { + TreeInput nodeUniformIndex = new TreeInput(); + nodeUniformIndex.setData(new GLContextTreeNodeData( + ++treeSelectionSeq, -1, i, j, + uniformIndices[j], + GLContextDBEnum.PROGRAM_UNIFORM_INDEX.ordinal(), + GLContextDBEnum.PROGRAM_UNIFORM_NAME.ordinal(), + GLContextDBEnum.PROGRAM_UNIFORM_SIZE.ordinal(), + GLContextDBEnum.PROGRAM_UNIFORM_TYPE.ordinal())); + nodeUniform.addChild(nodeUniformIndex); + { + TreeInput nodeUniformName = new TreeInput(); + nodeUniformName + .setData(new GLContextTreeNodeData( + ++treeSelectionSeq, + GLContextDBEnum.PROGRAM_UNIFORM_NAME.ordinal(), + i, j, + GLPageLabels.GL_CONTEXT_NAME)); + nodeUniformIndex.addChild(nodeUniformName); + + TreeInput nodeUniformSize = new TreeInput(); + nodeUniformSize + .setData(new GLContextTreeNodeData( + ++treeSelectionSeq, + GLContextDBEnum.PROGRAM_UNIFORM_SIZE.ordinal(), + i, j, + GLPageLabels.GL_CONTEXT_SIZE)); + nodeUniformIndex.addChild(nodeUniformSize); + + TreeInput nodeUniformType= new TreeInput(); + nodeUniformType + .setData(new GLContextTreeNodeData( + ++treeSelectionSeq, + GLContextDBEnum.PROGRAM_UNIFORM_TYPE.ordinal(), + i, j, + GLPageLabels.GL_CONTEXT_TYPE)); + nodeUniformIndex.addChild(nodeUniformType); + } + } + } + } + } + } + } + + private void makeShaderObjectTree() { + int treeSelectionSeq = SHADER_OBJ_TREE_SELECTION_SEQ; + nodeShaderObject.getChildren().clear(); + + String[] shaderIDs = contextValueList.get( + GLContextDBEnum.SHADER_OBJ_ID.ordinal()).split( + GLDataMaker.DELIMITER); + if (shaderIDs.length == 1 && shaderIDs[0].equals(GLDataMaker.EMPTY)) { + return; + } + + for (int i = 0; i < shaderIDs.length; i++) { + TreeInput nodeShaderObjID = new TreeInput(); + nodeShaderObjID.setData(new GLContextTreeNodeData( + ++treeSelectionSeq, -1, i, shaderIDs[i], + GLContextDBEnum.SHADER_TYPE.ordinal(), + GLContextDBEnum.SHADER_SRC.ordinal())); + nodeShaderObject.addChild(nodeShaderObjID); + { + TreeInput nodeShaderType = new TreeInput(); + nodeShaderType.setData(new GLContextTreeNodeData(++treeSelectionSeq, + GLContextDBEnum.SHADER_TYPE.ordinal(), i, + GLPageLabels.GL_CONTEXT_TYPE)); + nodeShaderObjID.addChild(nodeShaderType); + + TreeInput nodeShaderSource = new TreeInput(); + nodeShaderSource.setData(new GLContextTreeNodeData(++treeSelectionSeq, + GLContextDBEnum.SHADER_SRC.ordinal(), i, + GLPageLabels.GL_CONTEXT_SOURCE)); + nodeShaderObjID.addChild(nodeShaderSource); + } + } + } + + @Override + public List makeTreeInput() { + if (seq != null) { + DBTableManager dbManager = DBTableManager.getInstance(); + DBTableInfo tableInfo = dbManager + .getTableInfo(DBTableManager.TABLE_INDEX_GLES20_CONTEXT_DATA); + contextValueList = SqlManager + .getInstance() + .selectQuery(null, tableInfo.getColumnNames(), + tableInfo.getTableName(), "where Seq = " + seq) + .get(0); + + makeTextureObejctTree(); + makeProgramObjectTree(); + makeShaderObjectTree(); + + for (TreeInput treeInput : contextTree) { + setNodeProperty(treeInput); + } + + seq = null; + } + + return contextTree; + } + + private void initContextTree() { + contextTree.clear(); + prevContextValueList = null; + int treeSelectionSeq = BASE_TREE_SELECTION_SEQ; + // vertex info + TreeInput nodeVertexInfo = new TreeInput(); + nodeVertexInfo.setData(new GLContextTreeNodeData(++treeSelectionSeq, -1, + GLPageLabels.GL_CONTEXT_VERTEX_INFO, + GLContextDBEnum.GVA_V0.ordinal(), + GLContextDBEnum.GVA_V1.ordinal(), + GLContextDBEnum.GVA_V2.ordinal(), + GLContextDBEnum.GVA_V3.ordinal(), + GLContextDBEnum.GVA_ENABLED.ordinal(), + GLContextDBEnum.GVA_SIZE.ordinal(), + GLContextDBEnum.GVA_TYPE.ordinal(), + GLContextDBEnum.GVA_NORMAL.ordinal(), + GLContextDBEnum.GVA_STRIDE.ordinal(), + GLContextDBEnum.GVA_POINTER.ordinal())); + { + TreeInput nodeGenericVertexAttib = new TreeInput(); + nodeGenericVertexAttib.setData(new GLContextTreeNodeData(++treeSelectionSeq, -1, + GLPageLabels.GL_CONTEXT_GENERIC_VERTEX_ATTRIBUTE, + GLContextDBEnum.GVA_V0.ordinal(), + GLContextDBEnum.GVA_V1.ordinal(), + GLContextDBEnum.GVA_V2.ordinal(), + GLContextDBEnum.GVA_V3.ordinal(), + GLContextDBEnum.GVA_ENABLED.ordinal(), + GLContextDBEnum.GVA_SIZE.ordinal(), + GLContextDBEnum.GVA_TYPE.ordinal(), + GLContextDBEnum.GVA_NORMAL.ordinal(), + GLContextDBEnum.GVA_STRIDE.ordinal(), + GLContextDBEnum.GVA_POINTER.ordinal())); + nodeVertexInfo.addChild(nodeGenericVertexAttib); + { + nodeGVAs = new TreeInput(); + nodeGVAs.setData(new GLContextTreeNodeData(++treeSelectionSeq, -1, + GLPageLabels.GL_CONTEXT_ATTRIBUTES, + GLContextDBEnum.GVA_V0.ordinal(), + GLContextDBEnum.GVA_V1.ordinal(), + GLContextDBEnum.GVA_V2.ordinal(), + GLContextDBEnum.GVA_V3.ordinal())); + nodeGenericVertexAttib.addChild(nodeGVAs); + + nodeGVAArrays = new TreeInput(); + nodeGVAArrays.setData(new GLContextTreeNodeData(++treeSelectionSeq, -1, + GLPageLabels.GL_CONTEXT_ATTRIBUTE_ARRAYS, + GLContextDBEnum.GVA_ENABLED.ordinal(), + GLContextDBEnum.GVA_SIZE.ordinal(), + GLContextDBEnum.GVA_TYPE.ordinal(), + GLContextDBEnum.GVA_NORMAL.ordinal(), + GLContextDBEnum.GVA_STRIDE.ordinal(), + GLContextDBEnum.GVA_POINTER.ordinal())); + nodeGenericVertexAttib.addChild(nodeGVAArrays); + } + TreeInput nodeVertexBufferObj = new TreeInput(); + nodeVertexBufferObj.setData(new GLContextTreeNodeData(++treeSelectionSeq, + GLContextDBEnum.VBO_BINDING.ordinal(), + GLPageLabels.GL_CONTEXT_VERTEX_BUFFER_OBJECT)); + nodeVertexInfo.addChild(nodeVertexBufferObj); + } + contextTree.add(nodeVertexInfo); + + // transformation + TreeInput nodeTransformation = new TreeInput(); + nodeTransformation.setData(new GLContextTreeNodeData(++treeSelectionSeq, -1, + GLPageLabels.GL_CONTEXT_TRANSFORMATION, + GLContextDBEnum.VIEWPORT_X.ordinal(), + GLContextDBEnum.VIEWPORT_Y.ordinal(), + GLContextDBEnum.VIEWPORT_W.ordinal(), + GLContextDBEnum.VIEWPORT_H.ordinal(), + GLContextDBEnum.DEPTH_RANGE_N.ordinal(), + GLContextDBEnum.DEPTH_RANGE_F.ordinal())); + { + TreeInput nodeViewport = new TreeInput(); + nodeViewport.setData(new GLContextTreeNodeData(++treeSelectionSeq, -1, + GLPageLabels.GL_CONTEXT_VIEWPORT, + GLContextDBEnum.VIEWPORT_X.ordinal(), + GLContextDBEnum.VIEWPORT_Y.ordinal(), + GLContextDBEnum.VIEWPORT_W.ordinal(), + GLContextDBEnum.VIEWPORT_H.ordinal())); + nodeTransformation.addChild(nodeViewport); + { + TreeInput nodeViewportX = new TreeInput(); + nodeViewportX.setData(new GLContextTreeNodeData(++treeSelectionSeq, + GLContextDBEnum.VIEWPORT_X.ordinal(), + GLPageLabels.GL_CONTEXT_X)); + nodeViewport.addChild(nodeViewportX); + + TreeInput nodeViewportY = new TreeInput(); + nodeViewportY.setData(new GLContextTreeNodeData(++treeSelectionSeq, + GLContextDBEnum.VIEWPORT_Y.ordinal(), + GLPageLabels.GL_CONTEXT_Y)); + nodeViewport.addChild(nodeViewportY); + + TreeInput nodeViewportW = new TreeInput(); + nodeViewportW.setData(new GLContextTreeNodeData(++treeSelectionSeq, + GLContextDBEnum.VIEWPORT_W.ordinal(), + GLPageLabels.GL_CONTEXT_WIDTH)); + nodeViewport.addChild(nodeViewportW); + + TreeInput nodeViewportH = new TreeInput(); + nodeViewportH.setData(new GLContextTreeNodeData(++treeSelectionSeq, + GLContextDBEnum.VIEWPORT_H.ordinal(), + GLPageLabels.GL_CONTEXT_HEIGHT)); + nodeViewport.addChild(nodeViewportH); + } + TreeInput nodeDepthRange = new TreeInput(); + nodeDepthRange.setData(new GLContextTreeNodeData(++treeSelectionSeq, -1, + GLPageLabels.GL_CONTEXT_DEPTH_RANGE, + GLContextDBEnum.DEPTH_RANGE_N.ordinal(), + GLContextDBEnum.DEPTH_RANGE_F.ordinal())); + nodeTransformation.addChild(nodeDepthRange); + { + TreeInput nodeDepthNear = new TreeInput(); + nodeDepthNear.setData(new GLContextTreeNodeData(++treeSelectionSeq, + GLContextDBEnum.DEPTH_RANGE_N.ordinal(), + GLPageLabels.GL_CONTEXT_NEAR)); + nodeDepthRange.addChild(nodeDepthNear); + + TreeInput nodeDepthFar = new TreeInput(); + nodeDepthFar.setData(new GLContextTreeNodeData(++treeSelectionSeq, + GLContextDBEnum.DEPTH_RANGE_F.ordinal(), + GLPageLabels.GL_CONTEXT_FAR)); + nodeDepthRange.addChild(nodeDepthFar); + } + } + contextTree.add(nodeTransformation); + + // rasterization + TreeInput nodeRasterization = new TreeInput(); + nodeRasterization.setData(new GLContextTreeNodeData(++treeSelectionSeq, -1, + GLPageLabels.GL_CONTEXT_RASTERIZATION, + GLContextDBEnum.LINE_W.ordinal(), + GLContextDBEnum.CULLING_ENABLED.ordinal(), + GLContextDBEnum.CULLING_ORI.ordinal(), + GLContextDBEnum.CULLING_MODE.ordinal(), + GLContextDBEnum.POLY_ENABLED.ordinal(), + GLContextDBEnum.POLY_FACTOR.ordinal(), + GLContextDBEnum.POLY_UNITS.ordinal())); + { + TreeInput nodeLineWidth = new TreeInput(); + nodeLineWidth.setData(new GLContextTreeNodeData(++treeSelectionSeq, + GLContextDBEnum.LINE_W.ordinal(), + GLPageLabels.GL_CONTEXT_LINE_WIDTH)); + nodeRasterization.addChild(nodeLineWidth); + + TreeInput nodeCulling = new TreeInput(); + nodeCulling.setData(new GLContextTreeNodeData(++treeSelectionSeq, + GLContextDBEnum.CULLING_ENABLED.ordinal(), + GLPageLabels.GL_CONTEXT_CULLING, + GLContextDBEnum.CULLING_ORI.ordinal(), + GLContextDBEnum.CULLING_MODE.ordinal())); + nodeRasterization.addChild(nodeCulling); + { + TreeInput nodeOrientation = new TreeInput(); + nodeOrientation.setData(new GLContextTreeNodeData(++treeSelectionSeq, + GLContextDBEnum.CULLING_ORI.ordinal(), + GLPageLabels.GL_CONTEXT_ORIENTATION)); + nodeCulling.addChild(nodeOrientation); + + TreeInput nodeMode = new TreeInput(); + nodeMode.setData(new GLContextTreeNodeData(++treeSelectionSeq, + GLContextDBEnum.CULLING_MODE.ordinal(), + GLPageLabels.GL_CONTEXT_MODE)); + nodeCulling.addChild(nodeMode); + } + + TreeInput nodePoly = new TreeInput(); + nodePoly.setData(new GLContextTreeNodeData(++treeSelectionSeq, + GLContextDBEnum.POLY_ENABLED.ordinal(), + GLPageLabels.GL_CONTEXT_POLYGON_OFFSET, + GLContextDBEnum.POLY_FACTOR.ordinal(), + GLContextDBEnum.POLY_UNITS.ordinal())); + nodeRasterization.addChild(nodePoly); + { + TreeInput nodePolyFactor = new TreeInput(); + nodePolyFactor.setData(new GLContextTreeNodeData(++treeSelectionSeq, + GLContextDBEnum.POLY_FACTOR.ordinal(), + GLPageLabels.GL_CONTEXT_FACTOR)); + nodePoly.addChild(nodePolyFactor); + + TreeInput nodePolyUnits = new TreeInput(); + nodePolyUnits.setData(new GLContextTreeNodeData(++treeSelectionSeq, + GLContextDBEnum.POLY_UNITS.ordinal(), + GLPageLabels.GL_CONTEXT_UNITS)); + nodePoly.addChild(nodePolyUnits); + } + } + contextTree.add(nodeRasterization); + + // fragment operation + TreeInput nodeFragmentOperation = new TreeInput(); + nodeFragmentOperation.setData(new GLContextTreeNodeData(++treeSelectionSeq, -1, + GLPageLabels.GL_CONTEXT_FRAGMENT_OPERATION, + GLContextDBEnum.SCISSOR_ENABLED.ordinal(), + GLContextDBEnum.SCISSOR_X.ordinal(), + GLContextDBEnum.SCISSOR_Y.ordinal(), + GLContextDBEnum.SCISSOR_W.ordinal(), + GLContextDBEnum.SCISSOR_H.ordinal(), + GLContextDBEnum.STENCIL_ENABLED.ordinal(), + GLContextDBEnum.STENCIL_FRONT_FUNC.ordinal(), + GLContextDBEnum.STENCIL_FRONT_REF.ordinal(), + GLContextDBEnum.STENCIL_FRONT_MASK.ordinal(), + GLContextDBEnum.STENCIL_FRONT_S_FAIL.ordinal(), + GLContextDBEnum.STENCIL_FRONT_D_FAIL.ordinal(), + GLContextDBEnum.STENCIL_FRONT_D_PASS.ordinal(), + GLContextDBEnum.STENCIL_BACK_FUNC.ordinal(), + GLContextDBEnum.STENCIL_BACK_REF.ordinal(), + GLContextDBEnum.STENCIL_BACK_MASK.ordinal(), + GLContextDBEnum.STENCIL_BACK_S_FAIL.ordinal(), + GLContextDBEnum.STENCIL_BACK_D_FAIL.ordinal(), + GLContextDBEnum.STENCIL_BACK_D_PASS.ordinal(), + GLContextDBEnum.DEPTH_ENABLED.ordinal(), + GLContextDBEnum.DEPTH_FUNC.ordinal(), + GLContextDBEnum.BLEND_ENABLED.ordinal(), + GLContextDBEnum.BLEND_SRC_RGB.ordinal(), + GLContextDBEnum.BLEND_SRC_A.ordinal(), + GLContextDBEnum.BLEND_DEST_RGB.ordinal(), + GLContextDBEnum.BLEND_DEST_A.ordinal(), + GLContextDBEnum.BLEND_RGB_EQ.ordinal(), + GLContextDBEnum.BLEND_A_EQ.ordinal(), + GLContextDBEnum.BLEND_COLOR.ordinal(), + GLContextDBEnum.DITHER_ENABLED.ordinal())); + { + TreeInput nodeScissor = new TreeInput(); + nodeScissor.setData(new GLContextTreeNodeData(++treeSelectionSeq, + GLContextDBEnum.SCISSOR_ENABLED.ordinal(), + GLPageLabels.GL_CONTEXT_SCISSOR, + GLContextDBEnum.SCISSOR_ENABLED.ordinal(), + GLContextDBEnum.SCISSOR_X.ordinal(), + GLContextDBEnum.SCISSOR_Y.ordinal(), + GLContextDBEnum.SCISSOR_W.ordinal(), + GLContextDBEnum.SCISSOR_H.ordinal())); + nodeFragmentOperation.addChild(nodeScissor); + { + TreeInput nodeScissorX = new TreeInput(); + nodeScissorX.setData(new GLContextTreeNodeData(++treeSelectionSeq, + GLContextDBEnum.SCISSOR_X.ordinal(), + GLPageLabels.GL_CONTEXT_X)); + nodeScissor.addChild(nodeScissorX); + + TreeInput nodeScissorY = new TreeInput(); + nodeScissorY.setData(new GLContextTreeNodeData(++treeSelectionSeq, + GLContextDBEnum.SCISSOR_Y.ordinal(), + GLPageLabels.GL_CONTEXT_Y)); + nodeScissor.addChild(nodeScissorY); + + TreeInput nodeScissorW = new TreeInput(); + nodeScissorW.setData(new GLContextTreeNodeData(++treeSelectionSeq, + GLContextDBEnum.SCISSOR_W.ordinal(), + GLPageLabels.GL_CONTEXT_WIDTH)); + nodeScissor.addChild(nodeScissorW); + + TreeInput nodeScissorH = new TreeInput(); + nodeScissorH.setData(new GLContextTreeNodeData(++treeSelectionSeq, + GLContextDBEnum.SCISSOR_H.ordinal(), + GLPageLabels.GL_CONTEXT_HEIGHT)); + nodeScissor.addChild(nodeScissorH); + } + TreeInput nodeStencil = new TreeInput(); + nodeStencil.setData(new GLContextTreeNodeData(++treeSelectionSeq, + GLContextDBEnum.STENCIL_ENABLED.ordinal(), + GLPageLabels.GL_CONTEXT_STENCIL, + GLContextDBEnum.STENCIL_ENABLED.ordinal(), + GLContextDBEnum.STENCIL_FRONT_FUNC.ordinal(), + GLContextDBEnum.STENCIL_FRONT_REF.ordinal(), + GLContextDBEnum.STENCIL_FRONT_MASK.ordinal(), + GLContextDBEnum.STENCIL_FRONT_S_FAIL.ordinal(), + GLContextDBEnum.STENCIL_FRONT_D_FAIL.ordinal(), + GLContextDBEnum.STENCIL_FRONT_D_PASS.ordinal(), + GLContextDBEnum.STENCIL_BACK_FUNC.ordinal(), + GLContextDBEnum.STENCIL_BACK_REF.ordinal(), + GLContextDBEnum.STENCIL_BACK_MASK.ordinal(), + GLContextDBEnum.STENCIL_BACK_S_FAIL.ordinal(), + GLContextDBEnum.STENCIL_BACK_D_FAIL.ordinal(), + GLContextDBEnum.STENCIL_BACK_D_PASS.ordinal())); + nodeFragmentOperation.addChild(nodeStencil); + { + TreeInput nodeFront = new TreeInput(); + nodeFront.setData(new GLContextTreeNodeData(++treeSelectionSeq, -1, + GLPageLabels.GL_CONTEXT_FRONT, + GLContextDBEnum.STENCIL_FRONT_FUNC.ordinal(), + GLContextDBEnum.STENCIL_FRONT_REF.ordinal(), + GLContextDBEnum.STENCIL_FRONT_MASK.ordinal(), + GLContextDBEnum.STENCIL_FRONT_S_FAIL.ordinal(), + GLContextDBEnum.STENCIL_FRONT_D_FAIL.ordinal(), + GLContextDBEnum.STENCIL_FRONT_D_PASS.ordinal())); + nodeStencil.addChild(nodeFront); + { + TreeInput nodeFrontFunction = new TreeInput(); + nodeFrontFunction.setData(new GLContextTreeNodeData(++treeSelectionSeq, + GLContextDBEnum.STENCIL_FRONT_FUNC.ordinal(), + GLPageLabels.GL_CONTEXT_FUNCTION)); + nodeFront.addChild(nodeFrontFunction); + + TreeInput nodeFrontRef = new TreeInput(); + nodeFrontRef.setData(new GLContextTreeNodeData(++treeSelectionSeq, + GLContextDBEnum.STENCIL_FRONT_REF.ordinal(), + GLPageLabels.GL_CONTEXT_REFERENCE)); + nodeFront.addChild(nodeFrontRef); + + TreeInput nodeFrontMask = new TreeInput(); + nodeFrontMask.setData(new GLContextTreeNodeData(++treeSelectionSeq, + GLContextDBEnum.STENCIL_FRONT_MASK.ordinal(), + GLPageLabels.GL_CONTEXT_MASK)); + nodeFront.addChild(nodeFrontMask); + + TreeInput nodeFrontSFail = new TreeInput(); + nodeFrontSFail.setData(new GLContextTreeNodeData(++treeSelectionSeq, + GLContextDBEnum.STENCIL_FRONT_S_FAIL.ordinal(), + GLPageLabels.GL_CONTEXT_STENCIL_TEST_FAIL_ACTION)); + nodeFront.addChild(nodeFrontSFail); + + TreeInput nodeFrontDFail = new TreeInput(); + nodeFrontDFail.setData(new GLContextTreeNodeData(++treeSelectionSeq, + GLContextDBEnum.STENCIL_FRONT_D_FAIL.ordinal(), + GLPageLabels.GL_CONTEXT_DEPTH_TEST_FAIL_ACTION)); + nodeFront.addChild(nodeFrontDFail); + + TreeInput nodeFrontDPass = new TreeInput(); + nodeFrontDPass.setData(new GLContextTreeNodeData(++treeSelectionSeq, + GLContextDBEnum.STENCIL_FRONT_D_PASS.ordinal(), + GLPageLabels.GL_CONTEXT_DEPTH_TEST_PASS_ACTION)); + nodeFront.addChild(nodeFrontDPass); + } + TreeInput nodeBack = new TreeInput(); + nodeBack.setData(new GLContextTreeNodeData(++treeSelectionSeq, -1, + GLPageLabels.GL_CONTEXT_BACK, + GLContextDBEnum.STENCIL_BACK_FUNC.ordinal(), + GLContextDBEnum.STENCIL_BACK_REF.ordinal(), + GLContextDBEnum.STENCIL_BACK_MASK.ordinal(), + GLContextDBEnum.STENCIL_BACK_S_FAIL.ordinal(), + GLContextDBEnum.STENCIL_BACK_D_FAIL.ordinal(), + GLContextDBEnum.STENCIL_BACK_D_PASS.ordinal())); + nodeStencil.addChild(nodeBack); + { + TreeInput nodeBackFunction = new TreeInput(); + nodeBackFunction.setData(new GLContextTreeNodeData(++treeSelectionSeq, + GLContextDBEnum.STENCIL_BACK_FUNC.ordinal(), + GLPageLabels.GL_CONTEXT_FUNCTION)); + nodeBack.addChild(nodeBackFunction); + + TreeInput nodeBackRef = new TreeInput(); + nodeBackRef.setData(new GLContextTreeNodeData(++treeSelectionSeq, + GLContextDBEnum.STENCIL_BACK_REF.ordinal(), + GLPageLabels.GL_CONTEXT_REFERENCE)); + nodeBack.addChild(nodeBackRef); + + TreeInput nodeBackMask = new TreeInput(); + nodeBackMask.setData(new GLContextTreeNodeData(++treeSelectionSeq, + GLContextDBEnum.STENCIL_BACK_MASK.ordinal(), + GLPageLabels.GL_CONTEXT_MASK)); + nodeBack.addChild(nodeBackMask); + + TreeInput nodeBackSFail = new TreeInput(); + nodeBackSFail.setData(new GLContextTreeNodeData(++treeSelectionSeq, + GLContextDBEnum.STENCIL_BACK_S_FAIL.ordinal(), + GLPageLabels.GL_CONTEXT_STENCIL_TEST_FAIL_ACTION)); + nodeBack.addChild(nodeBackSFail); + + TreeInput nodeBackDFail = new TreeInput(); + nodeBackDFail.setData(new GLContextTreeNodeData(++treeSelectionSeq, + GLContextDBEnum.STENCIL_BACK_D_FAIL.ordinal(), + GLPageLabels.GL_CONTEXT_DEPTH_TEST_FAIL_ACTION)); + nodeBack.addChild(nodeBackDFail); + + TreeInput nodeBackDPass = new TreeInput(); + nodeBackDPass.setData(new GLContextTreeNodeData(++treeSelectionSeq, + GLContextDBEnum.STENCIL_BACK_D_PASS.ordinal(), + GLPageLabels.GL_CONTEXT_DEPTH_TEST_PASS_ACTION)); + nodeBack.addChild(nodeBackDPass); + } + } + TreeInput nodeDepth = new TreeInput(); + nodeDepth.setData(new GLContextTreeNodeData(++treeSelectionSeq, + GLContextDBEnum.DEPTH_ENABLED.ordinal(), + GLPageLabels.GL_CONTEXT_DEPTH, + GLContextDBEnum.DEPTH_FUNC.ordinal())); + nodeFragmentOperation.addChild(nodeDepth); + { + TreeInput nodeDepthFunc = new TreeInput(); + nodeDepthFunc.setData(new GLContextTreeNodeData(++treeSelectionSeq, + GLContextDBEnum.DEPTH_FUNC.ordinal(), + GLPageLabels.GL_CONTEXT_FUNCTION)); + nodeDepth.addChild(nodeDepthFunc); + } + TreeInput nodeBlending = new TreeInput(); + nodeBlending.setData(new GLContextTreeNodeData(++treeSelectionSeq, + GLContextDBEnum.BLEND_ENABLED.ordinal(), + GLPageLabels.GL_CONTEXT_BLENDING, + GLContextDBEnum.BLEND_SRC_RGB.ordinal(), + GLContextDBEnum.BLEND_SRC_A.ordinal(), + GLContextDBEnum.BLEND_DEST_RGB.ordinal(), + GLContextDBEnum.BLEND_DEST_A.ordinal(), + GLContextDBEnum.BLEND_RGB_EQ.ordinal(), + GLContextDBEnum.BLEND_A_EQ.ordinal(), + GLContextDBEnum.BLEND_COLOR.ordinal())); + nodeFragmentOperation.addChild(nodeBlending); + { + TreeInput nodeBlendingSrc = new TreeInput(); + nodeBlendingSrc.setData(new GLContextTreeNodeData(++treeSelectionSeq, -1, + GLPageLabels.GL_CONTEXT_SOURCE, + GLContextDBEnum.BLEND_SRC_RGB.ordinal(), + GLContextDBEnum.BLEND_SRC_A.ordinal())); + nodeBlending.addChild(nodeBlendingSrc); + { + TreeInput nodeBlendingSrcRGB = new TreeInput(); + nodeBlendingSrcRGB.setData(new GLContextTreeNodeData(++treeSelectionSeq, + GLContextDBEnum.BLEND_SRC_RGB.ordinal(), + GLPageLabels.GL_CONTEXT_RGB_FACTOR)); + nodeBlendingSrc.addChild(nodeBlendingSrcRGB); + + TreeInput nodeBlendingSrcAlpha = new TreeInput(); + nodeBlendingSrcAlpha.setData(new GLContextTreeNodeData(++treeSelectionSeq, + GLContextDBEnum.BLEND_SRC_A.ordinal(), + GLPageLabels.GL_CONTEXT_ALPHA_FACTOR)); + nodeBlendingSrc.addChild(nodeBlendingSrcAlpha); + } + + TreeInput nodeBlendingDest = new TreeInput(); + nodeBlendingDest.setData(new GLContextTreeNodeData(++treeSelectionSeq, -1, + GLPageLabels.GL_CONTEXT_DESTINATION, + GLContextDBEnum.BLEND_DEST_RGB.ordinal(), + GLContextDBEnum.BLEND_DEST_A.ordinal())); + nodeBlending.addChild(nodeBlendingDest); + { + TreeInput nodeBlendingDestRGB = new TreeInput(); + nodeBlendingDestRGB.setData(new GLContextTreeNodeData(++treeSelectionSeq, + GLContextDBEnum.BLEND_DEST_RGB.ordinal(), + GLPageLabels.GL_CONTEXT_RGB_FACTOR)); + nodeBlendingDest.addChild(nodeBlendingDestRGB); + + TreeInput nodeBlendingDestAlpha = new TreeInput(); + nodeBlendingDestAlpha.setData(new GLContextTreeNodeData(++treeSelectionSeq, + GLContextDBEnum.BLEND_DEST_A.ordinal(), + GLPageLabels.GL_CONTEXT_ALPHA_FACTOR)); + nodeBlendingDest.addChild(nodeBlendingDestAlpha); + } + TreeInput nodeBlendingRGB = new TreeInput(); + nodeBlendingRGB.setData(new GLContextTreeNodeData(++treeSelectionSeq, + GLContextDBEnum.BLEND_RGB_EQ.ordinal(), + GLPageLabels.GL_CONTEXT_RGB_EQUATION)); + nodeBlending.addChild(nodeBlendingRGB); + + TreeInput nodeBlendingAlpha = new TreeInput(); + nodeBlendingAlpha.setData(new GLContextTreeNodeData(++treeSelectionSeq, + GLContextDBEnum.BLEND_A_EQ.ordinal(), + GLPageLabels.GL_CONTEXT_ALPHA_EQUATION)); + nodeBlending.addChild(nodeBlendingAlpha); + + TreeInput nodeBlendingColor = new TreeInput(); + nodeBlendingColor.setData(new GLContextTreeNodeData(++treeSelectionSeq, + GLContextDBEnum.BLEND_COLOR.ordinal(), + GLPageLabels.GL_CONTEXT_BLEND_COLOR)); + nodeBlending.addChild(nodeBlendingColor); + } + TreeInput nodeDither = new TreeInput(); + nodeDither.setData(new GLContextTreeNodeData(++treeSelectionSeq, + GLContextDBEnum.DITHER_ENABLED.ordinal(), + GLPageLabels.GL_CONTEXT_DITHER)); + nodeFragmentOperation.addChild(nodeDither); + } + contextTree.add(nodeFragmentOperation); + + // pixcel + TreeInput nodePixcel = new TreeInput(); + nodePixcel.setData(new GLContextTreeNodeData(++treeSelectionSeq, -1, + GLPageLabels.GL_CONTEXT_PIXEL, + GLContextDBEnum.PACK_ALIGN.ordinal(), + GLContextDBEnum.UNPACK_ALIGN.ordinal())); + { + TreeInput nodePackAlignment = new TreeInput(); + nodePackAlignment.setData(new GLContextTreeNodeData(++treeSelectionSeq, + GLContextDBEnum.PACK_ALIGN.ordinal(), + GLPageLabels.GL_CONTEXT_PACK_ALIGNMENT)); + nodePixcel.addChild(nodePackAlignment); + + TreeInput nodeUnpackAlignment = new TreeInput(); + nodeUnpackAlignment.setData(new GLContextTreeNodeData(++treeSelectionSeq, + GLContextDBEnum.UNPACK_ALIGN.ordinal(), + GLPageLabels.GL_CONTEXT_UNPACK_ALIGNMENT)); + nodePixcel.addChild(nodeUnpackAlignment); + } + contextTree.add(nodePixcel); + + // texture + TreeInput nodeTexture = new TreeInput(); + nodeTexture.setData(new GLContextTreeNodeData(++treeSelectionSeq, -1, + GLPageLabels.GL_CONTEXT_TEXTURE, + GLContextDBEnum.TEXTURE_ACTIVE.ordinal(), + GLContextDBEnum.TEXTURE_UNIT_2D.ordinal(), + GLContextDBEnum.TEXTURE_UNIT_CUBE.ordinal(), + GLContextDBEnum.TEXTURE_OBJ_ID.ordinal(), + GLContextDBEnum.TEXTURE_OBJ_MAG_FUNC.ordinal(), + GLContextDBEnum.TEXTURE_OBJ_MIN_FUNC.ordinal(), + GLContextDBEnum.TEXTURE_OBJ_WRAP_S.ordinal(), + GLContextDBEnum.TEXTURE_OBJ_WRAP_T.ordinal())); + { + nodeTextureUnits = new TreeInput(); + nodeTextureUnits.setData(new GLContextTreeNodeData(++treeSelectionSeq, + GLContextDBEnum.TEXTURE_ACTIVE.ordinal(), + GLPageLabels.GL_CONTEXT_TEXTURE_UNITS, + GLContextDBEnum.TEXTURE_UNIT_2D.ordinal(), + GLContextDBEnum.TEXTURE_UNIT_CUBE.ordinal())); + nodeTexture.addChild(nodeTextureUnits); + + nodeTextureObject = new TreeInput(); + nodeTextureObject.setData(new GLContextTreeNodeData(++treeSelectionSeq, -1, + GLPageLabels.GL_CONTEXT_TEXTURE_OBJECT, + GLContextDBEnum.TEXTURE_OBJ_ID.ordinal(), + GLContextDBEnum.TEXTURE_OBJ_MAG_FUNC.ordinal(), + GLContextDBEnum.TEXTURE_OBJ_MIN_FUNC.ordinal(), + GLContextDBEnum.TEXTURE_OBJ_WRAP_S.ordinal(), + GLContextDBEnum.TEXTURE_OBJ_WRAP_T.ordinal())); + nodeTexture.addChild(nodeTextureObject); + } + contextTree.add(nodeTexture); + + // program object + nodeProgramObject = new TreeInput(); + nodeProgramObject.setData(new GLContextTreeNodeData(++treeSelectionSeq, + GLContextDBEnum.PROGRAM_OBJ_CURRENT.ordinal(), + GLPageLabels.GL_CONTEXT_PROGRAM_OBJ, + GLContextDBEnum.PROGRAM_OBJ_ID.ordinal(), + GLContextDBEnum.PROGRAM_OBJ_V_SHADER.ordinal(), + GLContextDBEnum.PROGRAM_OBJ_F_SHADER.ordinal(), + GLContextDBEnum.PROGRAM_ATTRIB_INDEX.ordinal(), + GLContextDBEnum.PROGRAM_ATTRIB_NAME.ordinal(), + GLContextDBEnum.PROGRAM_ATTRIB_SIZE.ordinal(), + GLContextDBEnum.PROGRAM_ATTRIB_TYPE.ordinal(), + GLContextDBEnum.PROGRAM_UNIFORM_INDEX.ordinal(), + GLContextDBEnum.PROGRAM_UNIFORM_NAME.ordinal(), + GLContextDBEnum.PROGRAM_UNIFORM_SIZE.ordinal(), + GLContextDBEnum.PROGRAM_UNIFORM_TYPE.ordinal())); + contextTree.add(nodeProgramObject); + + // shader object + nodeShaderObject = new TreeInput(); + nodeShaderObject.setData(new GLContextTreeNodeData(++treeSelectionSeq, -1, + GLPageLabels.GL_CONTEXT_SHADER_OBJECT, + GLContextDBEnum.SHADER_TYPE.ordinal(), + GLContextDBEnum.SHADER_SRC.ordinal())); + contextTree.add(nodeShaderObject); + + // framebuffer state + TreeInput nodeFramebuffer = new TreeInput(); + nodeFramebuffer.setData(new GLContextTreeNodeData(++treeSelectionSeq, -1, + GLPageLabels.GL_CONTEXT_FRAMEBUFFER_STATE)); + { + TreeInput nodeFramebufferBinding = new TreeInput(); + nodeFramebufferBinding.setData(new GLContextTreeNodeData(++treeSelectionSeq, -1, + GLPageLabels.GL_CONTEXT_FRAMEBUFER_BINDING)); + nodeFramebuffer.addChild(nodeFramebufferBinding); + } + contextTree.add(nodeFramebuffer); + } + + public void clear() { + seq = null; + initContextTree(); + getTable().getColumn(2).setText(GLPageLabels.GL_CONTEXT_VIEW_PREV); + } + + public void updateTree(String seq) { + if (seq != null) { + this.seq = seq; + } + + updateTree(); + } + + @Override + protected GridItem checkExpand(GridItem gridItem, DATableDataFormat gridData) { + long seq = gridData.getSelectionKey(); + Object expand = getExpandMap().get(seq); + if (null == expand) { + expandMap.put(seq, false); + } else { + gridItem.setExpanded((Boolean) expand); + } + return gridItem; + } +} diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/ui/context/GLContextView.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/ui/context/GLContextView.java new file mode 100644 index 0000000..c1cc588 --- /dev/null +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/ui/context/GLContextView.java @@ -0,0 +1,77 @@ +package org.tizen.dynamicanalyzer.ui.opengl.ui.context; + +import java.util.List; + +import org.eclipse.nebula.widgets.grid.GridItem; +import org.eclipse.swt.SWT; +import org.eclipse.swt.layout.FillLayout; +import org.eclipse.swt.widgets.Composite; +import org.tizen.dynamicanalyzer.common.DASelectionData; +import org.tizen.dynamicanalyzer.logparser.LogCenterConstants; +import org.tizen.dynamicanalyzer.model.DAView; +import org.tizen.dynamicanalyzer.nl.GLPageLabels; +import org.tizen.dynamicanalyzer.resources.ColorResources; +import org.tizen.dynamicanalyzer.ui.opengl.data.GLSelectionData; +import org.tizen.dynamicanalyzer.ui.opengl.ui.apiList.GLAPIListView; +import org.tizen.dynamicanalyzer.ui.widgets.ViewContainer; +import org.tizen.dynamicanalyzer.ui.widgets.table.DATableDataFormat; + +public class GLContextView extends DAView { + public static final String ID = GLContextView.class.getName(); + + private ViewContainer viewContainer; + private GLContextTreeTable glContextTreeTable; + + public GLContextView(Composite parent, int style) { + super(parent, style); + setLayout(new FillLayout()); + + viewContainer = new ViewContainer(this, true); + viewContainer.setTitleText(GLPageLabels.GL_CONTEXT_VIEW_TITLE); + + int[] innerMaxWeight = { 0, 100 }; + int[] outerMaxWeight = { 0, 100 }; + setMaxWeight(innerMaxWeight, outerMaxWeight); + + Composite contents = viewContainer.getContentArea(); + contents.setBackground(ColorResources.VIEW_BG_COLOR); + contents.setLayout(new FillLayout()); + glContextTreeTable = GLContextTreeTable.getInstance(contents, SWT.NONE, + SWT.SINGLE | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL); + } + + @Override + public void updateView() { + glContextTreeTable.updateTree(); + } + + @Override + public void updateView(DASelectionData data) { + String id = data.getViewId(); + if (id.endsWith(GLAPIListView.ID)) { + GridItem[] gridItems = (GridItem[]) data.getData(); + DATableDataFormat tableDataFormat = (DATableDataFormat) gridItems[0] + .getData(); + List tableDataList = tableDataFormat.getData(); + + int frameIndex = ((GLSelectionData)data).getFrameIndex(); + String seq = tableDataList + .get(LogCenterConstants.SEQUENCE_NUMBER_INDEX); + glContextTreeTable.updateTree(seq); + + viewContainer.setTitleText(GLPageLabels.GL_CONTEXT_VIEW_TITLE + "(" + + frameIndex + "frame #" + seq + ")"); + } + } + + @Override + public void clear() { + glContextTreeTable.clear(); + viewContainer.setTitleText(GLPageLabels.GL_CONTEXT_VIEW_TITLE); + } + + @Override + public void otherViewSelectionOccured() { + glContextTreeTable.deselectAll(); + } +} diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/thread/ThreadAPIListTable.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/thread/ThreadAPIListTable.java index 3b0e111..e880af5 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/thread/ThreadAPIListTable.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/thread/ThreadAPIListTable.java @@ -165,15 +165,15 @@ public class ThreadAPIListTable extends DAApiListTableComposite { if (type == START_TIME) { rangeDataManager.setMarkerStartTime(inputTime); - startTime = inputTime / TimelineConstants.MEGA; + startTime = inputTime / TimelineConstants.MEGA_DOUBLE; endTime = rangeDataManager.getMarkerEndTime() - / TimelineConstants.MEGA; + / TimelineConstants.MEGA_DOUBLE; } else if (type == END_TIME) { rangeDataManager.setMarkerEndTime(inputTime); - endTime = inputTime / TimelineConstants.MEGA; + endTime = inputTime / TimelineConstants.MEGA_DOUBLE; startTime = rangeDataManager.getMarkerStartTime() - / TimelineConstants.MEGA; + / TimelineConstants.MEGA_DOUBLE; } board.setTimelineMarkerStartTime(startTime); diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/thread/ThreadChartView.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/thread/ThreadChartView.java index 26478b2..ecaadd6 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/thread/ThreadChartView.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/thread/ThreadChartView.java @@ -230,11 +230,11 @@ public class ThreadChartView extends DAView { (long) (((DAChartPlotIntervalMarker) threadChart .getMarkers() .get(UICommonConstants.SELECTION_MARKER_INDEX)) - .getStartVal() * TimelineConstants.MEGA), + .getStartVal() * TimelineConstants.MEGA_DOUBLE), (long) (((DAChartPlotIntervalMarker) threadChart .getMarkers() .get(UICommonConstants.SELECTION_MARKER_INDEX)) - .getEndVal() * TimelineConstants.MEGA), + .getEndVal() * TimelineConstants.MEGA_DOUBLE), new Integer(0), null)); } else { AnalyzerManager @@ -245,11 +245,11 @@ public class ThreadChartView extends DAView { (long) (((DAChartPlotIntervalMarker) threadChart .getMarkers() .get(UICommonConstants.SELECTION_MARKER_INDEX)) - .getStartVal() * TimelineConstants.MEGA), + .getStartVal() * TimelineConstants.MEGA_DOUBLE), (long) (((DAChartPlotIntervalMarker) threadChart .getMarkers() .get(UICommonConstants.SELECTION_MARKER_INDEX)) - .getEndVal() * TimelineConstants.MEGA), + .getEndVal() * TimelineConstants.MEGA_DOUBLE), selectItem.getData(), null)); } } @@ -289,28 +289,28 @@ public class ThreadChartView extends DAView { manager.update(); threadChart.setTimelineMarkerStartTime(rangeDataManager - .getMarkerStartTime() / TimelineConstants.MEGA); + .getMarkerStartTime() / TimelineConstants.MEGA_DOUBLE); threadChart.setTimelineMarkerEndTime(rangeDataManager - .getMarkerEndTime() / TimelineConstants.MEGA); + .getMarkerEndTime() / TimelineConstants.MEGA_DOUBLE); syncChart.setTimelineMarkerStartTime(rangeDataManager - .getMarkerStartTime() / TimelineConstants.MEGA); + .getMarkerStartTime() / TimelineConstants.MEGA_DOUBLE); syncChart.setTimelineMarkerEndTime(rangeDataManager.getMarkerEndTime() - / TimelineConstants.MEGA); + / TimelineConstants.MEGA_DOUBLE); if (RangeDataManager.getInstance().isBeingAnalyzed()) { ((DAChartPlotIntervalMarker) threadChart.getMarkers().get( UICommonConstants.RANGE_ANALYSIS_MARKER_INDEX)) .setInterval(rangeDataManager.getAnalysisStartTime() - / TimelineConstants.MEGA, + / TimelineConstants.MEGA_DOUBLE, rangeDataManager.getAnalysisEndTime() - / TimelineConstants.MEGA); + / TimelineConstants.MEGA_DOUBLE); ((DAChartPlotIntervalMarker) syncChart.getMarkers().get( UICommonConstants.RANGE_ANALYSIS_MARKER_INDEX)) .setInterval(rangeDataManager.getAnalysisStartTime() - / TimelineConstants.MEGA, + / TimelineConstants.MEGA_DOUBLE, rangeDataManager.getAnalysisEndTime() - / TimelineConstants.MEGA); + / TimelineConstants.MEGA_DOUBLE); } else { ((DAChartPlotIntervalMarker) threadChart.getMarkers().get( UICommonConstants.RANGE_ANALYSIS_MARKER_INDEX)) @@ -323,13 +323,13 @@ public class ThreadChartView extends DAView { ((DAChartPlotIntervalMarker) threadChart.getMarkers().get( UICommonConstants.RANGE_MARKER_INDEX)).setInterval( - rangeDataManager.getMarkerStartTime() / TimelineConstants.MEGA, - rangeDataManager.getMarkerEndTime() / TimelineConstants.MEGA); + rangeDataManager.getMarkerStartTime() / TimelineConstants.MEGA_DOUBLE, + rangeDataManager.getMarkerEndTime() / TimelineConstants.MEGA_DOUBLE); ((DAChartPlotIntervalMarker) syncChart.getMarkers().get( UICommonConstants.RANGE_MARKER_INDEX)).setInterval( - rangeDataManager.getMarkerStartTime() / TimelineConstants.MEGA, - rangeDataManager.getMarkerEndTime() / TimelineConstants.MEGA); + rangeDataManager.getMarkerStartTime() / TimelineConstants.MEGA_DOUBLE, + rangeDataManager.getMarkerEndTime() / TimelineConstants.MEGA_DOUBLE); } @@ -338,8 +338,8 @@ public class ThreadChartView extends DAView { long start = selData.getStartTime(); long end = selData.getEndTime(); - double startTime = (double) start / TimelineConstants.MEGA; - double endTime = (double) end / TimelineConstants.MEGA; + double startTime = (double) start / TimelineConstants.MEGA_DOUBLE; + double endTime = (double) end / TimelineConstants.MEGA_DOUBLE; double middleTime = (startTime + endTime) / 2.0; if (start == end) { middleTime = startTime; diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/thread/sync/ThreadPageSyncDataManager.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/thread/sync/ThreadPageSyncDataManager.java index e6bfed3..2d47c2a 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/thread/sync/ThreadPageSyncDataManager.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/thread/sync/ThreadPageSyncDataManager.java @@ -41,22 +41,23 @@ import org.tizen.dynamicanalyzer.swap.logparser.LogPackage; import org.tizen.dynamicanalyzer.swap.logparser.Logs; import org.tizen.dynamicanalyzer.swap.model.probe2.LogData; import org.tizen.dynamicanalyzer.swap.model.probe2.SyncData; -import org.tizen.dynamicanalyzer.ui.common.ContextAnalysisMenuItemClickListener; -import org.tizen.dynamicanalyzer.ui.common.ContextClearMenuItemClickListener; -import org.tizen.dynamicanalyzer.ui.common.ContextEndMenuItemClickListener; -import org.tizen.dynamicanalyzer.ui.common.ContextFromSelectionMenuItemClickListener; -import org.tizen.dynamicanalyzer.ui.common.ContextStartMenuItemClickListener; +import org.tizen.dynamicanalyzer.ui.common.PopupAnalysisMenuItemClickListener; +import org.tizen.dynamicanalyzer.ui.common.PopupClearMenuItemClickListener; +import org.tizen.dynamicanalyzer.ui.common.PopupEndMenuItemClickListener; +import org.tizen.dynamicanalyzer.ui.common.PopupFromSelectionMenuItemClickListener; +import org.tizen.dynamicanalyzer.ui.common.PopupStartMenuItemClickListener; import org.tizen.dynamicanalyzer.ui.common.TimelineChartMouseEventListener; import org.tizen.dynamicanalyzer.ui.common.TimelineChartMouseTrackAdapter; import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants; -import org.tizen.dynamicanalyzer.ui.widgets.DAContextMenu; import org.tizen.dynamicanalyzer.widgets.chart.DAChart; import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlot; +import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlot.AutoRangeType; import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlotTooltip; import org.tizen.dynamicanalyzer.widgets.chart.DAChartSeries; import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoard; import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoardItem; -import org.tizen.dynamicanalyzer.widgets.contextMenu.DAContextMenuItem; +import org.tizen.dynamicanalyzer.widgets.popupMenu.DAPopupMenu; +import org.tizen.dynamicanalyzer.widgets.popupMenu.DAPopupMenuItem; public class ThreadPageSyncDataManager { private DAChartBoard board; @@ -128,7 +129,7 @@ public class ThreadPageSyncDataManager { SyncData syncData = (SyncData) input; // System.out.println("input : " + input); double time = Double.parseDouble(Long.toString(syncData.getTime())) - / TimelineConstants.MEGA; + / TimelineConstants.MEGA_DOUBLE; String tid = Integer.toString(syncData.getTid()); int type = syncData.getSyncType(); @@ -193,7 +194,7 @@ public class ThreadPageSyncDataManager { input = (SyncData) inputs.get(i); // System.out.println("input : " + input); double time = Double.parseDouble(Long.toString(input.getTime())) - / TimelineConstants.MEGA; + / TimelineConstants.MEGA_DOUBLE; String tid = Integer.toString(input.getTid()); int type = input.getSyncType(); @@ -341,7 +342,7 @@ public class ThreadPageSyncDataManager { } else { plot.setBackgroundImage(ImageResources.BG_CHILD_GRADIENT); } - plot.setAutoHeightRange(false); + plot.setAutoHeightRange(AutoRangeType.MANUAL); plot.setAxisFont(FontResources.CHART_AXIS_FONT); plot.setAxisRangeY(0, 101); plot.setAxisRangeX(board.getVisibleStartTime(), @@ -350,34 +351,31 @@ public class ThreadPageSyncDataManager { tooltip.setFont(FontResources.CHART_TOOLTIP_FONT); plot.setTooltip(tooltip); - DAContextMenu popupMenu = new DAContextMenu(chart); + DAPopupMenu popupMenu = new DAPopupMenu(chart); popupMenu.setFont(FontResources.CONTEXT_MENU_ITEM_FONT); - DAContextMenuItem startItem = new DAContextMenuItem(popupMenu); + DAPopupMenuItem startItem = new DAPopupMenuItem(popupMenu); startItem.setText(TimelineChartLabels.RANGE_CONTEXT_SET_START); - startItem.addClickListener(new ContextStartMenuItemClickListener( - startItem, board)); + startItem.addListener(new PopupStartMenuItemClickListener(startItem, + board)); - DAContextMenuItem endItem = new DAContextMenuItem(popupMenu); + DAPopupMenuItem endItem = new DAPopupMenuItem(popupMenu); endItem.setText(TimelineChartLabels.RANGE_CONTEXT_SET_END); - endItem.addClickListener(new ContextEndMenuItemClickListener(endItem, - board)); + endItem.addListener(new PopupEndMenuItemClickListener(endItem, board)); - DAContextMenuItem fromSelectionItem = new DAContextMenuItem(popupMenu); + DAPopupMenuItem fromSelectionItem = new DAPopupMenuItem(popupMenu); fromSelectionItem .setText(TimelineChartLabels.RANGE_CONTEXT_SET_FROM_SELECTION); fromSelectionItem - .addClickListener(new ContextFromSelectionMenuItemClickListener( + .addListener(new PopupFromSelectionMenuItemClickListener( fromSelectionItem, board)); - DAContextMenuItem analysisItem = new DAContextMenuItem(popupMenu); + DAPopupMenuItem analysisItem = new DAPopupMenuItem(popupMenu); analysisItem.setText(TimelineChartLabels.RANGE_CONTEXT_ANALYSIS); - analysisItem - .addClickListener(new ContextAnalysisMenuItemClickListener()); + analysisItem.addListener(new PopupAnalysisMenuItemClickListener()); - DAContextMenuItem clearItem = new DAContextMenuItem(popupMenu); + DAPopupMenuItem clearItem = new DAPopupMenuItem(popupMenu); clearItem.setText(TimelineChartLabels.RANGE_CONTEXT_CLEAR); - clearItem - .addClickListener(new ContextClearMenuItemClickListener(board)); + clearItem.addListener(new PopupClearMenuItemClickListener()); TimelineChartMouseEventListener timelineChartMouseEventListener = new TimelineChartMouseEventListener( popupMenu, board.getTimeline()); diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/thread/thread/ThreadPageThreadDataManager.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/thread/thread/ThreadPageThreadDataManager.java index b5879c6..d5d6b2c 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/thread/thread/ThreadPageThreadDataManager.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/thread/thread/ThreadPageThreadDataManager.java @@ -50,6 +50,11 @@ import org.tizen.dynamicanalyzer.ui.common.ContextClearMenuItemClickListener; import org.tizen.dynamicanalyzer.ui.common.ContextEndMenuItemClickListener; import org.tizen.dynamicanalyzer.ui.common.ContextFromSelectionMenuItemClickListener; import org.tizen.dynamicanalyzer.ui.common.ContextStartMenuItemClickListener; +import org.tizen.dynamicanalyzer.ui.common.PopupAnalysisMenuItemClickListener; +import org.tizen.dynamicanalyzer.ui.common.PopupClearMenuItemClickListener; +import org.tizen.dynamicanalyzer.ui.common.PopupEndMenuItemClickListener; +import org.tizen.dynamicanalyzer.ui.common.PopupFromSelectionMenuItemClickListener; +import org.tizen.dynamicanalyzer.ui.common.PopupStartMenuItemClickListener; import org.tizen.dynamicanalyzer.ui.common.TimelineChartMouseEventListener; import org.tizen.dynamicanalyzer.ui.common.TimelineChartMouseTrackAdapter; import org.tizen.dynamicanalyzer.ui.summary.warning.WarningCase; @@ -61,12 +66,15 @@ import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants; import org.tizen.dynamicanalyzer.ui.widgets.DAContextMenu; import org.tizen.dynamicanalyzer.widgets.chart.DAChart; import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlot; +import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlot.AutoRangeType; import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlotTooltip; import org.tizen.dynamicanalyzer.widgets.chart.DAChartSeries; import org.tizen.dynamicanalyzer.widgets.chart.DAChartSeriesItem; import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoard; import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoardItem; import org.tizen.dynamicanalyzer.widgets.contextMenu.DAContextMenuItem; +import org.tizen.dynamicanalyzer.widgets.popupMenu.DAPopupMenu; +import org.tizen.dynamicanalyzer.widgets.popupMenu.DAPopupMenuItem; public class ThreadPageThreadDataManager { private DAChartBoard board; @@ -149,7 +157,7 @@ public class ThreadPageThreadDataManager { return; } plot.setBackgroundImage(ImageResources.BG_CHILD_GRADIENT); - plot.setAutoHeightRange(false); + plot.setAutoHeightRange(AutoRangeType.MANUAL); plot.setAxisFont(FontResources.CHART_AXIS_FONT); plot.setAxisRangeY(0, 101); plot.setAxisRangeX(board.getVisibleStartTime(), @@ -158,34 +166,31 @@ public class ThreadPageThreadDataManager { tooltip.setFont(FontResources.CHART_TOOLTIP_FONT); plot.setTooltip(tooltip); - DAContextMenu popupMenu = new DAContextMenu(chart); + DAPopupMenu popupMenu = new DAPopupMenu(chart); popupMenu.setFont(FontResources.CONTEXT_MENU_ITEM_FONT); - DAContextMenuItem startItem = new DAContextMenuItem(popupMenu); + DAPopupMenuItem startItem = new DAPopupMenuItem(popupMenu); startItem.setText(TimelineChartLabels.RANGE_CONTEXT_SET_START); - startItem.addClickListener(new ContextStartMenuItemClickListener( - startItem, board)); + startItem.addListener(new PopupStartMenuItemClickListener(startItem, + board)); - DAContextMenuItem endItem = new DAContextMenuItem(popupMenu); + DAPopupMenuItem endItem = new DAPopupMenuItem(popupMenu); endItem.setText(TimelineChartLabels.RANGE_CONTEXT_SET_END); - endItem.addClickListener(new ContextEndMenuItemClickListener(endItem, - board)); + endItem.addListener(new PopupEndMenuItemClickListener(endItem, board)); - DAContextMenuItem fromSelectionItem = new DAContextMenuItem(popupMenu); + DAPopupMenuItem fromSelectionItem = new DAPopupMenuItem(popupMenu); fromSelectionItem .setText(TimelineChartLabels.RANGE_CONTEXT_SET_FROM_SELECTION); fromSelectionItem - .addClickListener(new ContextFromSelectionMenuItemClickListener( + .addListener(new PopupFromSelectionMenuItemClickListener( fromSelectionItem, board)); - DAContextMenuItem analysisItem = new DAContextMenuItem(popupMenu); + DAPopupMenuItem analysisItem = new DAPopupMenuItem(popupMenu); analysisItem.setText(TimelineChartLabels.RANGE_CONTEXT_ANALYSIS); - analysisItem - .addClickListener(new ContextAnalysisMenuItemClickListener()); + analysisItem.addListener(new PopupAnalysisMenuItemClickListener()); - DAContextMenuItem clearItem = new DAContextMenuItem(popupMenu); + DAPopupMenuItem clearItem = new DAPopupMenuItem(popupMenu); clearItem.setText(TimelineChartLabels.RANGE_CONTEXT_CLEAR); - clearItem - .addClickListener(new ContextClearMenuItemClickListener(board)); + clearItem.addListener(new PopupClearMenuItemClickListener()); TimelineChartMouseEventListener timelineChartMouseEventListener = new TimelineChartMouseEventListener( popupMenu, board.getTimeline()); @@ -230,7 +235,7 @@ public class ThreadPageThreadDataManager { return; } plot.setBackgroundImage(ImageResources.BG_GRADIENT); - plot.setAutoHeightRange(false); + plot.setAutoHeightRange(AutoRangeType.MANUAL); DAChartPlotTooltip tooltip = new DAChartPlotTooltip(-1); tooltip.setFont(FontResources.CHART_TOOLTIP_FONT); plot.setTooltip(tooltip); @@ -239,35 +244,32 @@ public class ThreadPageThreadDataManager { plot.setAxisRangeX(board.getVisibleStartTime(), board.getVisibleEndTime()); - DAContextMenu popupMenu = new DAContextMenu(chart); + DAPopupMenu popupMenu = new DAPopupMenu(chart); popupMenu.setFont(FontResources.CONTEXT_MENU_ITEM_FONT); - DAContextMenuItem startItem = new DAContextMenuItem(popupMenu); + DAPopupMenuItem startItem = new DAPopupMenuItem(popupMenu); startItem.setText(TimelineChartLabels.RANGE_CONTEXT_SET_START); - startItem.addClickListener(new ContextStartMenuItemClickListener( - startItem, board)); + startItem.addListener(new PopupStartMenuItemClickListener(startItem, + board)); - DAContextMenuItem endItem = new DAContextMenuItem(popupMenu); + DAPopupMenuItem endItem = new DAPopupMenuItem(popupMenu); endItem.setText(TimelineChartLabels.RANGE_CONTEXT_SET_END); - endItem.addClickListener(new ContextEndMenuItemClickListener(endItem, - board)); + endItem.addListener(new PopupEndMenuItemClickListener(endItem, board)); - DAContextMenuItem fromSelectionItem = new DAContextMenuItem(popupMenu); + DAPopupMenuItem fromSelectionItem = new DAPopupMenuItem(popupMenu); fromSelectionItem .setText(TimelineChartLabels.RANGE_CONTEXT_SET_FROM_SELECTION); fromSelectionItem - .addClickListener(new ContextFromSelectionMenuItemClickListener( + .addListener(new PopupFromSelectionMenuItemClickListener( fromSelectionItem, board)); - DAContextMenuItem analysisItem = new DAContextMenuItem(popupMenu); + DAPopupMenuItem analysisItem = new DAPopupMenuItem(popupMenu); analysisItem.setText(TimelineChartLabels.RANGE_CONTEXT_ANALYSIS); - analysisItem - .addClickListener(new ContextAnalysisMenuItemClickListener()); + analysisItem.addListener(new PopupAnalysisMenuItemClickListener()); - DAContextMenuItem clearItem = new DAContextMenuItem(popupMenu); + DAPopupMenuItem clearItem = new DAPopupMenuItem(popupMenu); clearItem.setText(TimelineChartLabels.RANGE_CONTEXT_CLEAR); - clearItem - .addClickListener(new ContextClearMenuItemClickListener(board)); + clearItem.addListener(new PopupClearMenuItemClickListener()); TimelineChartMouseEventListener timelineChartMouseEventListener = new TimelineChartMouseEventListener( popupMenu, board.getTimeline()); @@ -369,7 +371,7 @@ public class ThreadPageThreadDataManager { load = (int) (Double.parseDouble(temp[j + 1])); time = Double.parseDouble(Long.toString(input.getTime())) - / TimelineConstants.MEGA; + / TimelineConstants.MEGA_DOUBLE; ThreadPageThreadDataEvent event = new ThreadPageThreadDataEvent( ThreadPageThreadDataEvent.TYPE_LOAD, load, -1, time, tid, String.valueOf(load) @@ -412,7 +414,7 @@ public class ThreadPageThreadDataManager { load = (int) (Double.parseDouble(temp[j + 1])); time = Double.parseDouble(Long.toString(input.getTime())) - / TimelineConstants.MEGA; + / TimelineConstants.MEGA_DOUBLE; ThreadPageThreadDataEvent event = new ThreadPageThreadDataEvent( ThreadPageThreadDataEvent.TYPE_LOAD, load, -1, time, tid, String.valueOf(load) @@ -425,7 +427,7 @@ public class ThreadPageThreadDataManager { private void parsePthread(ThreadData input) { double time = Double.parseDouble(Long.toString(input.getTime())) - / TimelineConstants.MEGA; + / TimelineConstants.MEGA_DOUBLE; String tid = Integer.toString(input.getTid()); int apiType = input.getApiType(); String apiName = input.getApiName(); @@ -504,7 +506,7 @@ public class ThreadPageThreadDataManager { private void parseTIZEN(ThreadData input) { double time = Double.parseDouble(Long.toString(input.getTime())) - / TimelineConstants.MEGA; + / TimelineConstants.MEGA_DOUBLE; String tid = Integer.toString(input.getTid()); int apiType = input.getApiType(); String apiName = input.getApiName(); @@ -652,7 +654,7 @@ public class ThreadPageThreadDataManager { } SyncData syncData = (SyncData) input; double time = Double.parseDouble(Long.toString(input.getTime())) - / TimelineConstants.MEGA; + / TimelineConstants.MEGA_DOUBLE; String tid = Integer.toString(syncData.getTid()); // FIXME @@ -715,7 +717,7 @@ public class ThreadPageThreadDataManager { for (int i = 0; i < size; i++) { input = (SyncData) inputs.get(i); double time = Double.parseDouble(Long.toString(input.getTime())) - / TimelineConstants.MEGA; + / TimelineConstants.MEGA_DOUBLE; String tid = Integer.toString(input.getTid()); // FIXME diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/calltrace/CallTraceTable.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/calltrace/CallTraceTable.java index fc9cfae..a7181e4 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/calltrace/CallTraceTable.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/calltrace/CallTraceTable.java @@ -155,15 +155,15 @@ public class CallTraceTable extends DATableComposite { if (type == START_TIME) { rangeDataManager.setMarkerStartTime(inputTime); - startTime = inputTime / TimelineConstants.MEGA; + startTime = inputTime / TimelineConstants.MEGA_DOUBLE; endTime = rangeDataManager.getMarkerEndTime() - / TimelineConstants.MEGA; + / TimelineConstants.MEGA_DOUBLE; } else if (type == END_TIME) { rangeDataManager.setMarkerEndTime(inputTime); - endTime = inputTime / TimelineConstants.MEGA; + endTime = inputTime / TimelineConstants.MEGA_DOUBLE; startTime = rangeDataManager.getMarkerStartTime() - / TimelineConstants.MEGA; + / TimelineConstants.MEGA_DOUBLE; } board.setTimelineMarkerStartTime(startTime); diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/CPUChart.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/CPUChart.java index c705a49..a42d96d 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/CPUChart.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/CPUChart.java @@ -28,8 +28,6 @@ package org.tizen.dynamicanalyzer.ui.timeline.chart; import java.util.List; -import org.tizen.dynamicanalyzer.common.AnalyzerConstants; -import org.tizen.dynamicanalyzer.common.CommonConstants; import org.tizen.dynamicanalyzer.logparser.LogCenterConstants; import org.tizen.dynamicanalyzer.nl.TimelineChartLabels; import org.tizen.dynamicanalyzer.resources.ColorResources; @@ -40,6 +38,7 @@ import org.tizen.dynamicanalyzer.swap.model.probe2.LogData; import org.tizen.dynamicanalyzer.swap.model.probe2.SystemData; import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants; import org.tizen.dynamicanalyzer.utils.Formatter; +import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlot.AutoRangeType; import org.tizen.dynamicanalyzer.widgets.chart.DAChartSeries; import org.tizen.dynamicanalyzer.widgets.chart.DAChartSeriesItem; import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoard; @@ -61,7 +60,7 @@ public class CPUChart extends TimelineChart { private CPUChart() { chartType = TimelineConstants.CHART_TYPE_CPU; - probeType = AnalyzerConstants.MSG_DATA_SYSTEM; + probeType = LogCenterConstants.LOG_DEVICE; chartName = TimelineChartLabels.CPU_CHART_TITLE; chartIcon = ImageResources.CHART_CPU; addIcon = ImageResources.ADD_CHART_CPU; @@ -69,11 +68,11 @@ public class CPUChart extends TimelineChart { appLoadSeries = new DAChartSeries( TimelineChartLabels.CPU_CHART_SERIES_NAME_APP_LOAD, DAChartSeries.SERIES_STYLE_AREA, - ColorResources.SERIESE_COLOR_CPU_SYSTEM); + ColorResources.SERIES_COLOR_CPU_SYSTEM); totalLoadSeries = new DAChartSeries( TimelineChartLabels.CPU_CHART_SERIES_NAME_TOTAL_LOAD, DAChartSeries.SERIES_STYLE_AREA, - ColorResources.SERIESE_COLOR_CPU_APP); + ColorResources.SERIES_COLOR_CPU_APP); } @Override @@ -83,7 +82,7 @@ public class CPUChart extends TimelineChart { chart.addSeries(totalLoadSeries); chart.addSeries(appLoadSeries); - chart.getPlot().setAutoHeightRange(false); + chart.getPlot().setAutoHeightRange(AutoRangeType.MANUAL); chart.getPlot().setAxisRangeY(0, 100); chart.getPlot().setAxisUnit("%"); chart.getPlot().setShowAxis(true); @@ -94,48 +93,35 @@ public class CPUChart extends TimelineChart { @Override public void parseLogPackage(LogPackage logPack) { Logs logs = logPack.getLogs(probeType); - List logList = logs.getLogs(); - for (LogData log : logList) { - parsingLog((SystemData) log); + List logDataList = logs.getLogs(); + for (LogData logData : logDataList) { + parsingLog((SystemData)logData); } } - private void parsingLog(SystemData log) { - if (null == log) { - return; - } - + private void parsingLog(SystemData logData) { /* app load */ - if (log.getAppCpuUsage() != 0) { - try { - double time = Double.parseDouble(Long.toString(log.getTime())) - / TimelineConstants.MEGA; - double appCpuRate = log.getAppCpuUsage(); - appLoadSeries.addSeriesItem(new DAChartSeriesItem(time, - appCpuRate, Formatter.toPercentageFormat(appCpuRate))); - } catch (NumberFormatException ne) { - ne.printStackTrace(); - } + try { + double time = logData.getTime() / TimelineConstants.MEGA_DOUBLE; + double appCpuRate = logData.getAppCpuUsage(); + appLoadSeries.addSeriesItem(new DAChartSeriesItem(time, appCpuRate, + Formatter.toPercentageFormat(appCpuRate))); + } catch (NumberFormatException ne) { + ne.printStackTrace(); } /* total load */ - if (!log.getCpuLoad().isEmpty()) { - double time = 0; - double systemAvgLoad = 0; - - try { - time = Double.parseDouble(Long.toString(log.getTime())) - / (TimelineConstants.MEGA); - String[] cpuRates = log.getCpuLoad().split( - CommonConstants.COMMA); - systemAvgLoad = Double - .parseDouble(cpuRates[cpuRates.length - 1]); - totalLoadSeries.addSeriesItem(new DAChartSeriesItem(time, - systemAvgLoad, Formatter - .toPercentageFormat(systemAvgLoad))); - } catch (NumberFormatException ne) { - ne.printStackTrace(); - } + + try { + double time = logData.getTime() / TimelineConstants.MEGA_DOUBLE; + String[] cpuRates = logData.getCpuLoad().split(","); //$NON-NLS-1$ + double systemAvgLoad = Double + .parseDouble(cpuRates[cpuRates.length - 1]); + totalLoadSeries + .addSeriesItem(new DAChartSeriesItem(time, systemAvgLoad, + Formatter.toPercentageFormat(systemAvgLoad))); + } catch (NumberFormatException ne) { + ne.printStackTrace(); } } } diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/CPUCoreChart.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/CPUCoreChart.java index dafca6c..3741eac 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/CPUCoreChart.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/CPUCoreChart.java @@ -29,8 +29,6 @@ package org.tizen.dynamicanalyzer.ui.timeline.chart; import java.util.ArrayList; import java.util.List; -import org.tizen.dynamicanalyzer.common.AnalyzerConstants; -import org.tizen.dynamicanalyzer.common.CommonConstants; import org.tizen.dynamicanalyzer.logparser.LogCenterConstants; import org.tizen.dynamicanalyzer.nl.TimelineChartLabels; import org.tizen.dynamicanalyzer.resources.ColorResources; @@ -41,6 +39,7 @@ import org.tizen.dynamicanalyzer.swap.model.probe2.LogData; import org.tizen.dynamicanalyzer.swap.model.probe2.SystemData; import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants; import org.tizen.dynamicanalyzer.utils.Formatter; +import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlot.AutoRangeType; import org.tizen.dynamicanalyzer.widgets.chart.DAChartSeries; import org.tizen.dynamicanalyzer.widgets.chart.DAChartSeriesItem; import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoard; @@ -68,7 +67,7 @@ public class CPUCoreChart extends TimelineChart { public CPUCoreChart() { chartType = TimelineConstants.CHART_TYPE_CPU_CORE; - probeType = AnalyzerConstants.MSG_DATA_SYSTEM; + probeType = LogCenterConstants.LOG_DEVICE; chartName = TimelineChartLabels.CPU_CORE_CHART_TITLE; chartIcon = ImageResources.CHART_CPU_CORE; addIcon = ImageResources.ADD_CHART_CPU_CORE; @@ -77,22 +76,22 @@ public class CPUCoreChart extends TimelineChart { coreChartSeriesList.add(new DAChartSeries( TimelineChartLabels.CPU_CORE_CHART_SERIES_NAME_CORE0, DAChartSeries.SERIES_STYLE_LINE, - ColorResources.SERIESE_COLOR_CPUCORE_CORE0)); + ColorResources.SERIES_COLOR_CPUCORE_CORE0)); /* core 1 */ coreChartSeriesList.add(new DAChartSeries( TimelineChartLabels.CPU_CORE_CHART_SERIES_NAME_CORE1, DAChartSeries.SERIES_STYLE_LINE, - ColorResources.SERIESE_COLOR_CPUCORE_CORE1)); + ColorResources.SERIES_COLOR_CPUCORE_CORE1)); /* core 2 */ coreChartSeriesList.add(new DAChartSeries( TimelineChartLabels.CPU_CORE_CHART_SERIES_NAME_CORE2, DAChartSeries.SERIES_STYLE_LINE, - ColorResources.SERIESE_COLOR_CPUCORE_CORE2)); + ColorResources.SERIES_COLOR_CPUCORE_CORE2)); /* core 3 */ coreChartSeriesList.add(new DAChartSeries( TimelineChartLabels.CPU_CORE_CHART_SERIES_NAME_CORE3, DAChartSeries.SERIES_STYLE_LINE, - ColorResources.SERIESE_COLOR_CPUCORE_CORE3)); + ColorResources.SERIES_COLOR_CPUCORE_CORE3)); } @Override @@ -108,7 +107,7 @@ public class CPUCoreChart extends TimelineChart { chart.addSeries(coreChartSeriesList.get(i)); } - chart.getPlot().setAutoHeightRange(false); + chart.getPlot().setAutoHeightRange(AutoRangeType.MANUAL); chart.getPlot().setAxisRangeY(0, 100); chart.getPlot().setAxisUnit("%"); chart.getPlot().setShowAxis(true); @@ -116,41 +115,33 @@ public class CPUCoreChart extends TimelineChart { return item; } - private void parsingLog(SystemData log) { - if (null == log) { - return; - } + private void parsingLog(SystemData logData) { + try { + double time = logData.getTime() / TimelineConstants.MEGA_DOUBLE; + String[] cpuRates = logData.getCpuLoad().split(","); //$NON-NLS-1$ + double value = 0; + if (coreSize == TimelineConstants.NOT_INITED) { + coreSize = cpuRates.length - 1; + } - if (!log.getCpuLoad().isEmpty()) { - try { - double time = Double.parseDouble(Long.toString(log.getTime())) - / TimelineConstants.MEGA; - String[] cpuRates = log.getCpuLoad().split( - CommonConstants.COMMA); - double value = 0; - if (coreSize == TimelineConstants.NOT_INITED) { - coreSize = cpuRates.length - 1; - } - - for (int i = 0; i < coreSize; i++) { - value = Double.parseDouble(cpuRates[i]); - coreChartSeriesList.get(i).addSeriesItem( - new DAChartSeriesItem(time, value, Formatter - .toPercentageFormat(value))); - } - } catch (NumberFormatException ne) { - ne.printStackTrace(); + for (int i = 0; i < coreSize; i++) { + value = Double.parseDouble(cpuRates[i]); + coreChartSeriesList.get(i).addSeriesItem( + new DAChartSeriesItem(time, value, Formatter + .toPercentageFormat(value))); } + } catch (NumberFormatException ne) { + ne.printStackTrace(); } } @Override public void parseLogPackage(LogPackage logPack) { Logs logs = logPack.getLogs(probeType); - List logList = logs.getLogs(); + List logDataList = logs.getLogs(); - for (LogData log : logList) { - parsingLog((SystemData) log); + for (LogData logData : logDataList) { + parsingLog((SystemData) logData); } } diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/CPUFrequencyChart.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/CPUFrequencyChart.java index a53741d..e4431f9 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/CPUFrequencyChart.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/CPUFrequencyChart.java @@ -28,8 +28,6 @@ package org.tizen.dynamicanalyzer.ui.timeline.chart; import java.util.List; -import org.tizen.dynamicanalyzer.common.AnalyzerConstants; -import org.tizen.dynamicanalyzer.common.CommonConstants; import org.tizen.dynamicanalyzer.logparser.LogCenterConstants; import org.tizen.dynamicanalyzer.nl.TimelineChartLabels; import org.tizen.dynamicanalyzer.resources.ColorResources; @@ -59,7 +57,7 @@ public class CPUFrequencyChart extends TimelineChart { private CPUFrequencyChart() { chartType = TimelineConstants.CHART_TYPE_CPU_FREQUENCY; - probeType = AnalyzerConstants.MSG_DATA_SYSTEM; + probeType = LogCenterConstants.LOG_DEVICE; chartName = TimelineChartLabels.CPU_FREQUENCY_CHART_TITLE; chartIcon = ImageResources.CHART_CPU_FREQUENCY; addIcon = ImageResources.ADD_CHART_CPU_FREQUENCY; @@ -67,7 +65,7 @@ public class CPUFrequencyChart extends TimelineChart { frequencySeries = new DAChartSeries( TimelineChartLabels.CPU_FREQUENCY_CHART_FREQUENCY, DAChartSeries.SERIES_STYLE_LINE, - ColorResources.SERIESE_COLOR_CPU_FREQ); + ColorResources.SERIES_COLOR_CPU_FREQ); } @Override @@ -75,7 +73,7 @@ public class CPUFrequencyChart extends TimelineChart { DAChartBoardItem item = super.createBoardItem(board); chart.addSeries(frequencySeries); - + chart.getPlot().setAxisUnit("Hz"); chart.getPlot().setShowAxis(true); @@ -87,29 +85,21 @@ public class CPUFrequencyChart extends TimelineChart { Logs logs = logPack.getLogs(probeType); List logList = logs.getLogs(); - for (LogData log : logList) { - parsingLog((SystemData) log); + for (LogData logData : logList) { + parsingLog((SystemData)logData); } } - private void parsingLog(SystemData log) { - if (null == log) { - return; - } - - if (!log.getCpuFrequency().isEmpty()) { - try { - double time = Double.parseDouble(Long.toString(log.getTime())) - / TimelineConstants.MEGA; - String[] cpuFreqs = log.getCpuFrequency().split( - CommonConstants.COMMA); + private void parsingLog(SystemData logData) { + try { + double time = logData.getTime() / TimelineConstants.MEGA_DOUBLE; + String[] cpuFreqs = logData.getCpuFrequency().split(","); //$NON-NLS-1$ - double freq0 = Double.parseDouble(cpuFreqs[0]) * (double) 1000; - frequencySeries.addSeriesItem(new DAChartSeriesItem(time, - freq0, Formatter.toHzFormat(freq0))); - } catch (NumberFormatException ne) { - ne.printStackTrace(); - } + double freq0 = Double.parseDouble(cpuFreqs[0]) * (double) 1000; + frequencySeries.addSeriesItem(new DAChartSeriesItem(time, freq0, + Formatter.toHzFormat(freq0))); + } catch (NumberFormatException ne) { + ne.printStackTrace(); } } } diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/FileChart.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/FileChart.java index ce43598..291f8cb 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/FileChart.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/FileChart.java @@ -30,8 +30,8 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.concurrent.Semaphore; -import org.tizen.dynamicanalyzer.common.AnalyzerConstants; import org.tizen.dynamicanalyzer.logparser.LogCenterConstants; import org.tizen.dynamicanalyzer.nl.TimelineChartLabels; import org.tizen.dynamicanalyzer.resources.ColorResources; @@ -42,6 +42,7 @@ import org.tizen.dynamicanalyzer.swap.model.probe2.LogData; import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants; import org.tizen.dynamicanalyzer.utils.Formatter; import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlot; +import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlot.AutoRangeType; import org.tizen.dynamicanalyzer.widgets.chart.DAChartSeries; import org.tizen.dynamicanalyzer.widgets.chart.DAChartSeriesItem; import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoard; @@ -60,7 +61,10 @@ public class FileChart extends TimelineChart { } } - private static FileChart instance = null; + private static final int PERMIT = 1; + private Semaphore semaphore = new Semaphore(PERMIT); + + private static volatile FileChart instance = null; private static final int MIN_FDCOUNT = 5; private static final int MIN_READ_WRITE_BYTE = 0; @@ -84,7 +88,11 @@ public class FileChart extends TimelineChart { public static FileChart getInstance() { if (instance == null) { - instance = new FileChart(); + synchronized (FileChart.class) { + if (instance == null) { + instance = new FileChart(); + } + } } return instance; @@ -92,7 +100,7 @@ public class FileChart extends TimelineChart { private FileChart() { chartType = TimelineConstants.CHART_TYPE_FILE; - probeType = AnalyzerConstants.MSG_DATA_SYSTEM; + probeType = LogCenterConstants.LOG_DEVICE; chartName = TimelineChartLabels.FILE_CHART_TITLE; chartIcon = ImageResources.CHART_FILE; addIcon = ImageResources.ADD_CHART_FILE; @@ -100,17 +108,17 @@ public class FileChart extends TimelineChart { readSeries = new DAChartSeries( TimelineChartLabels.FILE_CHART_SERIES_NAME_READ, DAChartSeries.SERIES_STYLE_BAR, - ColorResources.SERIESE_COLOR_FILE_READ); + ColorResources.SERIES_COLOR_FILE_READ); readSeries.setBarAlign(DAChartSeries.SERIES_BAR_ALIGN_CENTER); writeSeries = new DAChartSeries( TimelineChartLabels.FILE_CHART_SERIES_NAME_WRITE, DAChartSeries.SERIES_STYLE_BAR, - ColorResources.SERIESE_COLOR_FILE_WRITE); + ColorResources.SERIES_COLOR_FILE_WRITE); writeSeries.setBarAlign(DAChartSeries.SERIES_BAR_ALIGN_CENTER); fdCountSeries = new DAChartSeries( TimelineChartLabels.FILE_CHART_SERIES_NAME_FD_COUNT, DAChartSeries.SERIES_STYLE_STEP, - ColorResources.SERIESE_COLOR_FILE_FD); + ColorResources.SERIES_COLOR_FILE_FD); } @Override @@ -121,7 +129,7 @@ public class FileChart extends TimelineChart { chart.addSeries(fdCountSeries); chart.addSeries(writeSeries); - chart.getPlot().setAutoHeightRange(false); + chart.getPlot().setAutoHeightRange(AutoRangeType.MANUAL); chart.getPlot().setSeriesHeightRange(true); chart.getPlot().setAxisUnit("B"); chart.getPlot().setSecondAxisUnit(""); @@ -144,7 +152,7 @@ public class FileChart extends TimelineChart { deviceLogTimeList.clear(); fdCountSeriesItemIndexMap.clear(); deviceTimeIndexMap.clear(); - fileDataQ.clear(); + getFileDataQ().clear(); fdCountSeries.addSeriesItem(new DAChartSeriesItem(0, 0, "0")); } @@ -154,10 +162,10 @@ public class FileChart extends TimelineChart { Logs logs = logPack.getLogs(probeType); List logList = logs.getLogs(); for (LogData log : logList) { - double time = Double.parseDouble(Long.toString(log.getTime())); + double time = log.getTime(); int size = deviceLogTimeList.size(); - int index = (int) (time / TimelineConstants.MEGA); + int index = (int) (time / TimelineConstants.MEGA_DOUBLE); if (size <= index) { for (int i = size; i <= index; i++) { @@ -172,102 +180,117 @@ public class FileChart extends TimelineChart { private void updateRW(double time) { readSeries.addSeriesItem(new DAChartSeriesItem(time - / TimelineConstants.MEGA, 0, Formatter.toByteFormat(0))); + / TimelineConstants.MEGA_DOUBLE, 0, Formatter.toByteFormat(0))); writeSeries.addSeriesItem(new DAChartSeriesItem(time - / TimelineConstants.MEGA, 0, Formatter.toByteFormat(0))); + / TimelineConstants.MEGA_DOUBLE, 0, Formatter.toByteFormat(0))); deviceTimeIndexMap.put(time, readSeries.getSeriesItemList().size() - 1); - doQJob(); } private void doQJob() { - while (fileDataQ.size() != 0) { - int deviceTimeIndex = getDeviceTimeIndexByTime(fileDataQ.get(0).time - / TimelineConstants.MEGA); - - if (deviceTimeIndex == -1) { - break; - } else { - double deviceTime = deviceLogTimeList.get(deviceTimeIndex); - - switch (fileDataQ.get(0).type) { - case TYPE_FDCOUNT: - fdCount += fileDataQ.get(0).data; - - Integer fdCountSeriesItemIndex = fdCountSeriesItemIndexMap - .get(deviceTime); - if (fdCountSeriesItemIndex == null) { - fdCountSeries.addSeriesItem(new DAChartSeriesItem( - deviceTime / TimelineConstants.MEGA, fdCount, - String.valueOf(fdCount))); - fdCountSeriesItemIndexMap.put(deviceTime, fdCountSeries - .getSeriesItemList().size() - 1); - } else { - DAChartSeriesItem item = fdCountSeries - .getSeriesItemList() - .get(fdCountSeriesItemIndex); - item.setY(fdCount); - item.setTooltipText(String.valueOf(fdCount)); + try { + semaphore.acquire(); + if (getFileDataQ().size() != 0) { + int deviceTimeIndex = getDeviceTimeIndexByTime(getFileDataQ() + .get(0).time / TimelineConstants.MEGA_DOUBLE); + if (deviceTimeIndex == -1) { + return; + } else { + double deviceTime = deviceLogTimeList.get(deviceTimeIndex); + switch (getFileDataQ().get(0).type) { + case TYPE_FDCOUNT: + fdCount += getFileDataQ().get(0).data; + + Integer fdCountSeriesItemIndex = fdCountSeriesItemIndexMap + .get(deviceTime); + if (fdCountSeriesItemIndex == null) { + fdCountSeries.addSeriesItem(new DAChartSeriesItem( + deviceTime / TimelineConstants.MEGA_DOUBLE, + fdCount, String.valueOf(fdCount))); + fdCountSeriesItemIndexMap + .put(deviceTime, fdCountSeries + .getSeriesItemList().size() - 1); + } else { + DAChartSeriesItem item = fdCountSeries + .getSeriesItemList().get( + fdCountSeriesItemIndex); + item.setY(fdCount); + item.setTooltipText(String.valueOf(fdCount)); + } + + if (fdCount > maxFDCount) { + maxFDCount = fdCount; + fdCountSeries.setEndY(maxFDCount * 1.1 + 1); + } + break; + case TYPE_READ: + DAChartSeriesItem readItem = readSeries + .getSeriesItemList().get( + deviceTimeIndexMap.get(deviceTime)); + double readSum = readItem.getY() + + getFileDataQ().get(0).data; + readItem.setY(readSum); + readItem.setTooltipText(Formatter.toByteFormat(readSum)); + if (readSum > maxReadWrite) { + maxReadWrite = readSum; + readSeries.setEndY(maxReadWrite * 1.1); + writeSeries.setEndY(maxReadWrite * 1.1); + } + break; + case TYPE_WRITE: + DAChartSeriesItem writeItem = writeSeries + .getSeriesItemList().get( + deviceTimeIndexMap.get(deviceTime)); + double writeSum = writeItem.getY() + + getFileDataQ().get(0).data; + writeItem.setY(writeSum); + writeItem.setTooltipText(Formatter + .toByteFormat(writeSum)); + if (writeSum > maxReadWrite) { + maxReadWrite = writeSum; + readSeries.setEndY(maxReadWrite * 1.1); + writeSeries.setEndY(maxReadWrite * 1.1); + } + break; + default: + System.out + .println("FileChart.java : wrong file api type");//$NON-NLS-1$ } - if (fdCount > maxFDCount) { - maxFDCount = fdCount; - fdCountSeries.setEndY(maxFDCount * 1.1 + 1); - } - break; - case TYPE_READ: - DAChartSeriesItem readItem = readSeries.getSeriesItemList() - .get(deviceTimeIndexMap.get(deviceTime)); - double readSum = readItem.getY() + fileDataQ.get(0).data; - readItem.setY(readSum); - readItem.setTooltipText(Formatter.toByteFormat(readSum)); - if (readSum > maxReadWrite) { - maxReadWrite = readSum; - readSeries.setEndY(maxReadWrite * 1.1); - writeSeries.setEndY(maxReadWrite * 1.1); - } - break; - case TYPE_WRITE: - DAChartSeriesItem writeItem = writeSeries - .getSeriesItemList().get( - deviceTimeIndexMap.get(deviceTime)); - double writeSum = writeItem.getY() + fileDataQ.get(0).data; - writeItem.setY(writeSum); - writeItem.setTooltipText(Formatter.toByteFormat(writeSum)); - if (writeSum > maxReadWrite) { - maxReadWrite = writeSum; - readSeries.setEndY(maxReadWrite * 1.1); - writeSeries.setEndY(maxReadWrite * 1.1); - } - break; - default: - System.out.println("FileChart.java : wrong file api type");//$NON-NLS-1$ + getFileDataQ().remove(0); } - - fileDataQ.remove(0); } + } catch (InterruptedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } finally { + semaphore.release(); } + + } + + private List getFileDataQ() { + return fileDataQ; } public void setFDCount(int count, double time) { - fileDataQ.add(new FDCountData(TYPE_FDCOUNT, time, count)); + getFileDataQ().add(new FDCountData(TYPE_FDCOUNT, time, count)); doQJob(); } public void setReadByte(long size, double time) { - fileDataQ.add(new FDCountData(TYPE_READ, time, size)); + getFileDataQ().add(new FDCountData(TYPE_READ, time, size)); doQJob(); } public void setWriteByte(long size, double time) { - fileDataQ.add(new FDCountData(TYPE_WRITE, time, size)); + getFileDataQ().add(new FDCountData(TYPE_WRITE, time, size)); doQJob(); } private int getDeviceTimeIndexByTime(double time) { int flat = (int) time; - int i; for (i = flat; i < deviceLogTimeList.size(); i++) { Double deviceLogTime = deviceLogTimeList.get(i); diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/HeapChart.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/HeapChart.java index a0614dc..3adad3b 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/HeapChart.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/HeapChart.java @@ -29,7 +29,7 @@ package org.tizen.dynamicanalyzer.ui.timeline.chart; import java.util.HashMap; import java.util.List; -import org.tizen.dynamicanalyzer.common.AnalyzerConstants; +import org.tizen.dynamicanalyzer.logparser.LogCenterConstants; import org.tizen.dynamicanalyzer.nl.TimelineChartLabels; import org.tizen.dynamicanalyzer.resources.ColorResources; import org.tizen.dynamicanalyzer.resources.ImageResources; @@ -53,12 +53,11 @@ public class HeapChart extends TimelineChart { private static final int MEM_USER = 2; private static HeapChart instance = null; - // private static final String NIL = "(nil)"; //$NON-NLS-1$ private DAChartSeries totalAllocationSeries; private DAChartSeries userAllocationSeries; private double allocByte = 0; - private HashMap allocationSeriesDataSetMap = new HashMap(); + private HashMap allocationSeriesDataSetMap = new HashMap(); public static HeapChart getInstance() { if (instance == null) { @@ -70,7 +69,7 @@ public class HeapChart extends TimelineChart { private HeapChart() { chartType = TimelineConstants.CHART_TYPE_HEAP; - probeType = AnalyzerConstants.MSG_DATA_SYSTEM; + probeType = LogCenterConstants.LOG_DEVICE; chartName = TimelineChartLabels.HEAP_CHART_TITLE; chartIcon = ImageResources.CHART_HEAP; addIcon = ImageResources.ADD_CHART_HEAP; @@ -78,11 +77,11 @@ public class HeapChart extends TimelineChart { totalAllocationSeries = new DAChartSeries( TimelineChartLabels.HEAP_CHART_SERIES_NAME_PLATFORM_ALLOCATION, DAChartSeries.SERIES_STYLE_AREA, - ColorResources.SERIESE_COLOR_HEAP_SYSTEM); + ColorResources.SERIES_COLOR_HEAP_SYSTEM); userAllocationSeries = new DAChartSeries( TimelineChartLabels.HEAP_CHART_SERIES_NAME_USER_ALLOCATION, DAChartSeries.SERIES_STYLE_AREA, - ColorResources.SERIESE_COLOR_HEAP_USER); + ColorResources.SERIES_COLOR_HEAP_USER); } @Override @@ -101,13 +100,13 @@ public class HeapChart extends TimelineChart { @Override public void parseLogPackage(LogPackage logPack) { - Logs memoryLogs = logPack.getLogs(AnalyzerConstants.MSG_PROBE_MEMORY); - Logs deviceLogs = logPack.getLogs(AnalyzerConstants.MSG_DATA_SYSTEM); + Logs memoryLogs = logPack.getLogs(LogCenterConstants.LOG_MEMORY); + Logs deviceLogs = logPack.getLogs(LogCenterConstants.LOG_DEVICE); - List memoryLogList = (memoryLogs == null) ? null : memoryLogs - .getLogs(); - List deviceLogList = (deviceLogs == null) ? null : deviceLogs - .getLogs(); + List memoryLogList = memoryLogs == null ? null + : memoryLogs.getLogs(); + List deviceLogList = deviceLogs == null ? null + : deviceLogs.getLogs(); parsingLog(memoryLogList, deviceLogList); } @@ -118,26 +117,24 @@ public class HeapChart extends TimelineChart { /* user alloc */ try { - if (memoryLogList != null && !memoryLogList.isEmpty()) { + if (memoryLogList != null) { int size = memoryLogList.size(); for (int i = 0; i < size; i++) { - MemoryData log = (MemoryData) memoryLogList.get(i); - if (log != null) { - int memApiType = log.getMemoryApiType(); - int internalFlag = log.getInternalCall(); - long errorNo = log.getErrno(); - - if (errorNo == 0 && MEM_USER == internalFlag) { - if (MEM_API_TYPE_ALLOC == memApiType - || MEM_API_TYPE_FREE == memApiType - || MEM_API_TYPE_MANAGE == memApiType) { - double time = 0; - time = Double.parseDouble(Long.toString(log - .getTime())) / TimelineConstants.MEGA; - - isUserAllocUpdated = addNewSeriesUserAllocData( - memApiType, time, log); - } + MemoryData logData = (MemoryData) memoryLogList.get(i); + int memApiType = logData.getMemoryApiType(); + int internalFlag = logData.getInternalCall(); + long errorNo = logData.getErrno(); + + if (errorNo == 0 && MEM_USER == internalFlag) { + if (MEM_API_TYPE_ALLOC == memApiType + || MEM_API_TYPE_FREE == memApiType + || MEM_API_TYPE_MANAGE == memApiType) { + double time = 0; + time = logData.getTime() + / TimelineConstants.MEGA_DOUBLE; + + isUserAllocUpdated = addNewSeriesUserAllocData( + memApiType, time, logData); } } } @@ -148,31 +145,20 @@ public class HeapChart extends TimelineChart { /* total alloc */ try { - if (deviceLogList != null) { - int size = deviceLogList.size(); - for (int i = 0; i < size; i++) { - SystemData log = (SystemData) deviceLogList.get(i); - if (log != null) { - if (log.getTotalAllocSize() != 0) { - double time = ((double) log.getTime()) - / TimelineConstants.MEGA; - double value = (double) log.getTotalAllocSize() - - allocByte; - totalAllocationSeries - .addSeriesItem(new DAChartSeriesItem(time, - value, Formatter - .toByteFormat(value))); - - if (!isUserAllocUpdated) { - userAllocationSeries - .addSeriesItem(new DAChartSeriesItem( - time, - allocByte, - Formatter - .toByteFormat(allocByte))); - } - } - } + int size = deviceLogList.size(); + for (int i = 0; i < size; i++) { + SystemData log = (SystemData) deviceLogList.get(i); + + double time = log.getTime() / TimelineConstants.MEGA_DOUBLE; + double value = log.getTotalAllocSize() - allocByte; + totalAllocationSeries.addSeriesItem(new DAChartSeriesItem(time, + value, Formatter.toByteFormat(value))); + + if (!isUserAllocUpdated) { + userAllocationSeries + .addSeriesItem(new DAChartSeriesItem(time, + allocByte, Formatter + .toByteFormat(allocByte))); } } } catch (NumberFormatException ne) { @@ -182,24 +168,17 @@ public class HeapChart extends TimelineChart { private boolean addNewSeriesUserAllocData(int fdApiType, double time, MemoryData log) { - double size = 0; + long size = 0; - // String addressString = log.get(LogCenterConstants.MEMORY_ADDR_INDEX); - // if (addressString.equals(NIL)) { - // return false; - // } long address = log.getAddress(); - if (0 == address) { + if (address == 0) { return false; } if (MEM_API_TYPE_ALLOC == fdApiType) { - if (log.getSize() == 0) { - return false; - } - try { - size = (double) log.getSize(); + size = log.getSize(); + allocByte += size; allocationSeriesDataSetMap.put(address, size); } catch (NumberFormatException ne) { diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/ProcessMemoryChart.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/ProcessMemoryChart.java index c316722..9ff5e77 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/ProcessMemoryChart.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/ProcessMemoryChart.java @@ -28,7 +28,6 @@ package org.tizen.dynamicanalyzer.ui.timeline.chart; import java.util.List; -import org.tizen.dynamicanalyzer.common.AnalyzerConstants; import org.tizen.dynamicanalyzer.logparser.LogCenterConstants; import org.tizen.dynamicanalyzer.nl.TimelineChartLabels; import org.tizen.dynamicanalyzer.resources.ColorResources; @@ -62,7 +61,7 @@ public class ProcessMemoryChart extends TimelineChart { private ProcessMemoryChart() { chartType = TimelineConstants.CHART_TYPE_PROCESS_MEMORY; - probeType = AnalyzerConstants.MSG_DATA_SYSTEM; + probeType = LogCenterConstants.LOG_DEVICE; chartName = TimelineChartLabels.PROCESS_MEMORY_CHART_TITLE; chartIcon = ImageResources.CHART_PROCESS_MEMORY; addIcon = ImageResources.ADD_CHART_PROCESS_MEMORY; @@ -70,15 +69,15 @@ public class ProcessMemoryChart extends TimelineChart { VSSMemorySeries = new DAChartSeries( TimelineChartLabels.PROCESS_MEMORY_CHART_VSS, DAChartSeries.SERIES_STYLE_AREA, - ColorResources.SERIESE_COLOR_PROCESS_VSS); + ColorResources.SERIES_COLOR_PROCESS_VSS); RSSMemorySeries = new DAChartSeries( TimelineChartLabels.PROCESS_MEMORY_CHART_RSS, DAChartSeries.SERIES_STYLE_AREA, - ColorResources.SERIESE_COLOR_PROCESS_RSS); + ColorResources.SERIES_COLOR_PROCESS_RSS); PSSMemorySeries = new DAChartSeries( TimelineChartLabels.PROCESS_MEMORY_CHART_PSS, DAChartSeries.SERIES_STYLE_AREA, - ColorResources.SERIESE_COLOR_PROCESS_PSS); + ColorResources.SERIES_COLOR_PROCESS_PSS); } @Override @@ -101,37 +100,43 @@ public class ProcessMemoryChart extends TimelineChart { Logs logs = logPack.getLogs(probeType); List logList = logs.getLogs(); - for (LogData log : logList) { - parsingLog((SystemData) log); + for (LogData logData : logList) { + parsingLog((SystemData)logData); } } - private void parsingLog(SystemData log) { + private void parsingLog(SystemData logData) { /* VSS */ - if (log.getVirtualMemory() != 0) { - double time = ((double) log.getTime()) / TimelineConstants.MEGA; - double value = (double) log.getVirtualMemory(); + try { + double time = logData.getTime() / TimelineConstants.MEGA_DOUBLE; + int value = logData.getVirtualMemory(); VSSMemorySeries.addSeriesItem(new DAChartSeriesItem(time, value, Formatter.toByteFormat(value))); + } catch (NumberFormatException ne) { + ne.printStackTrace(); } /* RSS */ - if (log.getResidentMemory() != 0) { - double time = ((double) log.getTime()) / TimelineConstants.MEGA; - double value = (double) log.getResidentMemory(); + try { + double time = logData.getTime() / TimelineConstants.MEGA_DOUBLE; + int value = logData.getResidentMemory(); RSSMemorySeries.addSeriesItem(new DAChartSeriesItem(time, value, Formatter.toByteFormat(value))); + } catch (NumberFormatException ne) { + ne.printStackTrace(); } /* PSS */ - if (log.getPssMemory() != 0) { - double time = ((double) log.getTime()) / TimelineConstants.MEGA; - double value = (double) log.getPssMemory(); + try { + double time = logData.getTime() / TimelineConstants.MEGA_DOUBLE; + int value = logData.getPssMemory(); PSSMemorySeries.addSeriesItem(new DAChartSeriesItem(time, value, Formatter.toByteFormat(value))); + } catch (NumberFormatException ne) { + ne.printStackTrace(); } } } diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/ScreenshotChart.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/ScreenshotChart.java index 9e69ac7..7af5052 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/ScreenshotChart.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/ScreenshotChart.java @@ -34,6 +34,7 @@ import org.eclipse.swt.graphics.Image; import org.eclipse.swt.widgets.Display; import org.tizen.dynamicanalyzer.common.AnalyzerConstants; import org.tizen.dynamicanalyzer.common.AnalyzerManager; +import org.tizen.dynamicanalyzer.logparser.LogCenterConstants; import org.tizen.dynamicanalyzer.nl.TimelineChartLabels; import org.tizen.dynamicanalyzer.resources.ImageResources; import org.tizen.dynamicanalyzer.swap.logparser.LogPackage; @@ -63,7 +64,7 @@ public class ScreenshotChart extends TimelineChart { private ScreenshotChart() { chartType = TimelineConstants.CHART_TYPE_SCREENSHOT; chartStyle = DAChart.CHART_STYLE_SCREENSHOT; - probeType = AnalyzerConstants.MSG_PROBE_SCREENSHOT; + probeType = LogCenterConstants.LOG_SCREENSHOT; chartName = TimelineChartLabels.SCREENSHOT_CHART_TITLE; chartIcon = ImageResources.CHART_SCREENSHOT; addIcon = ImageResources.ADD_CHART_SCREENSHOT; @@ -92,31 +93,29 @@ public class ScreenshotChart extends TimelineChart { @Override public void parseLogPackage(LogPackage logPack) { Logs logs = logPack.getLogs(probeType); - if (null == logs) { - return; - } List logList = logs.getLogs(); - for (LogData log : logList) { - parsingLog((ScreenShotData) log); + for (LogData logData : logList) { + parsingLog((ScreenShotData)logData); } } - private void parsingLog(ScreenShotData log) { + private void parsingLog(ScreenShotData logData) { try { - double time = ((double) log.getTime()) / TimelineConstants.MEGA; + double time = logData.getTime() / TimelineConstants.MEGA_DOUBLE; + String imagePath = AnalyzerManager.getProject().getSavePath() + File.separator + AnalyzerConstants.IMAGE_FOLDER_NAME + File.separator + AnalyzerConstants.SMALL_IMAGE_FOLDER_NAME; - String imagePathLog = log.getImageFilePath(); + String imagePathLog = logData.getImageFilePath(); String[] splitedImagePathLog = imagePathLog.split("/"); //$NON-NLS-1$ String fileName = splitedImagePathLog[splitedImagePathLog.length - 1]; imagePath += File.separator + fileName; - int orientation = log.getOrientation(); + int orientation = logData.getOrientation(); int yPostion; - if (orientation == 0 || orientation == 180) { + if (orientation == 0 || orientation == 180) { //$NON-NLS-1$ //$NON-NLS-2$ yPostion = 10; } else { yPostion = 23; diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/SystemMemoryChart.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/SystemMemoryChart.java index e098f16..e996a29 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/SystemMemoryChart.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/SystemMemoryChart.java @@ -28,8 +28,8 @@ package org.tizen.dynamicanalyzer.ui.timeline.chart; import java.util.List; -import org.tizen.dynamicanalyzer.common.AnalyzerConstants; import org.tizen.dynamicanalyzer.common.AnalyzerManager; +import org.tizen.dynamicanalyzer.logparser.LogCenterConstants; import org.tizen.dynamicanalyzer.nl.TimelineChartLabels; import org.tizen.dynamicanalyzer.resources.ColorResources; import org.tizen.dynamicanalyzer.resources.ImageResources; @@ -62,7 +62,7 @@ public class SystemMemoryChart extends TimelineChart { private SystemMemoryChart() { chartType = TimelineConstants.CHART_TYPE_SYSTEM_MEMORY; - probeType = AnalyzerConstants.MSG_DATA_SYSTEM; + probeType = LogCenterConstants.LOG_DEVICE; chartName = TimelineChartLabels.SYSTEM_MEMORY_CHART_TITLE; chartIcon = ImageResources.CHART_SYSTEM_MEMORY; addIcon = ImageResources.ADD_CHART_SYSTEM_MEMORY; @@ -70,15 +70,15 @@ public class SystemMemoryChart extends TimelineChart { processSeries = new DAChartSeries( TimelineChartLabels.SYSTEM_MEMORY_CHART_SERIES_NAME_PROC_RESIDENT, DAChartSeries.SERIES_STYLE_AREA, - ColorResources.SERIESE_COLOR_MEMORY_APP_USED); + ColorResources.SERIES_COLOR_MEMORY_APP_USED); systemSeries = new DAChartSeries( TimelineChartLabels.SYSTEM_MEMORY_CHART_SERIES_NAME_SYSTEM, DAChartSeries.SERIES_STYLE_AREA, - ColorResources.SERIESE_COLOR_MEMORY_SYS_USED); + ColorResources.SERIES_COLOR_MEMORY_SYS_USED); totalSeries = new DAChartSeries( TimelineChartLabels.SYSTEM_MEMORY_CHART_SERIES_NAME_TOTAL, DAChartSeries.SERIES_STYLE_AREA, - ColorResources.SERIESE_COLOR_MEMORY_SYS_MAX); + ColorResources.SERIES_COLOR_MEMORY_SYS_MAX); } @Override @@ -101,29 +101,27 @@ public class SystemMemoryChart extends TimelineChart { Logs logs = logPack.getLogs(probeType); List logList = logs.getLogs(); - for (LogData log : logList) { - parsingLog((SystemData) log); + for (LogData logData : logList) { + parsingLog((SystemData)logData); } } private void parsingLog(SystemData log) { - if (null == log) { - return; - } - /* process */ - if (log.getResidentMemory() != 0) { - double time = ((double) log.getTime()) / TimelineConstants.MEGA; - double usage = (double) log.getResidentMemory(); + try { + double time = log.getTime() / TimelineConstants.MEGA_DOUBLE; + int usage = log.getResidentMemory(); processSeries.addSeriesItem(new DAChartSeriesItem(time, usage, Formatter.toByteFormat(usage))); + } catch (NumberFormatException ne) { + ne.printStackTrace(); } /* system & total */ - if (log.getSystemMemoryUsed() != 0) { - double time = ((double) log.getTime()) / TimelineConstants.MEGA; + try { + double time = log.getTime() / TimelineConstants.MEGA_DOUBLE; - double usage = (double) log.getSystemMemoryUsed(); + long usage = log.getSystemMemoryUsed(); double total = (double) AnalyzerManager.getProject() .getSystemMemorySize(); @@ -131,6 +129,8 @@ public class SystemMemoryChart extends TimelineChart { Formatter.toByteFormat(usage))); totalSeries.addSeriesItem(new DAChartSeriesItem(time, total, Formatter.toByteFormat(total))); + } catch (NumberFormatException ne) { + ne.printStackTrace(); } } } diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/TimelineChart.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/TimelineChart.java index d68db0b..14f5c73 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/TimelineChart.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/TimelineChart.java @@ -33,29 +33,30 @@ import org.tizen.dynamicanalyzer.nl.TimelineChartLabels; import org.tizen.dynamicanalyzer.resources.FontResources; import org.tizen.dynamicanalyzer.resources.ImageResources; import org.tizen.dynamicanalyzer.swap.logparser.LogPackage; -import org.tizen.dynamicanalyzer.ui.common.ContextAnalysisMenuItemClickListener; -import org.tizen.dynamicanalyzer.ui.common.ContextClearMenuItemClickListener; -import org.tizen.dynamicanalyzer.ui.common.ContextEndMenuItemClickListener; -import org.tizen.dynamicanalyzer.ui.common.ContextFromSelectionMenuItemClickListener; -import org.tizen.dynamicanalyzer.ui.common.ContextStartMenuItemClickListener; -import org.tizen.dynamicanalyzer.ui.widgets.DAContextMenu; +import org.tizen.dynamicanalyzer.ui.common.PopupAnalysisMenuItemClickListener; +import org.tizen.dynamicanalyzer.ui.common.PopupClearMenuItemClickListener; +import org.tizen.dynamicanalyzer.ui.common.PopupEndMenuItemClickListener; +import org.tizen.dynamicanalyzer.ui.common.PopupFromSelectionMenuItemClickListener; +import org.tizen.dynamicanalyzer.ui.common.PopupStartMenuItemClickListener; import org.tizen.dynamicanalyzer.widgets.chart.DAChart; import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlot; +import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlot.AutoRangeType; import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlotTooltip; import org.tizen.dynamicanalyzer.widgets.chart.DAChartSeries; import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoard; import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoardItem; -import org.tizen.dynamicanalyzer.widgets.contextMenu.DAContextMenuItem; +import org.tizen.dynamicanalyzer.widgets.popupMenu.DAPopupMenu; +import org.tizen.dynamicanalyzer.widgets.popupMenu.DAPopupMenuItem; public abstract class TimelineChart { protected DAChart chart; - protected long chartType; + protected int chartType; protected int chartStyle = DAChart.CHART_STYLE_NORMAL; protected int probeType; protected String chartName; protected Image chartIcon; protected Image addIcon; - protected DAContextMenu popupMenu; + protected DAPopupMenu popupMenu; public abstract void parseLogPackage(LogPackage logPack); @@ -66,34 +67,32 @@ public abstract class TimelineChart { setChartStyle(); - popupMenu = new DAContextMenu(chart); + popupMenu = new DAPopupMenu(chart); popupMenu.setFont(FontResources.CONTEXT_MENU_ITEM_FONT); - DAContextMenuItem startItem = new DAContextMenuItem(popupMenu); + DAPopupMenuItem startItem = new DAPopupMenuItem(popupMenu); startItem.setText(TimelineChartLabels.RANGE_CONTEXT_SET_START); - startItem.addClickListener(new ContextStartMenuItemClickListener( + startItem.addListener(new PopupStartMenuItemClickListener( startItem, chartBoard)); - DAContextMenuItem endItem = new DAContextMenuItem(popupMenu); + DAPopupMenuItem endItem = new DAPopupMenuItem(popupMenu); endItem.setText(TimelineChartLabels.RANGE_CONTEXT_SET_END); - endItem.addClickListener(new ContextEndMenuItemClickListener(endItem, + endItem.addListener(new PopupEndMenuItemClickListener(endItem, chartBoard)); - DAContextMenuItem fromSelectionItem = new DAContextMenuItem(popupMenu); + DAPopupMenuItem fromSelectionItem = new DAPopupMenuItem(popupMenu); fromSelectionItem .setText(TimelineChartLabels.RANGE_CONTEXT_SET_FROM_SELECTION); fromSelectionItem - .addClickListener(new ContextFromSelectionMenuItemClickListener( + .addListener(new PopupFromSelectionMenuItemClickListener( fromSelectionItem, chartBoard)); - DAContextMenuItem analysisItem = new DAContextMenuItem(popupMenu); + DAPopupMenuItem analysisItem = new DAPopupMenuItem(popupMenu); analysisItem.setText(TimelineChartLabels.RANGE_CONTEXT_ANALYSIS); - analysisItem - .addClickListener(new ContextAnalysisMenuItemClickListener()); + analysisItem.addListener(new PopupAnalysisMenuItemClickListener()); - DAContextMenuItem clearItem = new DAContextMenuItem(popupMenu); + DAPopupMenuItem clearItem = new DAPopupMenuItem(popupMenu); clearItem.setText(TimelineChartLabels.RANGE_CONTEXT_CLEAR); - clearItem.addClickListener(new ContextClearMenuItemClickListener( - chartBoard)); + clearItem.addListener(new PopupClearMenuItemClickListener()); return item; } @@ -115,7 +114,7 @@ public abstract class TimelineChart { return; } plot.setBackgroundImage(ImageResources.BG_GRADIENT); - plot.setAutoHeightRange(true); + plot.setAutoHeightRange(AutoRangeType.SEMI_AUTO); DAChartPlotTooltip tooltip = new DAChartPlotTooltip(-1); tooltip.setFont(FontResources.CHART_TOOLTIP_FONT); plot.setTooltip(tooltip); @@ -128,7 +127,7 @@ public abstract class TimelineChart { } } - public long getChartType() { + public int getChartType() { return chartType; } @@ -148,7 +147,7 @@ public abstract class TimelineChart { return probeType; } - public DAContextMenu getPopupMenu() { + public DAPopupMenu getPopupMenu() { return popupMenu; } } diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/UIEventChart.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/UIEventChart.java index 394454a..a5b03ea 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/UIEventChart.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/UIEventChart.java @@ -28,8 +28,8 @@ package org.tizen.dynamicanalyzer.ui.timeline.chart; import java.util.List; -import org.tizen.dynamicanalyzer.common.AnalyzerConstants; import org.tizen.dynamicanalyzer.common.CommonConstants; +import org.tizen.dynamicanalyzer.logparser.LogCenterConstants; import org.tizen.dynamicanalyzer.nl.TimelineChartLabels; import org.tizen.dynamicanalyzer.resources.ColorResources; import org.tizen.dynamicanalyzer.resources.FontResources; @@ -47,8 +47,8 @@ import org.tizen.dynamicanalyzer.widgets.chart.DAChartSeries; import org.tizen.dynamicanalyzer.widgets.chart.DAChartSeriesItem; import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoard; import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoardItem; -import org.tizen.dynamicanalyzer.widgets.contextMenu.DAContextMenuItem; -import org.tizen.dynamicanalyzer.widgets.contextMenu.DAContextMenuListener; +import org.tizen.dynamicanalyzer.widgets.popupMenu.DAPopupMenuItem; +import org.tizen.dynamicanalyzer.widgets.popupMenu.DAPopupMenuListener; public class UIEventChart extends TimelineChart { private static UIEventChart instance = null; @@ -84,7 +84,7 @@ public class UIEventChart extends TimelineChart { private UIEventChart() { chartType = TimelineConstants.CHART_TYPE_UIEVENT; chartStyle = DAChart.CHART_STYLE_MULTI; - probeType = AnalyzerConstants.MSG_PROBE_UIEVENT; + probeType = LogCenterConstants.LOG_UI_EVENT; chartName = TimelineChartLabels.UI_EVENT_CHART_TITLE; chartIcon = ImageResources.CHART_UI_EVENT; addIcon = ImageResources.ADD_CHART_UI_EVENT; @@ -114,9 +114,9 @@ public class UIEventChart extends TimelineChart { final UIEventChartContextMenuItem eventListItem = new UIEventChartContextMenuItem( popupMenu); eventListItem.setText(TimelineChartLabels.RANGE_CONTEXT_EVENT_LIST); - eventListItem.addClickListener(new DAContextMenuListener() { + eventListItem.addListener(new DAPopupMenuListener() { @Override - public void widgetSelected(DAContextMenuItem menuItem) { + public void widgetSelected(DAPopupMenuItem menuItem) { List chartSeriesList = eventListItem .getChartSeriesList(); List startIndexList = eventListItem @@ -142,37 +142,36 @@ public class UIEventChart extends TimelineChart { @Override public void parseLogPackage(LogPackage logPack) { Logs logs = logPack.getLogs(probeType); - if (null == logs) { - return; - } List logList = logs.getLogs(); - for (LogData log : logList) { - parsingLog((UIEventData) log); + for (LogData logData : logList) { + parsingLog((UIEventData)logData); } } - private void parsingLog(UIEventData log) { + private void parsingLog(UIEventData logData) { try { - double time = ((double) log.getTime()) / TimelineConstants.MEGA; + double time = logData.getTime() / TimelineConstants.MEGA_DOUBLE; int detailType; - int type = log.getEventType(); + int eventType = logData.getEventType(); String info; - switch (type) { + switch (eventType) { case TYPE_TOUCH: - detailType = log.getDetailType(); + detailType = logData.getDetailType(); info = EnumTouchStatus.values()[detailType].getStatus() - + NEW_LINE + "X : " + log.getX() + " Y : " + log.getY(); + + NEW_LINE + "X : "//$NON-NLS-1$ + + logData.getX() + " Y : "//$NON-NLS-1$ + + logData.getY(); touchEventSeries.addSeriesItem(new DAChartSeriesItem(time, 0, info)); break; case TYPE_GESTURE: - detailType = log.getDetailType(); + detailType = logData.getDetailType(); gestureEventSeries.addSeriesItem(new DAChartSeriesItem(time, 0, - getGestureInfo(detailType, log))); + getGestureInfo(detailType, logData))); break; case TYPE_ORIENTATION: - int status = Integer.parseInt(log.getInfo1()); + int status = Integer.parseInt(logData.getInfo1()); orientationEventSeries.addSeriesItem(new DAChartSeriesItem( time, 0, TimelineChartLabels.UIEVENT_ORIENTATION + " "//$NON-NLS-1$ @@ -227,22 +226,22 @@ public class UIEventChart extends TimelineChart { } } - private String getGestureInfo(int detailType, UIEventData log) { + private String getGestureInfo(int detailType, UIEventData logData) { String info = CommonConstants.EMPTY; switch (detailType) { case GESTURE_TYPE_FLICK: info = TimelineChartLabels.UIEVENT_GESTURE_FLICK + " "//$NON-NLS-1$ - + getFlickDirection(log.getInfo2()) + + getFlickDirection(logData.getInfo2()) + NEW_LINE + TimelineChartLabels.UIEVENT_INFO_DISTANCE + " X : "//$NON-NLS-1$ - + log.getX() + NEW_LINE + + logData.getX() + NEW_LINE + TimelineChartLabels.UIEVENT_INFO_DISTANCE + " Y : "//$NON-NLS-1$ - + log.getY() + NEW_LINE + + logData.getY() + NEW_LINE + TimelineChartLabels.UIEVENT_INFO_DURATION + " : " //$NON-NLS-1$ - + log.getInfo1(); + + logData.getInfo1(); break; case GESTURE_TYPE_LONG_PRESS: info = TimelineChartLabels.UIEVENT_GESTURE_LONG_PRESS @@ -250,53 +249,52 @@ public class UIEventChart extends TimelineChart { + NEW_LINE + TimelineChartLabels.UIEVENT_INFO_MOVE_ALLOWANCE + " : "//$NON-NLS-1$ - + log.getX() + NEW_LINE + + logData.getX() + NEW_LINE + TimelineChartLabels.UIEVENT_INFO_TOUCH_COUNT + " : "//$NON-NLS-1$ - + log.getInfo2() + NEW_LINE + + logData.getInfo2() + NEW_LINE + TimelineChartLabels.UIEVENT_INFO_DURATION + " : " //$NON-NLS-1$ - + log.getInfo1(); + + logData.getInfo1(); break; case GESTURE_TYPE_PANNING: info = TimelineChartLabels.UIEVENT_GESTURE_PANNING + NEW_LINE + TimelineChartLabels.UIEVENT_INFO_TOUCH_COUNT + " : "//$NON-NLS-1$ - + log.getInfo2(); + + logData.getInfo2(); break; case GESTURE_TYPE_PINCH: info = TimelineChartLabels.UIEVENT_GESTURE_PINCH + NEW_LINE + TimelineChartLabels.UIEVENT_INFO_CENTER + " X : "//$NON-NLS-1$ - + log.getX() + NEW_LINE + + logData.getX() + NEW_LINE + TimelineChartLabels.UIEVENT_INFO_CENTER + " Y : "//$NON-NLS-1$ - + log.getY() + NEW_LINE + + logData.getY() + NEW_LINE + TimelineChartLabels.UIEVENT_INFO_DISTANCE + " : "//$NON-NLS-1$ - + log.getInfo1(); + + logData.getInfo1(); break; case GESTURE_TYPE_ROTATION: info = TimelineChartLabels.UIEVENT_GESTURE_ROTATION + NEW_LINE + TimelineChartLabels.UIEVENT_INFO_DISTANCE + " : "//$NON-NLS-1$ - + log.getInfo1() + TimelineChartLabels.UIEVENT_INFO_ANGLE - + " : "//$NON-NLS-1$ - + log.getInfo2(); + + logData.getInfo1() + + TimelineChartLabels.UIEVENT_INFO_ANGLE + " : "//$NON-NLS-1$ + + logData.getInfo2(); break; case GESTURE_TYPE_TAP: info = TimelineChartLabels.UIEVENT_GESTURE_TAP + " "//$NON-NLS-1$ + TimelineChartLabels.UIEVENT_INFO_COUNT + " : "//$NON-NLS-1$ - + log.getY() - + NEW_LINE + + logData.getY() + NEW_LINE + TimelineChartLabels.UIEVENT_INFO_MOVE_ALLOWANCE + " : "//$NON-NLS-1$ - + log.getX() + NEW_LINE + + logData.getX() + NEW_LINE + TimelineChartLabels.UIEVENT_INFO_TAP_INTERVAL + " : "//$NON-NLS-1$ - + log.getInfo1() + NEW_LINE + + logData.getInfo1() + NEW_LINE + TimelineChartLabels.UIEVENT_INFO_TOUCH_COUNT + " : "//$NON-NLS-1$ - + log.getInfo2(); + + logData.getInfo2(); break; default: System.out.println("UIEventChart.java wrong gesture type");//$NON-NLS-1$ diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/UserCustomChart.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/UserCustomChart.java index 663a3ed..dea4db7 100755 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/UserCustomChart.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/UserCustomChart.java @@ -29,7 +29,7 @@ package org.tizen.dynamicanalyzer.ui.timeline.chart; import java.util.ArrayList; import java.util.List; -import org.tizen.dynamicanalyzer.common.AnalyzerConstants; +import org.tizen.dynamicanalyzer.logparser.LogCenterConstants; import org.tizen.dynamicanalyzer.resources.ImageResources; import org.tizen.dynamicanalyzer.swap.logparser.LogPackage; import org.tizen.dynamicanalyzer.swap.logparser.Logs; @@ -44,7 +44,7 @@ public class UserCustomChart extends TimelineChart { private ArrayList tempSeriesList; private boolean[] usedColor; - public UserCustomChart(long chartType, String chartName) { + public UserCustomChart(int chartType, String chartName) { this.chartType = chartType; this.chartName = chartName; chartIcon = ImageResources.CHART_CUSTOM; @@ -74,19 +74,18 @@ public class UserCustomChart extends TimelineChart { @Override public void parseLogPackage(LogPackage logPack) { - Logs logList = logPack.getLogs(AnalyzerConstants.MSG_DATA_SYSTEM); - List logs = logList.getLogs(); + Logs logList = logPack.getLogs(LogCenterConstants.LOG_DEVICE); + List logDataList = logList.getLogs(); - if (logs.size() <= 0) { + if (logDataList.size() <= 0) { return; } - parsingLog(logs.get(logs.size() - 1)); + parsingLog(logDataList.get(logDataList.size() - 1)); } - private void parsingLog(LogData log) { + private void parsingLog(LogData logData) { try { - double time = Double.parseDouble(Long.toString(log.getTime())) - / TimelineConstants.MEGA; + double time = logData.getTime() / TimelineConstants.MEGA_DOUBLE; chart.getPlot().setValidEndX(time); } catch (NumberFormatException ne) { ne.printStackTrace(); diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/common/TimelineConstants.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/common/TimelineConstants.java index 85dd733..562ff36 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/common/TimelineConstants.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/common/TimelineConstants.java @@ -42,7 +42,8 @@ public class TimelineConstants { /* range selector */ public static final int TIMELINE_ITEM_INFO_WIDTH = 99; - public static final double MEGA = 1000000; + public static final double MEGA_DOUBLE = 1000000; + public static final long MEGA_LONG = 1000000; public static final int NOT_INITED = -1; } diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/common/TimelineView.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/common/TimelineView.java index 0568d17..0c9ff7f 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/common/TimelineView.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/common/TimelineView.java @@ -127,8 +127,8 @@ public class TimelineView extends DAView { long start = selData.getStartTime(); long end = selData.getEndTime(); - Double startTime = (double) start / TimelineConstants.MEGA; - Double endTime = (double) end / TimelineConstants.MEGA; + Double startTime = (double) start / TimelineConstants.MEGA_DOUBLE; + Double endTime = (double) end / TimelineConstants.MEGA_DOUBLE; double middleTime = (startTime + endTime) / 2.0; if (startTime.equals(endTime)) { middleTime = startTime; @@ -152,17 +152,17 @@ public class TimelineView extends DAView { chartBoard.setTotalEndTime(ToolbarArea.getInstance().getTime()); chartBoard.setTimelineMarkerStartTime(rangeDataManager - .getMarkerStartTime() / TimelineConstants.MEGA); + .getMarkerStartTime() / TimelineConstants.MEGA_DOUBLE); chartBoard.setTimelineMarkerEndTime(rangeDataManager.getMarkerEndTime() - / TimelineConstants.MEGA); + / TimelineConstants.MEGA_DOUBLE); if (RangeDataManager.getInstance().isBeingAnalyzed()) { ((DAChartPlotIntervalMarker) chartBoard.getMarkers().get( UICommonConstants.RANGE_ANALYSIS_MARKER_INDEX)) .setInterval(rangeDataManager.getAnalysisStartTime() - / TimelineConstants.MEGA, + / TimelineConstants.MEGA_DOUBLE, rangeDataManager.getAnalysisEndTime() - / TimelineConstants.MEGA); + / TimelineConstants.MEGA_DOUBLE); } else { ((DAChartPlotIntervalMarker) chartBoard.getMarkers().get( UICommonConstants.RANGE_ANALYSIS_MARKER_INDEX)) @@ -171,8 +171,8 @@ public class TimelineView extends DAView { ((DAChartPlotIntervalMarker) chartBoard.getMarkers().get( UICommonConstants.RANGE_MARKER_INDEX)).setInterval( - rangeDataManager.getMarkerStartTime() / TimelineConstants.MEGA, - rangeDataManager.getMarkerEndTime() / TimelineConstants.MEGA); + rangeDataManager.getMarkerStartTime() / TimelineConstants.MEGA_DOUBLE, + rangeDataManager.getMarkerEndTime() / TimelineConstants.MEGA_DOUBLE); } 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 index ff295f6..1985006 100755 --- 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 @@ -81,7 +81,7 @@ public class CustomLogParser { if (apiName.equals(API_NAME_CREATE_CHART)) { long chartHandle = log.getReturn(); String chartName = log.getName(); - chartManager.addCustomChart(new UserCustomChart(chartHandle, + chartManager.addCustomChart(new UserCustomChart((int) chartHandle, chartName)); } else if (apiName.equals(API_NAME_CREATE_SERIES)) { int chartType = log.getHandle(); @@ -132,7 +132,7 @@ public class CustomLogParser { || apiName.equals(API_NAME_TIMER_THREAD)) { long seriesHandle = log.getHandle(); double time = Double.parseDouble(Long.toString(log.getTime())) - / TimelineConstants.MEGA; + / TimelineConstants.MEGA_DOUBLE; double value = log.getValue(); DAChartSeries series = customChartSeriesMap.get(seriesHandle); series.addSeriesItem(new DAChartSeriesItem(time, value, String diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/logparser/LifecycleLogParser.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/logparser/LifecycleLogParser.java index 34809c9..aa6efc9 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/logparser/LifecycleLogParser.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/logparser/LifecycleLogParser.java @@ -103,7 +103,7 @@ public class LifecycleLogParser { } double startTime = Double.parseDouble(Long.toString(log.getTime())) - / TimelineConstants.MEGA; + / TimelineConstants.MEGA_DOUBLE; LifecycleData lifecycleData = new LifecycleData(startTime, colorTop, colorBottom, text); diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/uievent/UIEventListDialog.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/uievent/UIEventListDialog.java index 31eeb52..af9a02e 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/uievent/UIEventListDialog.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/uievent/UIEventListDialog.java @@ -188,34 +188,34 @@ public class UIEventListDialog extends Dialog { if (startTime != -1) { rangeDataManager - .setMarkerStartTime((long) (startTime * TimelineConstants.MEGA)); + .setMarkerStartTime((long) (startTime * TimelineConstants.MEGA_DOUBLE)); double revisedEndTime = rangeDataManager.getMarkerEndTime(); chartBoard.setTimelineMarkerStartTime(startTime); chartBoard.setTimelineMarkerEndTime(revisedEndTime - / TimelineConstants.MEGA); + / TimelineConstants.MEGA_DOUBLE); ((DAChartPlotIntervalMarker) chartBoard.getMarkers().get( UICommonConstants.RANGE_MARKER_INDEX)) .setStartVal(startTime); ((DAChartPlotIntervalMarker) chartBoard.getMarkers().get( UICommonConstants.RANGE_MARKER_INDEX)) - .setEndVal(revisedEndTime / TimelineConstants.MEGA); + .setEndVal(revisedEndTime / TimelineConstants.MEGA_DOUBLE); } if (endTime != -1) { rangeDataManager - .setMarkerEndTime((long) (endTime * TimelineConstants.MEGA)); + .setMarkerEndTime((long) (endTime * TimelineConstants.MEGA_DOUBLE)); double revisedStartTime = rangeDataManager.getMarkerStartTime(); chartBoard.setTimelineMarkerStartTime(revisedStartTime - / TimelineConstants.MEGA); + / TimelineConstants.MEGA_DOUBLE); chartBoard.setTimelineMarkerEndTime(endTime); ((DAChartPlotIntervalMarker) chartBoard.getMarkers().get( UICommonConstants.RANGE_MARKER_INDEX)) - .setStartVal(revisedStartTime / TimelineConstants.MEGA); + .setStartVal(revisedStartTime / TimelineConstants.MEGA_DOUBLE); ((DAChartPlotIntervalMarker) chartBoard.getMarkers().get( UICommonConstants.RANGE_MARKER_INDEX)) .setEndVal(endTime); diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/widgets/table/DATreeComposite.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/widgets/table/DATreeComposite.java index f50c512..c928be1 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/widgets/table/DATreeComposite.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/widgets/table/DATreeComposite.java @@ -59,7 +59,7 @@ public abstract class DATreeComposite extends DATableComposite { super(parent, compStyle, tableStyle); } - private HashMap getExpandMap() { + protected HashMap getExpandMap() { if (null == expandMap) { expandMap = new HashMap(); } @@ -129,6 +129,10 @@ public abstract class DATreeComposite extends DATableComposite { } // check expand + return checkExpand(gridItem, gridData); + } + + protected GridItem checkExpand(GridItem gridItem, DATableDataFormat gridData) { long seq = gridData.getSelectionKey(); Object expand = getExpandMap().get(seq); if (null == expand) { diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/utils/InternalLogManager.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/utils/InternalLogManager.java new file mode 100644 index 0000000..6a5dbc2 --- /dev/null +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/utils/InternalLogManager.java @@ -0,0 +1,529 @@ +/* + * Dynamic Analyzer + * + * Copyright (c) 2013 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * yeongtaik byeon + * 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.utils; + +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.io.PrintWriter; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import org.tizen.dynamicanalyzer.common.AnalyzerPaths; +import org.tizen.dynamicanalyzer.nl.ConfigureLabels; +import org.tizen.dynamicanalyzer.ui.toolbar.ConfigureManager; + +public class InternalLogManager { + private static InternalLogManager instance; + + public final static int LOG_TYPE_HOST = 0; + public final static int LOG_TYPE_TARGET = 1; + public final static int LOG_TYPE_ERROR = 2; + public final static int LOG_TYPE_WARNING = 3; + public final static int LOG_TYPE_INFO = 4; + public final static int LOG_TYPE_FUNCTION = 5; + public final static int LOG_TYPE_USAGE = 6; + + public final static int AUTO_TEST_COUNT = 20; + // Host Log + private Date hostStartTime; + private long hostStart; + // + private int logLevel; + private HashMap> usageTime; + private HashMap usageCount; + private HashMap usageTotalCount; + private HashMap usageTotalTime; + private SimpleDateFormat dateFormat; + + File outputFile; + FileWriter fileWriter = null; + BufferedWriter buffWriter = null; + PrintWriter printWriter = null; + + private InternalLogManager() { + init(); + } + + public static InternalLogManager getInstance() { + if (null == instance) { + instance = new InternalLogManager(); + } + return instance; + } + + private boolean checkLevel(int type) { + if (logLevel >= type) { + return true; + } else { + return false; + } + } + + private void init() { + logLevel = ConfigureManager.getInstance().getValueInt( + ConfigureLabels.INTERNAL_LOG_LEVEL); + dateFormat = new SimpleDateFormat("yyyy:MM:dd:HH:mm:ss:SSS"); + + if (checkLevel(LOG_TYPE_FUNCTION)) { + usageTime = new HashMap>(); + usageCount = new HashMap(); + usageTotalCount = new HashMap(); + usageTotalTime = new HashMap(); + } + } + + public Date getHostStartTime() { + return hostStartTime; + } + + /** + * logging InternalLogManager.LOG_TYPE_INFO msg + * + * @param msg + */ + public void log(String msg) { + if (checkLevel(LOG_TYPE_INFO)) { + log(LOG_TYPE_INFO, msg); + } + } + + /** + * logging type msg + * + * @param type + * InternalLogManager.LOG_TYPE_HOST + * InternalLogManager.LOG_TYPE_TARGET + * InternalLogManager.LOG_TYPE_ERROR + * InternalLogManager.LOG_TYPE_WARNING + * InternalLogManager.LOG_TYPE_INFO + * InternalLogManager.LOG_TYPE_FUNCTION + * InternalLogManager.LOG_TYPE_USAGE + * @param msg + */ + public void log(int type, String msg) { + Date time = Calendar.getInstance().getTime(); + printLog(type, time, msg); + if (LOG_TYPE_ERROR == type) { + new Exception().printStackTrace(); + } + } + + /** + * host start log + */ + public void logHostStart() { + if (checkLevel(LOG_TYPE_HOST)) { + hostStartTime = Calendar.getInstance().getTime(); + hostStart = hostStartTime.getTime(); + printLog(LOG_TYPE_HOST, hostStartTime, "START"); + } + } + + /** + * host end log + */ + public void logHostEnd() { + if (checkLevel(LOG_TYPE_HOST)) { + log(LOG_TYPE_HOST, "END"); + } + } + + /** + * function start log, + */ + public void startFunction() { + if (checkLevel(LOG_TYPE_FUNCTION)) { + StackTraceElement[] stackTraceEelement = Thread.currentThread() + .getStackTrace(); + StringBuilder key = new StringBuilder(); + key.append(stackTraceEelement[2].getClassName()); + key.append("."); + key.append(stackTraceEelement[2].getMethodName()); + + start(LOG_TYPE_FUNCTION, key.toString()); + } + } + + public void endFunction() { + if (checkLevel(LOG_TYPE_FUNCTION)) { + StackTraceElement[] stackTraceEelement = Thread.currentThread() + .getStackTrace(); + StringBuilder key = new StringBuilder(); + key.append(stackTraceEelement[2].getClassName()); + key.append("."); + key.append(stackTraceEelement[2].getMethodName()); + + end(LOG_TYPE_FUNCTION, key.toString()); + } + } + + public void start(String key) { + if (checkLevel(LOG_TYPE_USAGE)) { + start(LOG_TYPE_USAGE, key); + } + } + + public void end(String key) { + if (checkLevel(LOG_TYPE_USAGE)) { + end(LOG_TYPE_USAGE, key); + } + } + + public void point(String key, String msg) { + if (checkLevel(LOG_TYPE_USAGE)) { + point(LOG_TYPE_USAGE, key, msg); + } + } + + public void autoTestStart(String key) { + if (checkLevel(LOG_TYPE_USAGE)) { + autoTestStart(LOG_TYPE_USAGE, key); + } + } + + public void autoTestEnd(String key) { + if (checkLevel(LOG_TYPE_USAGE)) { + autoTestEnd(LOG_TYPE_USAGE, key); + } + } + + public void autoTest(String key, String className, String name) { + if (checkLevel(LOG_TYPE_USAGE)) { + Date time = Calendar.getInstance().getTime(); + long nanoTime = System.nanoTime(); + + Long count = usageCount.get(key); + List startTimes; + long startTime; + long spendTime; + long totalCount; + long totalTime; + if (null == count || 0 == count) { + printLog(LOG_TYPE_USAGE, time, "can't find start|" + key + + "|autoTest"); + } else { + startTimes = usageTime.get(key); + // remove pre time + startTime = startTimes.remove(startTimes.size() - 1); + spendTime = nanoTime - startTime; + totalCount = usageTotalCount.get(key) + 1; + totalTime = usageTotalTime.get(key) + spendTime; + // add new time + startTimes.add(nanoTime); + usageTotalCount.put(key, totalCount); + usageTotalTime.put(key, totalTime); + + StringBuilder msg = new StringBuilder(); + msg.append("\n"); + printOutput(msg); + } + } + } + + public long getAutoTestCount(String key) { + System.out.println("count : " + usageTotalCount.get(key)); + return usageTotalCount.get(key); + } + + private void start(int logType, String key) { + if (checkLevel(logType)) { + Long count = usageCount.get(key); + List startTimes; + if (null == count) { + count = (long) 1; + usageCount.put(key, count); + startTimes = new ArrayList(); + usageTime.put(key, startTimes); + usageTotalCount.put(key, (long) 0); + usageTotalTime.put(key, (long) 0); + } else { + usageCount.put(key, count + 1); + startTimes = usageTime.get(key); + } + long nanoTime = System.nanoTime(); + Date time = Calendar.getInstance().getTime(); + startTimes.add(nanoTime); + printLog(logType, time, key + "|start"); + } + } + + private void end(int logType, String key) { + if (checkLevel(logType)) { + Date time = Calendar.getInstance().getTime(); + long nanoTime = System.nanoTime(); + + Long count = usageCount.get(key); + List startTimes; + long startTime; + long spendTime; + long totalCount; + long totalTime; + if (null == count || 0 == count) { + printLog(logType, time, "can't find start|" + key + "|end"); + } else { + startTimes = usageTime.get(key); + startTime = startTimes.remove(startTimes.size() - 1); + spendTime = nanoTime - startTime; + totalCount = usageTotalCount.get(key) + 1; + totalTime = usageTotalTime.get(key) + spendTime; + usageCount.put(key, count - 1); + usageTotalCount.put(key, totalCount); + usageTotalTime.put(key, totalTime); + + StringBuilder msg = new StringBuilder(); + msg.append("count:"); + msg.append(totalCount); + msg.append("|spend:"); + msg.append(spendTime); + msg.append("(ns)|total:"); + msg.append(totalTime); + msg.append("(ns)|"); + msg.append(key); + msg.append("|end"); + + printLog(logType, time, msg); + } + } + } + + private void autoTestStart(int logType, String key) { + if (checkLevel(logType)) { + Long count = usageCount.get(key); + List startTimes; + if (null == count) { + count = (long) 1; + usageCount.put(key, count); + startTimes = new ArrayList(); + usageTime.put(key, startTimes); + usageTotalCount.put(key, (long) 0); + usageTotalTime.put(key, (long) 0); + } else { + usageCount.put(key, count + 1); + startTimes = usageTime.get(key); + } + long nanoTime = System.nanoTime(); + startTimes.add(nanoTime); + if (printWriter == null) { + openWriter(); + } + + StringBuilder msg = new StringBuilder(); + msg.append(""); + printOutput(msg); + } + } + + private void autoTestEnd(int logType, String key) { + if (checkLevel(logType)) { + Date time = Calendar.getInstance().getTime(); + long nanoTime = System.nanoTime(); + + Long count = usageCount.get(key); + List startTimes; + long startTime; + long spendTime; + long totalCount; + long totalTime; + if (null == count || 0 == count) { + printLog(logType, time, "can't find start|" + key + "|end"); + } else { + startTimes = usageTime.get(key); + startTime = startTimes.remove(startTimes.size() - 1); + spendTime = nanoTime - startTime; + totalCount = usageTotalCount.get(key) + 1; + totalTime = usageTotalTime.get(key) + spendTime; + usageCount.put(key, count - 1); + usageTotalCount.put(key, totalCount); + usageTotalTime.put(key, totalTime); + + StringBuilder msg = new StringBuilder(); + msg.append(""); + + printOutput(msg); + closeWriter(); + } + } + } + + private void point(int logType, String key, String msg) { + if (checkLevel(logType)) { + Date time = Calendar.getInstance().getTime(); + long nanoTime = System.nanoTime(); + + Long count = usageCount.get(key); + List startTimes; + long startTime; + long spendTime; + long totalCount; + long totalTime; + if (null == count || 0 == count) { + printLog(logType, time, "can't find start|" + key + "|end"); + } else { + startTimes = usageTime.get(key); + // remove pre time + startTime = startTimes.remove(startTimes.size() - 1); + spendTime = nanoTime - startTime; + totalCount = usageTotalCount.get(key) + 1; + totalTime = usageTotalTime.get(key) + spendTime; + // add new time + startTimes.add(nanoTime); + usageTotalCount.put(key, totalCount); + usageTotalTime.put(key, totalTime); + + StringBuilder msgs = new StringBuilder(); + msgs.append("count:"); + msgs.append(totalCount); + msgs.append("|spend:"); + msgs.append(spendTime); + msgs.append("(ns)|total:"); + msgs.append(totalTime); + msgs.append("(ns)|"); + msgs.append(key); + msgs.append(msg); + msgs.append(":"); + msgs.append("|point"); + + printLog(logType, time, msgs); + } + } + } + + public boolean isStart(int logType, String key) { + if (checkLevel(logType)) { + if (usageTime.containsKey(key)) { + return true; + } else { + return false; + } + } else { + return false; + } + } + + public boolean isStart(String key) { + if (checkLevel(LOG_TYPE_USAGE)) { + return isStart(LOG_TYPE_USAGE, key); + } else { + return false; + } + } + + private void printLog(int logType, Date time, CharSequence msg) { + if (null == time) { + return; + } + long spendTime = time.getTime() - hostStart; + switch (logType) { + case LOG_TYPE_INFO: + System.out.print("||INFO||"); + break; + case LOG_TYPE_WARNING: + System.out.print("||WARNING||"); + break; + case LOG_TYPE_ERROR: + System.out.print("||ERROR||"); + break; + case LOG_TYPE_HOST: + System.out.print("||HOST||"); + break; + case LOG_TYPE_TARGET: + System.out.print("||TARGET||"); + break; + case LOG_TYPE_FUNCTION: + System.out.print("||FUNCTION||"); + break; + case LOG_TYPE_USAGE: + System.out.print("||USAGE||"); + break; + default: + System.out.print("||UNKNOWNTYPE||"); + break; + } + + System.out.println(dateFormat.format(time) + "||" + spendTime + "||" + + msg); + + } + + public void printOutput(CharSequence msg) { + if (printWriter == null) { + return; + } + printWriter.println(msg); + printWriter.checkError(); + } + + private void openWriter() { + Date time = Calendar.getInstance().getTime(); + + File autotestPath = new File(AnalyzerPaths.DYNAMIC_ANALYZER_AUTOTEST_PATH); + if(!autotestPath.exists()) { + autotestPath.mkdirs(); + } + + StringBuilder savePath = new StringBuilder(); + savePath.append(AnalyzerPaths.DYNAMIC_ANALYZER_AUTOTEST_PATH); + savePath.append(File.separator); + savePath.append("DA_Autotest_Result.xsd"); + + outputFile = new File(savePath.toString()); + + try { + fileWriter = new FileWriter(outputFile); + buffWriter = new BufferedWriter(fileWriter); + printWriter = new PrintWriter(buffWriter); + } catch (IOException e) { + e.printStackTrace(); + } + } + + private void closeWriter() { + AnalyzerUtil.tryClose(outputFile, fileWriter, buffWriter, printWriter); + outputFile = null; + fileWriter = null; + buffWriter = null; + printWriter = null; + } + + public void clear() { + + } +} -- 2.7.4