};
private void startTimer() {
- if (null != timer)
+ if (null != timer) {
stopTimer();
+ }
startTime = System.currentTimeMillis();
timer = new Timer();
}
public int computeFontSize(Rectangle rect) {
- if (rect.height > 20)
+ if (rect.height > 20) {
return 10;
- else
+ } else {
return 8;
+ }
}
protected void drawImageButton(GC gc, Rectangle rect, int state,
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.tizen.dynamicanalyzer.widgets.DAWidgetConstants;
+import org.tizen.dynamicanalyzer.widgets.helper.ColorResources;
import org.tizen.dynamicanalyzer.widgets.helper.ImageResources;
public class DARadioButton extends Canvas {
e.gc.fillRectangle(rect);
e.gc.drawImage(img, x, y);
- if (null != fgColor) {
- e.gc.setForeground(fgColor);
+ if (isEnabled()) {
+ if (null != fgColor) {
+ e.gc.setForeground(fgColor);
+ }
+ } else {
+ e.gc.setForeground(ColorResources.BAR_GRAY1);
}
int fontHeight = e.gc.getFontMetrics().getHeight();
x = imgRect.width + 4;
import org.tizen.dynamicanalyzer.widgets.helper.FontResources;
public class DAChartPlot {
+ public static enum UnitType {
+ DECIMAL, BINARY
+ };
+
private double visibleStartX = 0;
private double visibleEndX = 0;
private double visibleStartY = 0;
protected boolean hasUpdate = false;
private Font axisFont;
private String axisUnit;
+ private String secondAxisUnit;
+ private UnitType axisUnitType = UnitType.DECIMAL;
public DAChartPlot(DAChart chart) {
this.chart = chart;
public void setAxisUnit(String axisUnit) {
this.axisUnit = axisUnit;
}
+
+ public void setAxisUnitType(UnitType type) {
+ axisUnitType = type;
+ }
+
+ public UnitType getAxisUnitType() {
+ return axisUnitType;
+ }
+
+ public String getSecondAxisUnit() {
+ return secondAxisUnit;
+ }
+
+ public void setSecondAxisUnit(String secondAxisUnit) {
+ this.secondAxisUnit = secondAxisUnit;
+ }
}
package org.tizen.dynamicanalyzer.widgets.chart;
public class DAChartPlotIntervalMarker extends DAChartPlotMarker {
-
+ public final static int INTERVAL_MARKER_STYLE_LINE = 0;
+ public final static int INTERVAL_MARKER_STYLE_AREA = 1;
+ public final static int INTERVAL_MARKER_STYLE_LINE_AREA = 2;
+
private double endVal;
+ private int markerStyle = INTERVAL_MARKER_STYLE_LINE;
- public DAChartPlotIntervalMarker(double start, double end) {
+ public DAChartPlotIntervalMarker(double start, double end, int markerStyle) {
super(start);
endVal = end;
+ this.setMarkerStyle(markerStyle);
}
public void setInterval(double start, double end) {
this.endVal = endVal;
redrawRegisteredChart();
}
+
+ public int getMarkerStyle() {
+ return markerStyle;
+ }
+
+ public void setMarkerStyle(int markerStyle) {
+ this.markerStyle = markerStyle;
+ }
}
List<DAChart> charts = new ArrayList<DAChart>();
private double val;
private int alpha = (int) (255 * 0.25); // default
+ private int lineWidth = 2; // default
private Color backgroundColor;
private Color foregroundColor;
}
public Color getForegroundColor() {
- if (null == backgroundColor){
- backgroundColor = ColorResources.BLUE;
+ if (null == foregroundColor){
+ foregroundColor = ColorResources.BLUE;
}
return foregroundColor;
}
this.foregroundColor = foregroundColor;
redrawRegisteredChart();
}
+
+ public int getLineWidth() {
+ return lineWidth;
+ }
+
+ public void setLineWidth(int lineWidth) {
+ this.lineWidth = lineWidth;
+ }
}
private DAChartPlot plot = null;
private Rectangle r = null;
- // private final int SCREENSHOT_HORIZONTAL_TOP_MARGIN = 13;
private final int SCREENSHOT_Y_POSITION_MINI = 4;
private final int SCREENSHOT_SELECTED_Y_POSITION = 4;
private final int SCREENSHOT_SELECTED_Y_POSITION_MINI = 1;
- // private final int SCREENSHOT_HORIZONTAL_SELECTED_MOVE_SIZE = 19;
private final int SCREENSHOT_SELECTED_LINE_WIDTH = 2;
private final int SCREENSHOT_BORDER_LINE_WIDTH = 1;
gc.setForeground(ColorResources.CHART_AXIS);
Font axisFont = plot.getAxisFont();
- String axisUnit = plot.getAxisUnit();
+ String axisUnit;
+ if (true == bPosRight){
+ axisUnit = plot.getAxisUnit();
+ }
+ else{
+ axisUnit = plot.getSecondAxisUnit();
+ }
gc.setFont(axisFont);
- String text;
+ String text = "";
int textX;
int textHeight;
gc.drawLine(x1, 0, x1, rt.height);
gc.drawLine(x1, rt.height - 1, x2, rt.height - 1);
- text = Formatter.toByteFormatConvert(min);
+ if (plot.getAxisUnitType() == DAChartPlot.UnitType.BINARY) {
+ text = Formatter.toByteFormatConvertBinaryPrefix(min);
+ } else if (plot.getAxisUnitType() == DAChartPlot.UnitType.DECIMAL) {
+ text = Formatter.toByteFormatConvertDecimalPrefix(min);
+ }
if (null != axisUnit) {
text += axisUnit;
}
gc.drawText(text, textX, rt.height - textHeight, true);
gc.drawLine(x1, rt.height / 2, x2, rt.height / 2);
- text = Formatter.toByteFormatConvert((min + max) / 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);
+ }
if (null != axisUnit) {
text += axisUnit;
}
gc.drawText(text, textX, rt.height / 2 - textHeight / 2, true);
gc.drawLine(x1, 0, x2, 0);
- text = Formatter.toByteFormatConvert(max);
+ if (plot.getAxisUnitType() == DAChartPlot.UnitType.BINARY) {
+ text = Formatter.toByteFormatConvertBinaryPrefix(max);
+ } else if (plot.getAxisUnitType() == DAChartPlot.UnitType.DECIMAL) {
+ text = Formatter.toByteFormatConvertDecimalPrefix(max);
+ }
if (null != axisUnit) {
text += axisUnit;
}
}
int oldAlpha = gc.getAlpha();
+ Color oldBackColor = gc.getBackground();
+ Color oldForeColor = gc.getForeground();
+ int oldLineWidth = gc.getLineWidth();
int markerSize = markers.size();
DAChartPlotMarker marker;
+ int markerStyle;
int pixcelStartX;
int pixcelEndX;
for (int i = 0; i < markerSize; i++) {
marker = markers.get(i);
- pixcelStartX = plot
- .getXPixcelFromX(marker
- .getVal());
+ gc.setForeground(marker.getForegroundColor());
+ gc.setBackground(marker.getBackgroundColor());
+ gc.setAlpha(marker.getAlpha());
+
+ pixcelStartX = plot.getXPixcelFromX(marker.getVal());
+ markerStyle = DAChartPlotIntervalMarker.INTERVAL_MARKER_STYLE_AREA;
+
if (marker instanceof DAChartPlotIntervalMarker) {
pixcelEndX = plot
.getXPixcelFromX(((DAChartPlotIntervalMarker) marker)
.getEndVal());
+ markerStyle = ((DAChartPlotIntervalMarker) marker).getMarkerStyle();
+
+ if(markerStyle != DAChartPlotIntervalMarker.INTERVAL_MARKER_STYLE_LINE){
+ int width = pixcelEndX - pixcelStartX;
+ if(width <= 1){
+ width = marker.getLineWidth();
+ }
+ gc.fillRectangle(pixcelStartX, 0, width,
+ r.height);
+ }
+ if(markerStyle != DAChartPlotIntervalMarker.INTERVAL_MARKER_STYLE_AREA){
+ gc.drawLine(pixcelStartX, r.y, pixcelStartX, r.height);
+ gc.drawLine(pixcelEndX, r.y, pixcelEndX, r.height);
+ }
} else {
- pixcelEndX = pixcelStartX;
- }
-
- Color color = marker.getBackgroundColor();
-
- gc.setAlpha(marker.getAlpha());
- if (pixcelStartX == pixcelEndX) {
- gc.setForeground(color);
- gc.setLineWidth(2);
+ gc.setLineWidth(marker.getLineWidth());
gc.drawLine(pixcelStartX, r.y, pixcelStartX, r.height);
- } else {
- gc.setBackground(color);
- gc.fillRectangle(pixcelStartX, 0, pixcelEndX - pixcelStartX,
- r.height);
}
-
}
gc.setAlpha(oldAlpha);
+ gc.setBackground(oldBackColor);
+ gc.setForeground(oldForeColor);
+ gc.setLineWidth(oldLineWidth);
}
private int getTooltipStartX(double startVal, int width, int margin) {
gc.setBackground(color);
gc.setAlpha((int) (255 * 0.8));
gc.setAntialias(SWT.ON);
+
+ int barAlign = series.getBarAlign();
int index = series.getPrevIndexByXvalue(plot.getVisibleStartX());
if (index < 0) {
if (barWidth < 1) {
barWidth = 1;
}
+
+ if(barAlign == DAChartSeries.SERIES_BAR_ALIGN_CENTER){
+ pixcelStartX -= barWidth/2;
+ } else if(barAlign == DAChartSeries.SERIES_BAR_ALIGN_RIGHT){
+ pixcelStartX -= barWidth;
+ }
color = seriesItem.getEventColor();
if (null != color) {
gc.fillRectangle(pixcelStartX,
(r.y + r.height) - barHeight * 2, width, barHeight);
}
- if (pixcelStartX > plot.getVisibleEndX()) {
+ if (currentStartX > plot.getVisibleEndX()) {
break;
}
}
public static final int SERIES_STYLE_LAST_CONTINUE_STEP = 14;
public static final double SERIES_DEFAULT_BAR_WIDTH = 0.5;
+ public static final int SERIES_BAR_ALIGN_LEFT = 0;
+ public static final int SERIES_BAR_ALIGN_CENTER = 1;
+ public static final int SERIES_BAR_ALIGN_RIGHT = 2;
private String name;
private int style = SERIES_STYLE_NONE;
private List<DAChartSeriesItem> seriesItems = new ArrayList<DAChartSeriesItem>();
private Color seriesColor;
private double barWidth = SERIES_DEFAULT_BAR_WIDTH;
+ private int barAlign = SERIES_BAR_ALIGN_LEFT;
private double maxX = 0;
private double maxY = 0;
private double endX = 0;
public void setSummarizeString(String summarizeString) {
this.summarizeString = summarizeString;
}
+
+ public int getBarAlign() {
+ return barAlign;
+ }
+
+ public void setBarAlign(int barAlign) {
+ this.barAlign = barAlign;
+ }
}
.addClickListener(new DACustomButtonClickEventListener() {
@Override
public void handleClickEvent(DACustomButton button) {
+
+ // long startTime = System.currentTimeMillis();
boolean bZoomout = chartZoomButton.isToggled();
zoomoutItem(bZoomout);
+
+ // long endTime = System.currentTimeMillis();
+ // System.out.println("board end : "
+ // + (endTime - startTime));
}
});
itemRatio = DEFAULT_EXPAND_MEDIUM;
}
- itemListHeight = itemList.callbackZoom(itemRatio);
+ itemListHeight = itemList.callbackZoom(itemRatio, false);
+ itemList.layout();
itemList.setSize(0, itemListHeight);
-
itemListScrollComp.redraw();
}
+ protected void zoomoutFoldItem() {
+ itemList.zoomoutFoldItem();
+ itemList.layout();
+ }
+
public boolean isZoomout() {
if (null == chartZoomButton) {
return false;
} else {
itemListHeight = height;
}
-
+ itemList.layout();
itemList.setSize(0, itemListHeight);
}
}
itemChildListHeight = height;
- FormData data = (FormData) childList.getLayoutData();
- data.height = itemChildListHeight;
- childList.setLayoutData(data);
- this.layout();
+ FormData childDListata = (FormData) childList.getLayoutData();
+ childDListata.height = itemChildListHeight;
+ childList.setLayoutData(childDListata);
callNotifyResizeChild();
}
- private int expandItem() {
+ protected int expandItem(boolean isFold) {
itemCellHeight = (int) (expandRatio * DEFAULT_ITEM_HEIGHT);
+ if (isFold == false) {
+ FormData data = (FormData) itemCell.getLayoutData();
+ data.height = itemCellHeight;
+ itemCell.setLayoutData(data);
+ }
+
+ return itemCellHeight;
+ }
+
+ protected void expandFoldItem() {
FormData data = (FormData) itemCell.getLayoutData();
data.height = itemCellHeight;
itemCell.setLayoutData(data);
- this.layout();
- return itemCellHeight;
}
protected void registeItem(DAChartBoardItem child) {
int chartListHeight = childList.registeItem(child);
itemChildListHeight = chartListHeight;
- FormData data = (FormData) childList.getLayoutData();
- data.height = itemChildListHeight;
- childList.setLayoutData(data);
- this.layout();
+ FormData childDListata = (FormData) childList.getLayoutData();
+ childDListata.height = itemChildListHeight;
+ childList.setLayoutData(childDListata);
+
callNotifyResizeChild();
}
if (isFold == bFold) {
return;
}
+
+ zoomoutFoldItem();
+
isFold = bFold;
childList.setFold(isFold);
- FormData data = (FormData) childList.getLayoutData();
+ FormData childDListata = (FormData) childList.getLayoutData();
if (false == isFold) {
- data.height = itemChildListHeight;
+ childDListata.height = itemChildListHeight;
} else {
- data.height = 0;
+ childDListata.height = 0;
}
- childList.setLayoutData(data);
+ childList.setLayoutData(childDListata);
- this.layout();
callNotifyResizeChild();
}
} else {
expandRatio = normalRatio;
}
- expandItem();
+ expandItem(false);
callNotifyResizeChild();
}
- protected int callbackZoom(double zoomRatio) {
+ protected int callbackZoom(double zoomRatio, boolean isFold) {
normalRatio = zoomRatio;
expandRatio = normalRatio;
if (null != childList) {
- itemChildListHeight = childList.callbackZoom(zoomRatio);
- FormData data = (FormData) childList.getLayoutData();
- data.height = itemChildListHeight;
- childList.setLayoutData(data);
- this.layout();
+ itemChildListHeight = childList
+ .callbackZoom(zoomRatio, this.isFold);
+ if (this.isFold == false) {
+ FormData childDListata = (FormData) childList.getLayoutData();
+ childDListata.height = itemChildListHeight;
+ childList.setLayoutData(childDListata);
+ }
}
itemCell.setExpandButtonNormal();
- itemCellHeight = expandItem();
+ itemCellHeight = expandItem(isFold);
+
+ return getItemHeight();
+ }
+
+ protected int zoomoutFoldItem() {
+ final int height;
+ if (null != childList) {
+ height = childList.zoomoutFoldItem();
+ if (this.isFold == true) {
+ FormData childDListata = (FormData) childList.getLayoutData();
+ childDListata.height = height;
+ childList.setLayoutData(childDListata);
+ }
+ }
+
+ expandFoldItem();
return getItemHeight();
}
if (null == childList) {
childList = new DAChartBoardItemList(this);
childList.setLayout(new FormLayout());
- FormData data = new FormData();
- data.left = new FormAttachment(0, 0);
- data.top = new FormAttachment(itemCell, 0);
- data.right = new FormAttachment(100, 0);
- data.height = 0;
- childList.setLayoutData(data);
+ FormData childDListata = new FormData();
+ childDListata.left = new FormAttachment(0, 0);
+ childDListata.top = new FormAttachment(itemCell, 0);
+ childDListata.right = new FormAttachment(100, 0);
+ childDListata.height = 0;
+ childList.setLayoutData(childDListata);
childList.setFold(true);
childList.setItemRatio(normalRatio);
this.layout();
} else {
this.isHide = isHide;
if (false == isHide) {
- // itemCellHeight = (int) (expandRatio * DEFAULT_ITEM_HEIGHT);
+ itemCellHeight = (int) (expandRatio * DEFAULT_ITEM_HEIGHT);
FormData data = (FormData) itemCell.getLayoutData();
data.height = getItemHeight();
itemCell.setLayoutData(data);
FormData data = (FormData) child.getLayoutData();
data.height = itemHeight;
child.setLayoutData(data);
- this.layout();
}
}
+
if (this.listHeight != listHeight) {
this.listHeight = listHeight;
return this.listHeight;
return items.size();
}
- protected int callbackZoom(double zoomRatio) {
+ protected int callbackZoom(double zoomRatio, boolean isFold) {
itemRatio = zoomRatio;
if (null == items) {
return 0;
DAChartBoardItem item;
int itemHeight;
listHeight = 0;
+
for (int i = 0; i < itemsSize; i++) {
item = items.get(i);
- itemHeight = item.callbackZoom(zoomRatio);
- FormData data = (FormData) item.getLayoutData();
- data.height = itemHeight;
- item.setLayoutData(data);
- this.layout();
+ itemHeight = item.callbackZoom(zoomRatio, isFold);
+
+ if (isFold == false) {
+ FormData data = (FormData) item.getLayoutData();
+ data.height = itemHeight;
+ item.setLayoutData(data);
+ }
listHeight += itemHeight;
}
+ return listHeight;
+ }
+
+ protected int zoomoutFoldItem() {
+ int itemsSize = items.size();
+ for (int i = 0; i < itemsSize; i++) {
+ final DAChartBoardItem item = items.get(i);
+ final int height = item.zoomoutFoldItem();
+ if (isFold == true) {
+ FormData data = (FormData) item.getLayoutData();
+ data.height = height;
+ item.setLayoutData(data);
+ }
+ }
return listHeight;
}
import org.tizen.dynamicanalyzer.widgets.timeline.DATimelineRenderer;
-class DAChartBoardManager {
+public class DAChartBoardManager {
public final static int SCALE_100 = 1;
public final static int SCALE_400 = 4;
public final static int SCALE_800 = 8;
visibleStartTime = (double) sel / 1000.0;
board.notifyScrollChanged(visibleStartTime);
}
-
- public void startTimeChanged(double time){
- if (time+thumb > totalEndTime){
- time = totalEndTime - thumb;
+
+ public void startTimeChanged(double time) {
+ if (time + thumb > totalEndTime) {
+ time = totalEndTime - thumb;
}
- if(time < 0){
+ if (time < 0) {
time = 0;
}
visibleStartTime = time;
board.notifyVisibleStartTimeChanged(visibleStartTime);
}
-
+
public void middleTimeChanged(double middleTime) {
double startTime = middleTime - thumb / 2;
startTimeChanged(startTime);
int visibleEnd = (int) (visibleStartTime * 1000) + (int) (thumb * 1000);
int realEnd = (int) (this.totalEndTime * 1000);
int distance = realEnd - visibleEnd;
- if (distance > -1000 && distance < 1000) { //Tolerances
+ if (distance > -1000 && distance < 1000) { // Tolerances
visibleStartTime = totalEndTime - thumb;
- if(visibleStartTime < 0){
+ if (visibleStartTime < 0) {
visibleStartTime = 0;
}
board.setScrollSelection((int) (visibleStartTime * 1000));
import org.eclipse.swt.events.PaintEvent;
import org.eclipse.swt.events.PaintListener;
import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
public static final int STATE_PUSH = 2;
public static final int STATE_DISABLE = 3;
+ public static final int TEXT_ALIGN_CENTER = 0;
+ public static final int TEXT_ALIGN_LEFT = 1;
+ public static final int TEXT_ALIGN_RIGHT = 2;
+
private static final int pageSize = 5;
Composite parent;
private List<Color> arrowColors = null;
private List<Image> arrowImages = null;
+ private int titleAlign = TEXT_ALIGN_LEFT;
+ private Font font;
public DACustomCombo(Composite parent, int style) {
super(parent, style);
popup.setLayoutData(data);
}
- size = (size > MAX_SIZE) ? MAX_SIZE : size;
getRects().clear();
- for (int i = 0; i < size; i++) {
+ System.out.println("rects clear and add new rects. count is :"
+ + boundSize);
+ for (int i = 0; i < boundSize; i++) {
Rectangle r = new Rectangle(2, 2 + i * height, shellWidth - 2,
height);
getRects().add(r);
itemIndex = size - MAX_SIZE;
select(selection);
} else {
- selection = index - itemIndex;
+ if (index >= MAX_SIZE) {
+ itemIndex = index / MAX_SIZE;
+ itemIndex *= MAX_SIZE;
+ index %= MAX_SIZE;
+ } else if (index < 0) {
+ System.out.println("Combo indexing bug!");
+ return false;
+ }
+ selection = index;
select(selection);
}
return true;
if (event.type == SWT.MouseWheel) {
int size = getItems().size();
- if (null != downArrowButton && null != upArrowButton) {
+ if (null != downArrowButton && !downArrowButton.isDisposed()
+ && null != upArrowButton && !upArrowButton.isDisposed()) {
if (event.count < 0) {
if (tmpItemIndex - event.count + MAX_SIZE >= size - 1) {
tmpItemIndex = size - MAX_SIZE;
if (isImageCombo()) {
setBackgroundImage(images.get(STATE_DISABLE));
}
+
+ Display.getDefault().syncExec(new Runnable() {
+ @Override
+ public void run() {
+ if (null != childShell && !childShell.isDisposed()) {
+ childShell.close();
+ childShell = null;
+ }
+ }
+ });
}
}
@Override
public void paintControl(PaintEvent e) {
if (!isImageCombo()) {
- comboRenderer.draw(e.gc, combo, text, state);
+ comboRenderer.draw(e.gc, combo, text, titleAlign, font, state);
} else {
comboRenderer.drawImage(e.gc, combo, images.get(state), text,
- state);
+ titleAlign, font, state);
}
}
};
selection = 0;
items.add(DAWidgetConstants.EMPTY_STRING);
dirty = false;
+ itemIndex = 0;
}
public void setComboButtonColor(Color normal, Color push, Color hover,
}
}, interval, interval);
}
+
+ public void setTextAlign(int align) {
+ this.titleAlign = align;
+ }
+
+ public void setFont(Font font) {
+ this.font = font;
+ }
}
package org.tizen.dynamicanalyzer.widgets.combo;
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.widgets.Canvas;
import org.tizen.dynamicanalyzer.widgets.helper.ColorResources;
-
public class DACustomComboDefaultRenderer extends DACustomComboRenderer {
@Override
- public void draw(GC gc, Canvas canvas, String text, int state) {
+ public void draw(GC gc, Canvas canvas, String text, int textAlign, Font font, int state) {
Rectangle rect = canvas.getClientArea();
if (state == DACustomCombo.STATE_NORMAL) {
gc.setBackground(ColorResources.WINDOW_BG_COLOR);
} else if (state == DACustomCombo.STATE_DISABLE) {
gc.setBackground(ColorResources.BAR_GRAY1);
}
+
gc.fillRectangle(rect);
gc.drawRectangle(rect.x, rect.y, rect.width - 20, rect.height - 1);
text = ""; //$NON-NLS-1$
}
Point p = gc.textExtent(text, SWT.DRAW_MNEMONIC);
- gc.drawString(text, 5, (rect.height - p.y)/2, true);
+ int textX = 0;
+ if (textAlign == DACustomCombo.TEXT_ALIGN_LEFT) {
+ textX = 5;
+ } else if (textAlign == DACustomCombo.TEXT_ALIGN_RIGHT) {
+ textX = rect.width - p.x;
+ } else {
+ textX = (rect.width / 2) - (p.x / 2);
+ }
+ gc.drawString(text, textX, (rect.height - p.y) / 2, true);
gc.fillRectangle(rect.x + rect.width - 20, rect.y, 19, rect.height - 1);
gc.drawRectangle(rect.x + rect.width - 20, rect.y, 19, rect.height - 1);
}
@Override
public void drawPattern(GC gc, Canvas canvas, Image patternImage,
String text, int state) {
-
}
@Override
public void drawImage(GC gc, Canvas canvas, Image image, String text,
- int state) {
+ int textAlign, Font font, int state) {
}
* Jooyoul Lee <jy.exe.lee@samsung.com>
* Juyoung Kim <j0.kim@samsung.com>
*
- * Licensed under the Apache License, Version 2.0 (the "License");
+ * 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
*
package org.tizen.dynamicanalyzer.widgets.combo;
+import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Canvas;
public abstract class DACustomComboRenderer {
- public abstract void draw(GC gc, Canvas canvas, String text, int state);
- public abstract void drawPattern(GC gc, Canvas canvas, Image patternImage, String text, int state);
- public abstract void drawImage(GC gc, Canvas canvas, Image image, String text, int state);
+ public abstract void draw(GC gc, Canvas canvas, String text, int textAlign,
+ Font font, int state);
+
+ public abstract void drawPattern(GC gc, Canvas canvas, Image patternImage,
+ String text, int state);
+
+ public abstract void drawImage(GC gc, Canvas canvas, Image image,
+ String text, int textAlign, Font font, int state);
}
+++ /dev/null
-/*
- * Dynamic Analyzer
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * HyunJong Park <phjwithyou.park@samsung.com>
- * Juyoung Kim <j0.kim@samsung.com>
- *
- * 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.contextMenu;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Timer;
-import java.util.TimerTask;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.PaintEvent;
-import org.eclipse.swt.events.PaintListener;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.layout.FillLayout;
-import org.eclipse.swt.layout.FormAttachment;
-import org.eclipse.swt.layout.FormData;
-import org.eclipse.swt.layout.FormLayout;
-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.eclipse.swt.widgets.Shell;
-import org.tizen.dynamicanalyzer.widgets.helper.ColorResources;
-
-/**
- * Newly implemented contextMenuItem class
- *
- * @author ParkHyunJong
- *
- */
-public class DAContextMenu {
-
- public static final int STATE_NORMAL = 0;
- public static final int STATE_PUSH = 1;
- public static final int STATE_HOVER = 2;
- public static final int STATE_DISABLE = 3;
-
- private final int DEFAULT_HEIGHT = 24;
- private final int CHARACTER_WIDTH_PIXEL = 7;
- private final int STORKE_PIXEL = 2;
- private final int STAUES_ITEMS_CHECK_TIME = 200;
- private final int ADJUSTED_CONTEXT_MENU_POINT = 5;
-
- public static final int MOUSE_LEFT = 1;
- public static final int MOUSE_RIGHT = 3;
- private Shell menuShell = null;
- private Shell parentShell = null;
- private Composite menuComp = null;
- private Composite parentComp = null;
- private Rectangle parentArea = null;
- private Timer checkEableTimer = null;
- private List<DAContextMenuItem> itemList = null;
-
- /**
- * create contextMenu Shell and Composite, add mouse listeners - mouse down.<br>
- */
- private void setDefaultSetting() {
- if (null != menuShell) {
- return;
- }
- menuShell = new Shell(parentShell, SWT.NO_TRIM);
- menuShell.setLayout(new FillLayout());
- menuComp = new Composite(menuShell, SWT.NONE);
- menuComp.addPaintListener(new PaintListener() {
-
- @Override
- public void paintControl(PaintEvent e) {
- // TODO Auto-generated method stub
- e.gc.setForeground(ColorResources.CONTEXT_MENU_STORKE_IN);
- e.gc.drawRectangle(menuComp.getBounds().x + STORKE_PIXEL - 1,
- menuComp.getBounds().y + STORKE_PIXEL - 1,
- menuComp.getBounds().width - 3,
- menuComp.getBounds().height - 3);
- }
- });
-
- menuComp.setLayout(new FormLayout());
- menuComp.setBackground(ColorResources.CONTEXT_MENU_STORKE_OUT);
-
- FormData compData = new FormData();
- compData.top = new FormAttachment(0, 0);
- compData.left = new FormAttachment(0, 0);
- compData.right = new FormAttachment(100, 0);
- compData.bottom = new FormAttachment(100, 0);
- menuComp.setLayoutData(compData);
-
- parentComp.addListener(SWT.MouseUp, parentMouseListener);
- }
-
- /**
- * Construct a new instance of this class.<br>
- *
- * @param parent
- * a composite control which will be the parent of the new
- * instance (cannot be bull)
- */
- public DAContextMenu(Composite parent) {
- parentComp = parent;
- parentShell = parent.getShell();
- setDefaultSetting();
- }
-
- /**
- * Get contextMenu Shell.<br>
- *
- * @return contextMenu Shell
- */
- public Shell getShell() {
- return menuShell;
- }
-
- /**
- * Get contextMenu composite.<br>
- *
- * @return contextMenu composite
- */
- public Composite getComposite() {
- return this.menuComp;
- }
-
- /**
- * implementation parent mouse listeners event.<br>
- */
- private Listener parentMouseListener = new Listener() {
- @Override
- public void handleEvent(Event event) {
- if (event.type == SWT.MouseUp) {
- switch (event.button) {
- case MOUSE_LEFT: {
-
- disappearContextMenu();
- break;
- }
- case MOUSE_RIGHT: {
- if (null != parentArea) {
- if (event.x > parentArea.x && event.y > parentArea.y
- && event.x < parentArea.x + parentArea.width
- && event.y < parentArea.y + parentArea.height) {
- open();
- }
- } else {
- open();
- }
- break;
- }
- default: {
- break;
- }
- }
- }
- }
- };
-
- /**
- * implementation item mouse listeners event.<br>
- */
- protected Listener itemMouseListener = new Listener() {
- @Override
- public void handleEvent(Event event) {
-
- DAContextMenuItem itme = (DAContextMenuItem) event.widget;
- if (event.type == SWT.MouseUp) {
- switch (event.button) {
- case MOUSE_LEFT: {
- if (itme.getState() != STATE_DISABLE) {
- disappearContextMenu();
- }
- break;
- }
- default: {
- break;
- }
- }
- }
- }
- };
-
- /**
- * disappear contextMenu
- */
- public void disappearContextMenu() {
- menuShell.setVisible(false);
- }
-
- /**
- * Appear contextMenu when click mouse leftButton.<br>
- *
- * @param x
- * The value of x of the right mouse button to click
- * @param y
- * The value of y of the right mouse button to click
- */
- public void open(int x, int y) {
- if (null == menuShell) {
- setDefaultSetting();
- }
- if (getItems() == null) {
- menuShell.setSize(CHARACTER_WIDTH_PIXEL, DEFAULT_HEIGHT);
- } else {
- menuShell.setSize(itemLongestTextLenght() * CHARACTER_WIDTH_PIXEL,
- DEFAULT_HEIGHT * getItems().size() + STORKE_PIXEL * 2);
- }
- menuShell.setLocation(x, y);
- menuShell.setVisible(true);
-
- if (checkEableTimer != null) {
- checkEableTimer.cancel();
- checkEableTimer = null;
- }
- disposeContextMenu(STAUES_ITEMS_CHECK_TIME);
- }
-
- /**
- * Get the coordinates of the mouse click.<br>
- *
- * @return Point object of coordinates of the mouse click
- */
- private Point computeContextMenuLocation() {
- Display display = Display.getCurrent();
- if (null == display) {
- display = Display.getDefault();
- }
- Point pt = Display.getCurrent().getCursorLocation();
- return pt;
- }
-
- /**
- * Show the ContextMenu when click the right button.<br>
- */
- public void open() {
- Point pt = computeContextMenuLocation();
- pt.x = pt.x -= ADJUSTED_CONTEXT_MENU_POINT;
- pt.y = pt.y -= ADJUSTED_CONTEXT_MENU_POINT;
- open(pt.x, pt.y);
- }
-
- /**
- * Periodically check the focus has been on the context Menu.<br>
- *
- * @param milliseconds
- * Set the time to check regularly.
- */
- public void disposeContextMenu(int milliseconds) {
- this.checkEableTimer = new Timer();
- this.checkEableTimer.schedule(new TimerTask() {
- public void run() {
- Display.getDefault().syncExec(new Runnable() {
- @Override
- public void run() {
- Rectangle rt = menuShell.getBounds();
- Point pt = Display.getCurrent().getCursorLocation();
- if (false == rt.contains(pt)) {
- if (checkEableTimer != null) {
- checkEableTimer.cancel();
- checkEableTimer = null;
- }
- disappearContextMenu();
- }
- }
- });
- }
- }, 200, milliseconds);
- }
-
- /**
- * Register the DAContextMenuItem to the contextMenu.<br>
- *
- * @param item
- * contextMenu item object
- */
- public void addItem(DAContextMenuItem item) {
- if (itemList == null) {
- itemList = new ArrayList<DAContextMenuItem>();
- }
- FormData compData = new FormData();
- if (getItems() == null) {
- compData.top = new FormAttachment(0, STORKE_PIXEL);
- } else {
- compData.top = new FormAttachment(0, DEFAULT_HEIGHT
- * getItems().size() + STORKE_PIXEL);
- }
- compData.left = new FormAttachment(0, STORKE_PIXEL);
- compData.right = new FormAttachment(100, -STORKE_PIXEL);
- compData.height = DEFAULT_HEIGHT;
- item.setLayoutData(compData);
-
- itemList.add(item);
- item.addListener(SWT.MouseUp, itemMouseListener);
- }
-
- /**
- * Get the DAContextMenuItem.<br>
- *
- * @return contextMenu items list
- */
- public List<DAContextMenuItem> getItems() {
- return itemList;
- }
-
- /**
- * get The text length of the longest item
- *
- * @return text length
- */
- public int itemLongestTextLenght() {
- int lenght = 0;
- if (getItems() == null) {
- return lenght;
- }
- for (DAContextMenuItem item : getItems()) {
- if (lenght < item.getText().length()) {
- lenght = item.getText().length();
- }
- }
- return lenght;
- }
-
- /**
- * set parent area
- *
- * @param area
- * parent area
- */
- public void setParentArea(Rectangle area) {
- parentArea = area;
- }
-}
return value;
}
- public static String toByteFormatConvert(double input){
- char[] c = new char[]{'K', 'M', 'G', 'T'};
+ public static String toByteFormatConvertDecimalPrefix(double input){
+ String[] units = new String[]{"K", "M", "G", "T"};
+ long k = 1000;
+ String unit = "";
+ long quotient = (long)input;
+ long remainder = ((long)(input*(double)k)) % k;
+ String ret;
+
+ long n = k;
+ for(int i=0; i<units.length; i++){
+ if(input < n){
+ break;
+ }
+ remainder = quotient % k;
+ quotient /= k;
+ unit = units[i];
+ n *= k;
+ }
+ if(0 == remainder || unit.equals("")){
+ ret = String.format("%d",quotient);
+ }
+ else{
+ remainder /= 100;
+ remainder = Math.round(remainder);
+ ret = String.format("%d.%d%s", quotient,remainder,unit);
+ }
+ return ret;
+ }
+
+ public static String toByteFormatConvertBinaryPrefix(double input){
+ String[] units = new String[]{"Ki", "Mi", "Gi", "Ti"};
long k = 1024;
- char unit = ' ';
+ String unit = "";
long quotient = (long)input;
long remainder = ((long)(input*(double)k)) % k;
String ret;
long n = k;
- for(int i=0; i<c.length; i++){
+ for(int i=0; i<units.length; i++){
if(input < n){
break;
}
remainder = quotient % k;
quotient /= k;
- unit = c[i];
+ unit = units[i];
n *= k;
}
- if(0 == remainder || unit == ' '){
+ if(0 == remainder || unit.equals("")){
ret = String.format("%d",quotient);
}
else{
- ret = String.format("%d.%d%c", quotient,remainder,unit);
+ remainder /= 100;
+ remainder = Math.round(remainder);
+ ret = String.format("%d.%d%s", quotient,remainder,unit);
+ ret = String.format("%d.%d%s", quotient,remainder,unit);
}
return ret;
}
public static final Image STOP_PROGRESS_LOADING_07 = getPngImage("loading_icon_07"); //$NON-NLS-1$
public static final Image STOP_PROGRESS_LOADING_08 = getPngImage("loading_icon_08"); //$NON-NLS-1$
+ // ui event dialog
+ public static final Image UIEVENT_DIALOG_START_NORMAL = getPngImage("event_list_start_normal"); //$NON-NLS-1$
+ public static final Image UIEVENT_DIALOG_START_HOVER = getPngImage("event_list_start_hover"); //$NON-NLS-1$
+ public static final Image UIEVENT_DIALOG_START_SELECTED_NORMAL = getPngImage("event_list_start_selected_normal"); //$NON-NLS-1$
+ public static final Image UIEVENT_DIALOG_START_SELECTED_HOVER = getPngImage("event_list_start_selected_hover"); //$NON-NLS-1$
+ public static final Image UIEVENT_DIALOG_END_NORMAL = getPngImage("event_list_end_normal"); //$NON-NLS-1$
+ public static final Image UIEVENT_DIALOG_END_HOVER = getPngImage("event_list_end_hover"); //$NON-NLS-1$
+ public static final Image UIEVENT_DIALOG_END_SELECTED_NORMAL = getPngImage("event_list_end_selected_normal"); //$NON-NLS-1$
+ public static final Image UIEVENT_DIALOG_END_SELECTED_HOVER = getPngImage("event_list_end_selected_hover"); //$NON-NLS-1$
+
private static Image getImage(String folderName, String imageName,
String extension) {
// if (null == imageRegistry.get(imageName)
private double visibleStartTime = 0;
private double totalEndTime = 0;
private int scale = DATimeline.SCALE_100;
- private List<LifecycleData> lifecycleDataList = new ArrayList<LifecycleData>();
+ private ArrayList<LifecycleData> lifecycleDataList = new ArrayList<LifecycleData>();
private PaintListener paintListener = new PaintListener() {
@Override
public void paintControl(PaintEvent e) {
- for (LifecycleData lifecycleData : lifecycleDataList) {
+ @SuppressWarnings("unchecked")
+ List<LifecycleData> cloneList = (List<LifecycleData>) lifecycleDataList
+ .clone();
+
+ for (LifecycleData lifecycleData : cloneList) {
double startTime = lifecycleData.getStartTime();
int startPx = (int) secondToPixcel(startTime);
double endTime = lifecycleData.getEndTime();
ImageResources.VIEW_SOURCE, ImageResources.VIEW_SOURCE_PUSH,
ImageResources.VIEW_SOURCE_HOVER,
ImageResources.VIEW_SOURCE_DISABLE,
- ImageResources.VIEW_SOURCE_TOGGLE,
+ ImageResources.VIEW_SOURCE_TOGGLE,
ImageResources.VIEW_SOURCE_HOVER);
imgToggle.setText("toggle");
data = new FormData();
scale.setMaximum(10);
scale.setMinimum(5);
scale.addSelectionListener(new DAScaleSelectionListener() {
-
+
@Override
public void widgetSelected() {
System.out.println("test selection listener");
-
+
}
});
-
DACustomComboSelectionListener comboSelectionListener = new DACustomComboSelectionListener() {
@Override
combo.addSelectionListener(comboSelectionListener);
while (!shell.isDisposed()) {
- if (!display.readAndDispatch())
+ if (!display.readAndDispatch()) {
display.sleep();
+ }
}
clock.stop();
display.dispose();
+++ /dev/null
-/*
- * Dynamic Analyzer
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * yeongtaik byeon <yeongtaik.byeon@samsung.com>
- * Juyoung Kim <j0.kim@samsung.com>
- *
- * 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 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.eclipse.swt.events.PaintEvent;
-import org.eclipse.swt.events.PaintListener;
-import org.eclipse.swt.widgets.Canvas;
-import org.eclipse.swt.widgets.Composite;
-import org.tizen.dynamicanalyzer.widgets.helper.ImageResources;
-
-public class DACustomTimeline extends Canvas {
- public final static int SCALE_100 = 1;
- public final static int SCALE_400 = 4;
- public final static int SCALE_800 = 8;
- private double startTime = 0;
- private int scale = SCALE_100;
-
- List<Double> stickyTimeList = new ArrayList<Double>();
- private double totalEndTime = 0;
-
- private boolean drawDetailedTime = false;
- private double detailedTime;
- private int detailedTimePosition;
-
- private DACustomTimelineRenderer timelineRenderer = new DACustomTimelineRenderer();
- private DACustomTimelineRangeMarker startRangeMarker = new DACustomTimelineRangeMarker(
- ImageResources.RANGE_MARKER_START,
- ImageResources.RANGE_MARKER_START_PUSH);
- private DACustomTimelineRangeMarker endRangeMarker = new DACustomTimelineRangeMarker(
- ImageResources.RANGE_MARKER_END,
- ImageResources.RANGE_MARKER_END_PUSH);
-
- public DACustomTimeline(Composite parent) {
- super(parent, SWT.NONE);
- this.addPaintListener(chartPaintListener);
- this.addMouseListener(new RangeMarkerMouseEventListener());
- this.addMouseMoveListener(new RangeMarkerMouseMoveEventListener());
- }
-
- public double getStartTime() {
- return startTime;
- }
-
- public void setStartTime(double startTime) {
- this.startTime = startTime;
- }
-
- public int getScale() {
- return scale;
- }
-
- public void setScale(int scale) {
- this.scale = scale;
- }
-
- public DACustomTimelineRangeMarker getStartRangeMarker() {
- return startRangeMarker;
- }
-
- public DACustomTimelineRangeMarker getEndRangeMarker() {
- return endRangeMarker;
- }
-
- private PaintListener chartPaintListener = new PaintListener() {
- @Override
- public void paintControl(PaintEvent e) {
- timelineRenderer.draw(e.gc, (DACustomTimeline) e.widget);
- }
- };
-
- public void setDrawDetailedTime(boolean draw) {
- drawDetailedTime = draw;
- }
-
- public boolean getDrawDetailedTime() {
- return drawDetailedTime;
- }
-
- public void setDetailedTime(double detailedTime) {
- this.detailedTime = detailedTime;
- }
-
- public double getDetailedTime() {
- return detailedTime;
- }
-
- public void setDetailedTimePosition(int position) {
- this.detailedTimePosition = position;
- }
-
- public int getDetailedTimePosition() {
- return detailedTimePosition;
- }
-
- private double secondToPixcel(double second) {
- return (second - startTime) * scale
- * DACustomTimelineRenderer.DEFAULT_INTERVAL;
- }
-
- private double pixcelToSecond(int pixcel) {
- return (double) pixcel / scale
- / DACustomTimelineRenderer.DEFAULT_INTERVAL + startTime;
- }
-
- public void setTotalEndTime(double time) {
- totalEndTime = time;
- }
-
- public void addStickyTime(double time) {
- stickyTimeList.add(time);
- }
-
- public void clear() {
- setStartTime(0);
- stickyTimeList.clear();
- }
-
- private class RangeMarkerMouseEventListener extends MouseAdapter {
- public void mouseDown(MouseEvent e) {
- double startMarkerPosition = secondToPixcel(startRangeMarker
- .getTime());
- double endMarkerPosition = secondToPixcel(endRangeMarker.getTime());
-
- if (e.x >= endMarkerPosition
- - endRangeMarker.getImage().getBounds().width
- && e.x <= endMarkerPosition) {
- endRangeMarker.setPushStatus(true);
- DACustomTimeline.this.redraw();
- } else if (e.x >= startMarkerPosition
- && e.x <= startMarkerPosition
- + startRangeMarker.getImage().getBounds().width) {
- startRangeMarker.setPushStatus(true);
- DACustomTimeline.this.redraw();
- }
- }
-
- public void mouseUp(MouseEvent e) {
- if (startRangeMarker.isPushed()) {
- startRangeMarker.setPushStatus(false);
- if (startRangeMarker.getTime() > endRangeMarker.getTime()) {
- endRangeMarker.setTime(-1);
- }
- DACustomTimeline.this.redraw();
- } else if (endRangeMarker.isPushed()) {
- endRangeMarker.setPushStatus(false);
- if (endRangeMarker.getTime() < startRangeMarker.getTime()) {
- startRangeMarker.setTime(-1);
- }
- DACustomTimeline.this.redraw();
- }
- }
- }
-
- private class RangeMarkerMouseMoveEventListener implements
- MouseMoveListener {
- public void mouseMove(MouseEvent e) {
- double stickyTime;
-
- if (stickyTimeList.size() == 0) {
- stickyTime = 0;
- } else if (stickyTimeList.size() == 1) {
- stickyTime = stickyTimeList.get(0);
- } else {
- double eTime = pixcelToSecond(e.x);
- double minGapTime = stickyTimeList.get(0);
-
- for (int i = 1; i < stickyTimeList.size(); i++) {
- if (Math.abs(eTime - minGapTime) > Math.abs(eTime
- - stickyTimeList.get(i))) {
- minGapTime = stickyTimeList.get(i);
- }
- }
-
- if (Math.abs(eTime - minGapTime) > Math.abs(eTime
- - totalEndTime)) {
- minGapTime = totalEndTime;
- }
-
- stickyTime = minGapTime;
- }
-
- int timePixcel = (int) secondToPixcel(stickyTime);
-
- if (e.x - timePixcel < 5 && e.x - timePixcel > -5) {
- e.x = timePixcel;
- }
-
- if (startRangeMarker.isPushed()) {
- if (e.x < 0) {
- e.x = 0;
- } else if (e.x > DACustomTimeline.this.getBounds().width
- - startRangeMarker.getImage().getBounds().width) {
- double endTimePx = secondToPixcel(totalEndTime);
- if (e.x > endTimePx) {
- e.x = (int) endTimePx;
- } else {
- e.x = DACustomTimeline.this.getBounds().width
- - startRangeMarker.getImage().getBounds().width;
- }
- } else {
- double endTimePx = secondToPixcel(totalEndTime);
- if (e.x > endTimePx) {
- e.x = (int) endTimePx;
- }
- }
-
- double movedTime = pixcelToSecond(e.x);
- startRangeMarker.setTime(movedTime);
- DACustomTimeline.this.redraw();
- } else if (endRangeMarker.isPushed()) {
- if (e.x < 0 + endRangeMarker.getImage().getBounds().width) {
- e.x = endRangeMarker.getImage().getBounds().width;
- } else if (e.x > DACustomTimeline.this.getBounds().width) {
- double endTimePx = secondToPixcel(totalEndTime);
- if (e.x > endTimePx) {
- e.x = (int) endTimePx;
- } else {
- e.x = DACustomTimeline.this.getBounds().width;
- }
- } else {
- double endTimePx = secondToPixcel(totalEndTime);
- if (e.x > endTimePx) {
- e.x = (int) endTimePx;
- }
- }
-
- double movedTime = pixcelToSecond(e.x);
- endRangeMarker.setTime(movedTime);
- DACustomTimeline.this.redraw();
- }
- }
- }
-}
+++ /dev/null
-/*
- * Dynamic Analyzer
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * Sanghyun Lee <sanghyunnim.lee@samsung.com>
- * Juyoung Kim <j0.kim@samsung.com>
- *
- * 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.graphics.Image;
-
-public class DACustomTimelineRangeMarker {
- private double time = -1;
- private Image normalImage;
- private Image pushedImage;
-
- private boolean isPushed = false;
-
- public DACustomTimelineRangeMarker(Image normalImage, Image pushedImage) {
- this.normalImage = normalImage;
- this.pushedImage = pushedImage;
- }
-
- public void setTime(double time) {
- this.time = time;
- }
-
- public double getTime() {
- return time;
- }
-
- public void setPushStatus(boolean status) {
- this.isPushed = status;
- }
-
- public Image getImage() {
- if(isPushed) {
- return pushedImage;
- } else {
- return normalImage;
- }
- }
-
- public boolean isPushed() {
- return isPushed;
- }
-}
\ No newline at end of file
+++ /dev/null
-/*
- * Dynamic Analyzer
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * yeongtaik byeon <yeongtaik.byeon@samsung.com>
- * Juyoung Kim <j0.kim@samsung.com>
- *
- * 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.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.eclipse.swt.widgets.Display;
-import org.tizen.dynamicanalyzer.widgets.helper.ColorResources;
-import org.tizen.dynamicanalyzer.widgets.helper.Formatter;
-import org.tizen.dynamicanalyzer.widgets.helper.ImageResources;
-
-public class DACustomTimelineRenderer {
- public static final int DEFAULT_FONT_SIZE = 6;
- 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 int startTime;
- int scale;
- Font font = new Font(Display.getCurrent(), "Verdana", // FIXME
- DEFAULT_FONT_SIZE, SWT.NORMAL);
-
- private void drawRangeMarkers(GC gc, DACustomTimeline timeline) {
- DACustomTimelineRangeMarker startMarker = timeline
- .getStartRangeMarker();
- DACustomTimelineRangeMarker 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, DACustomTimeline timeline) {
- Rectangle rt = timeline.getClientArea();
- gc.setFont(font);
- 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 >= DACustomTimeline.SCALE_400) {
- drawTimeString(gc, startTime, pixcelX, 1);
- }
- gc.drawLine(pixcelX, rt.height - 5, pixcelX, rt.height - 1);
- } else {
- if (scale >= DACustomTimeline.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(new Font(Display.getCurrent(), "Verdana", 7, SWT.NONE));
-
- gc.drawString(time,
- timeline.getDetailedTimePosition()
- - gc.stringExtent(time).x / 2, 1, true);
- }
- }
-}
Internal call=off
-Platform=etc
+Platform=tizen2.1
Build time=09/05/2012 10:30 AM (GMT)
Snapshot=0
Selected chart list=CPU,CPU core,CPU frequency,Heap allocation,Process Size,Memory,File,Screenshot,UI event
String logPath = WorkbenchPathManager.getLogsPath();
File logs = new File(logPath);
if (!logs.exists()) {
- logs.mkdir();
+ logs.mkdirs();
}
String logFileName = "da_log_" + logPostFix;//$NON-NLS-1$
public boolean preWindowShellClose() {
if (DACommunicator.isRunning()) {
- // DACommunicator
- // .sendMessage(AnalyzerConstants.MSG_STOP
- // + CommonConstants.CMD_SPLIT + 0
- // + CommonConstants.CMD_SPLIT);
DACommunicator.sendStopMessage();
}
\r
public class AnalyzerConstants {\r
// if log change occurs then increase save data version!!\r
- public static final String DA_VERSION = "2.1";\r
- public static final String SAVE_DATA_VERSION = "0.85"; //$NON-NLS-1$\r
+ public static final String SAVE_DATA_VERSION = "0.86"; //$NON-NLS-1$\r
public static final boolean CHECK_INTERNAL = true;\r
\r
/* folder names */\r
public static final String ABOUT_FILE_NAME = "about.mappings"; //$NON-NLS-1$\r
public static final String LICENSE_FILE_NAME = "license"; //$NON-NLS-1$\r
public static final String USER_INTERFACE_API_LIST_FILE_NAME = "user_interface_api_list"; //$NON-NLS-1$\r
+ public static final String TIZEN_FOLDER_ROOTSTRAPS = "rootstraps"; //$NON-NLS-1$\r
+ public static final String TIZEN_FOLDER_USR = "usr"; //$NON-NLS-1$\r
+ public static final String TIZEN_FOLDER_INCLUDE = "include"; //$NON-NLS-1$\r
+ public static final String TIZEN_FOLDER_OSP = "osp"; //$NON-NLS-1$\r
\r
public static final String DA_DAEMON_NAME = "da_manager"; //$NON-NLS-1$\r
public static final String TOOL_RECORDER_NAME = "da_event"; //$NON-NLS-1$\r
\r
/* timer intervals */\r
public static final int SOCKET_CHECK_INTERVAL = 10;\r
- public static final int SOCKET_TIMEOUT = 10000;\r
+ public static final int SOCKET_TIMEOUT = 120000;\r
public static final int SOCKET_FORWARD_INTERVAL = 1000;\r
public static final int LOG_CHECK_INTERVAL = 1000;\r
public static final int SAVE_PREPARE_TIME = 2000;\r
public static final String MSG_VERSION = "999"; //$NON-NLS-1$\r
public static final String MSG_OK = "901"; //$NON-NLS-1$\r
public static final String MSG_NOT_OK = "902"; //$NON-NLS-1$\r
+ public static final String MSG_WAIT = "903"; //$NON-NLS-1$\r
public static final String MSG_SNAPSHOT = "103"; //$NON-NLS-1$\r
\r
+ public static final int MSG_RECORD = 801;\r
+ public static final int MSG_REPLAY = 802;\r
+\r
public static final int OPT_OFF = 0x0000;\r
public static final int OPT_CPUMEM = 0x0001;\r
public static final int OPT_FUNC = 0x0002;\r
import org.tizen.dynamicanalyzer.services.RecordStateSourceProvider;
import org.tizen.dynamicanalyzer.theme.DATheme;
import org.tizen.dynamicanalyzer.theme.DAThemeWhite;
+import org.tizen.dynamicanalyzer.ui.info.callstack.CallStackManager;
import org.tizen.dynamicanalyzer.ui.page.BaseView;
import org.tizen.dynamicanalyzer.ui.page.DAPageComposite;
import org.tizen.dynamicanalyzer.ui.range.RangeDataManager;
private static FailedChecker failedChecker = new FailedChecker();
private static FailedChecker calledChecker = new FailedChecker();
private static WarningChecker warningChecker = new WarningChecker();
+ private static CallStackManager callstackManager = new CallStackManager();
private static boolean appInfoArrived = false;
private static boolean isHaveSampleThread = false;
private static String startBinaryAddr = null;
private static String endBinaryAddr = null;
+ public static final int THREAD_JOIN_WAIT_TIME = 5000;
+
public static boolean isExit() {
return exit;
}
theme = t;
ColorResources.initColors();
- // TODO: redraw all widgets!
- // AnalyzerUtil.getWorkbenchWindow().getWorkbench()
- // .getActiveWorkbenchWindow();
+ // redraw all widgets!
}
public static boolean hasSampleThread() {
failedChecker.clear();
warningChecker.clear();
calledChecker.clear();
+ callstackManager.clear();
isHaveSampleThread = false;
StopProcessManager.clear();
UserFunctionManager.getInstance().clear();
return warningChecker;
}
+ public static CallStackManager getCallstackManager() {
+ return callstackManager;
+ }
+
public static FailedChecker getCalledFunctionChecker() {
return calledChecker;
}
+ File.separator + AnalyzerConstants.TEMP_FOLDER_NAME;
public static final String CONFIG_FOLDER_PATH = PathManager
.getConfigFolderPath();
- public static final String ABOUT_FILE_PATH = PathManager
- .getAboutPath();
+ public static final String ABOUT_FILE_PATH = PathManager.getAboutPath();
public static final String SDB_PATH = PathManager.getSdbPath();
public static final String READELF_PATH = DYNAMIC_ANALYZER_INSTALL_PATH
- + File.separator + AnalyzerConstants.TARGET_FOLDER_NAME + File.separator;
+ + File.separator + AnalyzerConstants.TARGET_FOLDER_NAME
+ + File.separator;
public static final String TARGET_PATH = PathManager.getTargetPath();
public static final String DA_SINGLETON_FILE_PATH = PathManager
public static final String WINDOW_ACTIVATOR_MACOS_PATH = TIZEN_ROOT_PATH
+ "/tools/dynamic-analyzer/tool/macoswindowactivator.sh";//$NON-NLS-1$
- public static final String TIZEN_2_0_EMULATOR_SOUECE_PATH = TIZEN_ROOT_PATH
- + "/platforms/tizen2.0/rootstraps/tizen-emulator-2.0.cpp/usr/include/osp"; //$NON-NLS-1$
- public static final String TIZEN_2_0_DEVICE_SOUECE_PATH = TIZEN_ROOT_PATH
- + "/platforms/tizen2.0/rootstraps/tizen-device-2.0.cpp/usr/include/osp"; //$NON-NLS-1$
-
- public static final String TIZEN_2_1_EMULATOR_SOUECE_PATH = TIZEN_ROOT_PATH
- + "/platforms/tizen2.1/rootstraps/tizen-emulator-2.1.native/usr/include/osp"; //$NON-NLS-1$
- public static final String TIZEN_2_1_DEVICE_SOUECE_PATH = TIZEN_ROOT_PATH
- + "/platforms/tizen2.1/rootstraps/tizen-device-2.1.native/usr/include/osp"; //$NON-NLS-1$
-
+ public static final String TIZEN_HEADER_SOUECE_PATH = PathManager
+ .getTizenHeaderSouecePath();
-
/* Name & Path */
public static final String DA_REMOTE_PROBE_PATH = "/home/developer/sdk_tools/da/"; //$NON-NLS-1$
public static final String DA_REMOTE_PATH = "/home/developer/sdk_tools/da/"; //$NON-NLS-1$
public static final String TOOL_REMOTE_RECORDER_BINARY_PATH = DA_REMOTE_PATH
+ AnalyzerConstants.TOOL_RECORDER_NAME;
public static final String APPLICATION_LIST_PATH = "/opt/share/applications/"; //$NON-NLS-1$
-
- public static final String DA_DAEMON_LOG_PATH = "/tmp/da_daemon.log"; //$NON-NLS-1$
+
+ public static final String DA_DAEMON_LOG_PATH = "/tmp/daemonlog.da"; //$NON-NLS-1$
}
import org.tizen.dynamicanalyzer.listeners.AnalyzerPerspectiveListener;\r
import org.tizen.dynamicanalyzer.resources.ColorResources;\r
import org.tizen.dynamicanalyzer.shortcut.ShortCutManager;\r
+import org.tizen.dynamicanalyzer.sql.SqlManager;\r
import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;\r
\r
public class AnalyzerPlugin extends AbstractUIPlugin {\r
* = false; break; } if (i + 1 == count) { delete = true; } } }\r
**/\r
if (delete) {\r
+ SqlManager.getInstance().closeConnection();\r
File tempDir = new File(AnalyzerPaths.TEMP_FOLDER_PATH);\r
if (tempDir.isDirectory() && tempDir.exists()) {\r
if (AnalyzerUtil.deleteFile(tempDir)) {\r
/* Commands */
public static final String CMD_REMOVE = "rm -rf"; //$NON-NLS-1$
- public static final String CMD_APPLICATION_LIST = "/usr/bin/pkginfo --listapp";
- public static final String CMD_FIND_UNITTEST_PREFIX = "find ";//$NON-NLS-1$
- public static final String CMD_FIND_UNITTEST_POSTFIX = " -name *.unittest";//$NON-NLS-1$
+ public static final String CMD_APPLICATION_LIST = "/usr/bin/pkginfo --listpkg";
public static final String CMD_UPLOAD_FILE_LIST = "du -b " + //$NON-NLS-1$
AnalyzerPaths.DA_REMOTE_PATH + AnalyzerConstants.READELF_BIN;
public static final String DACOMMAND_KILL_APP = "/usr/bin/da_command killapp";
public static final String DACOMMAND_RUN_MANAGER = "/usr/bin/da_command runmanager";
public static final String DACOMMAND_RUN_EVENT = "/usr/bin/da_command runevent";
+ public static final String DACOMMAND_FIND_UNITTEST = "/usr/bin/da_command findunittest";
+ public static final String DACOMMAND_FIND_IME = "/usr/bin/pkginfo --arg-flt 10 http://tizen.org/category/ime";
public static final String CMD_IS_ARM_ARCH = "uname -m"; //$NON-NLS-1$
-
+ public static final String CMD_CAT_PORT_FILE = "cat /tmp/port.da"; //$NON-NLS-1$
}
package org.tizen.dynamicanalyzer.common;
+
public class CommonConstants {
/* special character */
private final String message;
private final int errNo;
-
+
+ public static final int ERROR_MSG_INDEX = 0;
+ public static final int ERROR_LENGTH_INDEX = 1;
+ public static final int ERROR_NUMBER_INDEX = 2;
+
private ErrorCode(int num, String msg) {
errNo = num;
message = msg;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Shell;
+import org.tizen.dynamicanalyzer.communicator.DACommunicator;
import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;
import org.tizen.dynamicanalyzer.nl.ConfigureLabels;
import org.tizen.dynamicanalyzer.resources.ImageResources;
return rootPath;
}
+ public static String getTizenHeaderSouecePath() {
+ String tizenHeaderSouecePath = CommonConstants.EMPTY;
+ if (null != getPlatform()) {
+ String tempPath = AnalyzerPaths.TIZEN_ROOT_PATH;
+ if (null != tempPath) {
+ tempPath += File.separator
+ + AnalyzerConstants.PLATFORM_FOLDER_NAME
+ + File.separator + getPlatform() + File.separator
+ + AnalyzerConstants.TIZEN_FOLDER_ROOTSTRAPS
+ + File.separator
+ + "%s-%s-%s" + File.separator//$NON-NLS-1$
+ + AnalyzerConstants.TIZEN_FOLDER_USR + File.separator
+ + AnalyzerConstants.TIZEN_FOLDER_INCLUDE
+ + File.separator + AnalyzerConstants.TIZEN_FOLDER_OSP;
+ }
+ String currentDevie = CommonConstants.EMPTY;
+ if (DACommunicator.isCurrentDeviceArmArch()) {
+ currentDevie = "device";//$NON-NLS-1$
+ } else {
+ currentDevie = "emulator";//$NON-NLS-1$
+ }
+ String platformName = getPlatform().replaceAll(
+ "[^A-Za-z]", CommonConstants.EMPTY);//$NON-NLS-1$
+ String platformVersion = getPlatform().replaceAll(
+ "[A-Za-z]", CommonConstants.EMPTY);//$NON-NLS-1$
+ if (Double.parseDouble(platformVersion) < 2.1) {
+ tizenHeaderSouecePath = String.format(tempPath, platformName,
+ currentDevie, platformVersion + ".cpp");//$NON-NLS-1$
+ } else {
+ tizenHeaderSouecePath = String.format(tempPath, platformName,
+ currentDevie, platformVersion + ".native");//$NON-NLS-1$
+ }
+ }
+ return tizenHeaderSouecePath;
+ }
+
public static String getInstallPath() {
String installPath = AnalyzerPaths.TIZEN_ROOT_PATH;
if (null != installPath) {
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
+import java.net.InetAddress;
+import java.net.NetworkInterface;
import java.net.Socket;
+import java.net.SocketException;
import java.net.SocketTimeoutException;
import java.net.UnknownHostException;
import java.util.ArrayList;
+import java.util.Enumeration;
import java.util.HashMap;
import java.util.List;
-import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
+import org.tizen.dynamicanalyzer.common.AnalyzerManager;
import org.tizen.dynamicanalyzer.common.AnalyzerPaths;
import org.tizen.dynamicanalyzer.common.AnalyzerShellCommands;
import org.tizen.dynamicanalyzer.common.CommonConstants;
-import org.tizen.dynamicanalyzer.common.ErrorCode;
import org.tizen.dynamicanalyzer.common.PathManager;
import org.tizen.dynamicanalyzer.model.DeviceInfo;
import org.tizen.dynamicanalyzer.nl.ConfigureLabels;
import org.tizen.dynamicanalyzer.project.AppInfo;
-import org.tizen.dynamicanalyzer.resources.ImageResources;
import org.tizen.dynamicanalyzer.ui.toolbar.ConfigureManager;
import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea;
-import org.tizen.dynamicanalyzer.ui.widgets.DADialog;
import org.tizen.dynamicanalyzer.uirecorder.UIRecorderTool;
import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
import org.tizen.sdblib.IDevice;
import org.tizen.sdblib.MultiLineReceiver;
import org.tizen.sdblib.NullOutputReceiver;
import org.tizen.sdblib.SdbCommandRejectedException;
-import org.tizen.sdblib.SdbShellProcess;
import org.tizen.sdblib.ShellCommandUnresponsiveException;
import org.tizen.sdblib.SmartDevelopmentBridge;
import org.tizen.sdblib.SmartDevelopmentBridge.IDeviceChangeListener;
private static final int PORT_WAIT_TIME = 5;
private static List<String> portLines = new ArrayList<String>();
+ private static boolean blocked = false;
+
private static Socket controlSock = null;
private static BufferedWriter controlWriter = null;
private static BufferedReader controlReader = null;
private static SmartDevelopmentBridge sdbBridge = null;
private static List<String> packageInfoMultiLines = new ArrayList<String>();
- private static List<AppInfo> appInfoList = new ArrayList<AppInfo>();
- private static HashMap<String, AppInfo> packageInfoHash = new HashMap<String, AppInfo>();
+
private static AppInfo selectedApp = null;
private static List<DeviceInfo> devices = null;
private static DeviceInfo currentDevice = null;
- private static List<String> unittestMultiLines = new ArrayList<String>();
- private static List<String> uploadDataResult = null;
+ private static List<String> filterMultiLines = new ArrayList<String>();
+ private static List<String> unittestList = new ArrayList<String>();
+ private static List<String> imeList = new ArrayList<String>();
+ private static List<String> uploadDataResult = new ArrayList<String>();
private static boolean isRunning = false;
isRunning = false;
devices = null;
isArch = false;
- appInfoList.clear();
- packageInfoHash.clear();
+ packageInfoMultiLines.clear();
+ filterMultiLines.clear();
+ uploadDataResult.clear();
+ unittestList.clear();
remotePort = -1;
}
+ public static boolean connectionProcess() {
+ // step 1. check readelf and upload
+ if (getReadelfSize() < 0) {
+ System.out.println("upload readelf");
+ if (!uploadReadElf()) {
+ System.out.println("Failed to upload files..."); //$NON-NLS-1$
+ return false;
+ }
+ }
+
+ // step 2. run da_manager
+ execCommand(AnalyzerShellCommands.DACOMMAND_RUN_MANAGER);
+
+ // step 3. get remote port from /tmp/port.da in device or emul
+ if (!initRemotePort()) {
+ return false;
+ }
+
+ // step 4. port foward
+ foward(LOCAL_PORT, remotePort);
+
+ // step 5. set da_communicator is running!
+ setRunning(true);
+
+ // step 6. create data socket
+ if (null == createControlSocket(LOCAL_PORT)) {
+ System.out.println("control socket creation failed."); //$NON-NLS-1$
+ setRunning(false);
+ return false;
+ } else {
+ System.out.println("control socket create success!!");
+ }
+
+ if (null == createSocket(LOCAL_PORT)) {
+ System.out.println("data socket creation failed."); //$NON-NLS-1$
+ setRunning(false);
+ return false;
+ } else {
+ System.out.println("data socket create success!!");
+ }
+ return true;
+ }
+
+ protected static boolean initRemotePort() {
+ int count = 0;
+ boolean ret = false;
+ // add error check
+ while (count < PORT_WAIT_TIME) {
+ try {
+ execShellCommand(AnalyzerShellCommands.CMD_CAT_PORT_FILE,
+ new MultiLineReceiver() {
+ @Override
+ public void processNewLines(String[] lines) {
+ portLines.clear();
+ for (int i = 0; i < lines.length; i++) {
+ portLines.add(lines[i]);
+ }
+ }
+ });
+ if (!portLines.isEmpty()) {
+ String line = portLines.get(0);
+ System.out.println("port : " + line);
+ try {
+ remotePort = Integer.parseInt(line);
+ System.out
+ .println("port get success!! : " + remotePort);
+ ret = true;
+ break;
+ } catch (NumberFormatException e) {
+ System.out.print("port is invalid...");
+ }
+ }
+ count++;
+ System.out.print("wait for port..");
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ break;
+ }
+ }
+ return ret;
+ }
+
+ public static int getRemotePort() {
+ return remotePort;
+ }
+
+ public static boolean sendStartMessage() {
+ int isArm = 0;
+ int isEmul = 0;
+ int res = 0;
+
+ if (!isCurrentDeviceArmArch()) {
+ isArm = 1;
+ }
+
+ DeviceInfo device = getSelectedDevice();
+ if (null != device
+ && device.getIDevice().getSerialNumber()
+ .startsWith(CommonConstants.EMULATOR)) {
+ isEmul = 1;
+ }
+
+ if (null == getSelectedApp()) {
+ return false;
+ }
+ String rearMessage = CommonConstants.EMPTY + res + isEmul + isArm
+ + CommonConstants.CMD_SPLIT + getConfiguration()
+ + CommonConstants.CMD_SPLIT
+ + getSelectedApp().getInfo(AppInfo.EXEC_INDEX);
+
+ String message = AnalyzerConstants.MSG_START
+ + CommonConstants.CMD_SPLIT + rearMessage.length()
+ + CommonConstants.CMD_SPLIT + rearMessage;
+ System.out.println("Send message :" + message); //$NON-NLS-1$
+
+ String result = handleControlMessage(message);
+ if (null != result) {
+ System.out.println("start message ack :" + result);
+ String[] splitResult = result.split(CommonConstants.CMD_SPLIT_READ);
+ if (AnalyzerConstants.MSG_OK.equals(splitResult[0])) {
+ return true;
+ } else {
+ System.out
+ .println("start message ack error :" + splitResult[1]);
+ return false;
+ }
+ }
+ return false;
+ }
+
+ public static boolean sendStopMessage() {
+ if (isRunning()) {
+ String message = AnalyzerConstants.MSG_STOP
+ + CommonConstants.CMD_SPLIT + 0 + CommonConstants.CMD_SPLIT;
+ System.out.println("stop send message :" + message);
+
+ String result = handleControlMessage(message);
+ if (null != result) {
+ System.out.println("stop message ack :" + result);
+ String[] splitResult = result
+ .split(CommonConstants.CMD_SPLIT_READ);
+ if (AnalyzerConstants.MSG_OK.equals(splitResult[0])) {
+ return true;
+ } else {
+ System.out.println("stop message ack error :"
+ + splitResult[1]);
+ return false;
+ }
+ }
+ }
+ return false;
+ }
+
+ public static boolean sendSnapshotMessage(int state) {
+ String statestr = Integer.toString(state);
+ String message = AnalyzerConstants.MSG_OPTION
+ + CommonConstants.CMD_SPLIT + statestr.length()
+ + CommonConstants.CMD_SPLIT + statestr;
+
+ String result = handleControlMessage(message);
+ if (null != result) {
+ System.out.println("snapshot message ack :" + result);
+ String[] splitResult = result.split(CommonConstants.CMD_SPLIT_READ);
+ if (AnalyzerConstants.MSG_OK.equals(splitResult[0])) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public static int getConfiguration() {
+ int state = 0;
+
+ state |= ConfigureManager.getInstance().getValueInt(
+ ConfigureLabels.FUNCTIONPROFILING);
+ state |= ConfigureManager.getInstance().getValueInt(
+ ConfigureLabels.ALLOCATION);
+ state |= ConfigureManager.getInstance().getValueInt(
+ ConfigureLabels.FILE);
+ state |= ConfigureManager.getInstance().getValueInt(
+ ConfigureLabels.THREAD);
+ state |= ConfigureManager.getInstance().getValueInt(
+ ConfigureLabels.USERINTERFACE);
+ state |= ConfigureManager.getInstance().getValueInt(
+ ConfigureLabels.SNAPSHOT);
+ state |= ConfigureManager.getInstance().getValueInt(
+ ConfigureLabels.EVENT);
+ state |= ConfigureManager.getInstance().getValueInt(
+ ConfigureLabels.RECORDING);
+
+ return state;
+ }
+
public static List<DeviceInfo> getDevices() {
if (null == devices) {
devices = new ArrayList<DeviceInfo>();
return devices;
}
- public static DeviceInfo getDeviceBySerial(String serial) {
+ public static DeviceInfo getDeviceByName(String name) {
List<DeviceInfo> devices = getDevices();
int size = devices.size();
for (int i = 0; i < size; i++) {
- if (devices.get(i).getIDevice().getSerialNumber().equals(serial)) {
+ if (devices.get(i).getIDevice().getSerialNumber().equals(name)) {
return devices.get(i);
}
}
int size = devices.length;
if (size > 0) {
for (int i = 0; i < size; i++) {
- addDevice(devices[i]);
+ if (devices[i].isOnline()) {
+ addDevice(devices[i]);
+ }
}
}
}
private static boolean isArch = false;
- private static MultiLineReceiver archReceiver = new MultiLineReceiver() {
- @Override
- public void processNewLines(String[] lines) {
- if (lines[0].contains(CommonConstants.ARM_ARCH)) {
- isArch = true;
- }
- }
- };
-
- private static boolean isCurrentDeviceArmArch() {
- execShellCommand(AnalyzerShellCommands.CMD_IS_ARM_ARCH, archReceiver);
+ public static boolean isCurrentDeviceArmArch() {
+ execShellCommand(AnalyzerShellCommands.CMD_IS_ARM_ARCH,
+ new MultiLineReceiver() {
+ @Override
+ public void processNewLines(String[] lines) {
+ if (lines[0].contains(CommonConstants.ARM_ARCH)) {
+ isArch = true;
+ } else {
+ isArch = false;
+ }
+ }
+ });
return isArch;
}
return devNameList;
}
- private static MultiLineReceiver packageInfoReceiver = new MultiLineReceiver() {
- @Override
- public void processNewLines(String[] appLines) {
- for (int i = 0; i < appLines.length; i++) {
- packageInfoMultiLines.add(appLines[i]);
- }
- }
- };
-
- private static MultiLineReceiver unittestInfoReceiver = new MultiLineReceiver() {
- @Override
- public void processNewLines(String[] appLines) {
- for (int i = 0; i < appLines.length; i++) {
- unittestMultiLines.add(appLines[i]);
- }
- }
- };
-
public static List<AppInfo> getAppListFromTarget() {
-
+ if (null == currentDevice) {
+ return null;
+ }
+ List<AppInfo> appInfoList = currentDevice.getAppInfoList();
+ HashMap<String, AppInfo> appInfoHash = currentDevice.getAppInfoHash();
List<AppInfo> backList = new ArrayList<AppInfo>();
- backList.addAll(packageInfoHash.values());
+ backList.addAll(appInfoHash.values());
packageInfoMultiLines.clear();
execShellCommand(AnalyzerShellCommands.CMD_APPLICATION_LIST,
- packageInfoReceiver);
+ new MultiLineReceiver() {
+ @Override
+ public void processNewLines(String[] appLines) {
+ for (int i = 0; i < appLines.length; i++) {
+ packageInfoMultiLines.add(appLines[i]);
+ }
+ }
+ });
+ checkUnittest();
+ checkIME();
int size = packageInfoMultiLines.size();
String line = packageInfoMultiLines.get(i);
if (line.contains("Appid")) {
List<String> lines = new ArrayList<String>();
- for (int ii = 0; ii < AppInfo.APPINFO_SIZE; ii++) {
+ for (int ii = 0; ii < AppInfo.PKGINFO_SIZE; ii++) {
lines.add(packageInfoMultiLines.get(ii + i));
}
- AppInfo pkgInfo = makeAppInfo(lines);
+ AppInfo pkgInfo = makePackageInfo(lines);
if (null != pkgInfo
&& pkgInfo.getInfo(AppInfo.APPTYPE_INDEX).contains(
AppInfo.APPTYPE_CPP)
&& pkgInfo.getInfo(AppInfo.MULTIPLE_INDEX).equals(
- CommonConstants.ZERO)) {
+ AppInfo.FLAG_ZERO)
+ && pkgInfo.getInfo(AppInfo.NODISPLAY_INDEX).equals(
+ AppInfo.FLAG_ZERO)) {
String pkgId = pkgInfo.getInfo(AppInfo.PACKAGE_INDEX);
- if (null == packageInfoHash.get(pkgId)) {
- if (!isUnittest(pkgId)) {
+ String appId = pkgInfo.getInfo(AppInfo.APPID_INDEX);
+ if (null == appInfoHash.get(pkgId)) {
+ if (!isUnittest(pkgId) && !isIME(appId)) {
appInfoList.add(pkgInfo);
- packageInfoHash.put(pkgId, pkgInfo);
+ appInfoHash.put(pkgId, pkgInfo);
}
} else {
- backList.remove(packageInfoHash.get(pkgId));
+ backList.remove(appInfoHash.get(pkgId));
}
}
- i += AppInfo.APPINFO_SIZE - 1;
+ i += AppInfo.PKGINFO_SIZE - 1;
}
}
if (!backList.isEmpty()) {
for (AppInfo pkg : backList) {
appInfoList.remove(pkg);
- packageInfoHash.remove(pkg);
+ appInfoHash.remove(pkg);
}
}
return appInfoList;
}
private static boolean isUnittest(String pkgId) {
- if (null != getUnittestList()) {
- for (String id : getUnittestList()) {
+ if (null != unittestList && !unittestList.isEmpty()) {
+ for (String id : unittestList) {
if (id.equals(pkgId)) {
return true;
}
return false;
}
- private static List<String> getUnittestList() {
+ private static boolean isIME(String appId) {
+ if (null != imeList && !imeList.isEmpty()) {
+ for (String id : imeList) {
+ if (id.equals(appId)) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ private static void checkUnittest() {
+ unittestList.clear();
+ if (null == currentDevice) {
+ return;
+ }
String appInstallPath = currentDevice.getIDevice().getAppInstallPath();
- unittestMultiLines.clear();
- execShellCommand(AnalyzerShellCommands.CMD_FIND_UNITTEST_PREFIX
- + appInstallPath
- + AnalyzerShellCommands.CMD_FIND_UNITTEST_POSTFIX,
- unittestInfoReceiver);
+ filterMultiLines.clear();
+ execShellCommand(AnalyzerShellCommands.DACOMMAND_FIND_UNITTEST,
+ new MultiLineReceiver() {
+ @Override
+ public void processNewLines(String[] appLines) {
+ for (int i = 0; i < appLines.length; i++) {
+ filterMultiLines.add(appLines[i]);
+ }
+ }
+ });
- if (unittestMultiLines.isEmpty()) {
- return null;
+ if (filterMultiLines.isEmpty()) {
+ return;
}
- List<String> unittestPkgIds = new ArrayList<String>();
- for (String line : unittestMultiLines) {
- line = line.replaceFirst(appInstallPath + CommonConstants.SLASH,
- CommonConstants.EMPTY);
- int index = line.indexOf(CommonConstants.SLASH);
- line = line.substring(0, index);
- unittestPkgIds.add(line);
+ for (String line : filterMultiLines) {
+ if (line.contains(appInstallPath)) {
+ line = line.replaceFirst(
+ appInstallPath + CommonConstants.SLASH,
+ CommonConstants.EMPTY);
+ int index = line.indexOf(CommonConstants.SLASH);
+ line = line.substring(0, index);
+ unittestList.add(line);
+ }
}
- return unittestPkgIds;
}
- private static AppInfo makeAppInfo(List<String> lines) {
- AppInfo appInfo = new AppInfo();
- for (int i = 0; i < AppInfo.APPINFO_SIZE; i++) {
+ private static void checkIME() {
+ imeList.clear();
+ if (null == currentDevice) {
+ return;
+ }
+
+ filterMultiLines.clear();
+ execShellCommand(AnalyzerShellCommands.DACOMMAND_FIND_IME,
+ new MultiLineReceiver() {
+ @Override
+ public void processNewLines(String[] appLines) {
+ for (int i = 0; i < appLines.length; i++) {
+ filterMultiLines.add(appLines[i]);
+ }
+ }
+ });
+
+ if (filterMultiLines.isEmpty()) {
+ return;
+ }
+
+ for (String line : filterMultiLines) {
+ String appId = "appid";//$NON-NLS-1$
+ if (line.contains("apptype") && line.contains("c++app")) {
+ line = line.trim();
+ int index = line.indexOf(appId);
+ // 2 means length of String " ["
+ line = line.substring(index + appId.length() + 2,
+ line.length() - 1);
+ imeList.add(line);
+ }
+ }
+ }
+
+ private static AppInfo makePackageInfo(List<String> lines) {
+ AppInfo pkgInfo = new AppInfo();
+ for (int i = 0; i < AppInfo.PKGINFO_SIZE; i++) {
String line = lines.get(i);
- int index = line.indexOf(CommonConstants.COLON);
+ int index = line.indexOf(":");
String data = line.substring(index + 1, line.length()).trim();
- appInfo.setInfo(i, data);
+ pkgInfo.setInfo(i, data);
}
- return appInfo;
+ return pkgInfo;
}
- public static AppInfo getAppInfoByName(String appLabel) {
- int size = appInfoList.size();
- for (int i = 0; i < size; i++) {
- AppInfo pkgInfo = appInfoList.get(i);
- if (pkgInfo.getInfo(AppInfo.LABEL_INDEX).equals(appLabel)) {
- return pkgInfo;
+ public static AppInfo getPkgInfoByName(String appLabel) {
+ if (null != currentDevice) {
+ int size = currentDevice.getAppInfoList().size();
+ for (int i = 0; i < size; i++) {
+ AppInfo pkgInfo = currentDevice.getAppInfoList().get(i);
+ if (pkgInfo.getInfo(AppInfo.LABEL_INDEX).equals(appLabel)) {
+ return pkgInfo;
+ }
}
}
return null;
}
- public static AppInfo getAppInfoByAppPkgId(String pkgid) {
- int size = appInfoList.size();
- for (int i = 0; i < size; i++) {
- AppInfo ai = appInfoList.get(i);
- if (ai.getInfo(AppInfo.PACKAGE_INDEX).equals(pkgid)) {
- return ai;
+ public static AppInfo getPkgInfoByAppPkgId(String pkgid) {
+ if (null != currentDevice) {
+ int size = currentDevice.getAppInfoList().size();
+ for (int i = 0; i < size; i++) {
+ AppInfo ai = currentDevice.getAppInfoList().get(i);
+ if (ai.getInfo(AppInfo.PACKAGE_INDEX).equals(pkgid)) {
+ return ai;
+ }
}
}
return null;
if (null == sock) {
System.out.println("failed to create a socket"); //$NON-NLS-1$
return null;
+ } else {
+ System.out.println("data socket create success!!");
}
sock.setSoTimeout(AnalyzerConstants.SOCKET_TIMEOUT);
new Thread(null, new ReceiveCommunicator(),
AnalyzerConstants.COMMUNICATOR_RECEIVE_THREAD).start();
+ System.out.println("Receive Thread start");
} catch (SocketTimeoutException e) {
System.out.println("socket timeout."); //$NON-NLS-1$
e.printStackTrace();
}
public static void closeSocket() {
- AnalyzerUtil.tryClose(reader, writer, sock);
+ AnalyzerUtil.tryClose(reader, writer, sock, controlReader,
+ controlWriter, controlSock);
}
public static BufferedReader getSockBufferedReader() {
public static void unfoward(int local, int remote) {
if (null != currentDevice && currentDevice.getIDevice().isOnline()) {
try {
+ System.out.println("unfoward!!");
currentDevice.getIDevice().removeForward(local, remote);
Thread.sleep(AnalyzerConstants.SOCKET_FORWARD_INTERVAL);
} catch (TimeoutException e) {
}
}
- public static void killDaemon() {
- execShellCommand(AnalyzerShellCommands.DACOMMAND_KILL_MANAGER);
- }
-
public static void execShellCommand(String command) {
execShellCommand(command, new NullOutputReceiver());
}
}
}
- public static SdbShellProcess execCommand(String command) {
+ public static Process execCommand(String command) {
if (null != currentDevice && currentDevice.getIDevice().isOnline()) {
try {
- return currentDevice.getIDevice().executeShellCommand(command);
+ return currentDevice.getIDevice().executeShellCommand(command,
+ false);
} catch (IOException e) {
e.printStackTrace();
}
public static String handleControlMessage(String message) {
String result = null;
try {
- if (null != controlSock) {
+ if (null != controlSock && !controlSock.isClosed()) {
controlWriter.write(message);
controlWriter.flush();
}
- System.out.println("wait for ack...");
+ System.out.println("wait for ack... [send message : " + message
+ + " ]");
while (isRunning) {
char cbuf[] = new char[64];
+ blocked = true;
int readsize = controlReader.read(cbuf);
-// System.out.println(readsize);
-
- if(readsize > 0)
- {
+ blocked = false;
+ if (readsize > 0) {
result = String.copyValueOf(cbuf, 0, readsize);
- System.out.println(result.length() + "="+ result);
-
- if (null != result && !result.isEmpty()) {
- break;
+ if (null != result && !result.isEmpty()) {
+ String[] splitResult = result
+ .split(CommonConstants.CMD_SPLIT_READ);
+ if (AnalyzerConstants.MSG_WAIT.equals(splitResult[0])) {
+ continue;
+ } else {
+ break;
+ }
}
}
-// System.out.println("wait!!");
}
- System.out.println("pass");
- // result = "test ack message";
-
+ } catch (SocketException e) {
+ e.printStackTrace();
+ return null;
+ } catch (SocketTimeoutException e) {
+ e.printStackTrace();
+ return null;
} catch (IOException e) {
e.printStackTrace();
return null;
+ } finally {
+ blocked = false;
}
return result;
}
return false;
}
- private static long uploadFile(String source, String targetPath) {
+ private static boolean uploadFile(String source, String targetPath) {
+
SyncResult result = push(source, targetPath);
if (null == result || SyncService.RESULT_OK != result.getCode()) {
- System.out
- .println("upload " + targetPath + " is failed : " + source); //$NON-NLS-1$ //$NON-NLS-2$
+ System.out.println("upload to" + targetPath + " is failed! "); //$NON-NLS-1$ //$NON-NLS-2$
System.out.println("Error : " + result.getMessage()); //$NON-NLS-1$
- return -1;
- }
-
- File file = new File(source);
- if (file.exists()) {
- return file.length();
- } else {
- System.out.println("upload error! file is not exist : " + source); //$NON-NLS-1$
- return -1;
+ return false;
}
+ return true;
}
- public static boolean uploadReadelf() {
+ public static boolean uploadReadElf() {
long readelfSize = -1;
String readelf = AnalyzerPaths.READELF_PATH;
- // for readelf
if (isCurrentDeviceArmArch()) {
readelf += CommonConstants.ARM_ARCH;
} else {
}
String source = readelf + File.separator
+ AnalyzerConstants.READELF_BIN;
- readelfSize = uploadFile(source, AnalyzerPaths.DA_REMOTE_PATH
- + AnalyzerConstants.READELF_BIN);
+ File file = new File(source);
+ if (file.exists()) {
+ readelfSize = file.length();
+ } else {
+ System.out.println("upload error! file is not exist : " + source); //$NON-NLS-1$
+ return false;
+ }
+ if (!uploadFile(source, AnalyzerPaths.DA_REMOTE_PATH
+ + AnalyzerConstants.READELF_BIN)) {
+ return false;
+ }
- if (readelfSize < 0) {
+ // readelf
+ long uploadSize = getReadelfSize();
+ if (uploadSize < 0) {
return false;
- } else {
- execShellCommand(AnalyzerShellCommands.CMD_UPLOAD_FILE_LIST,
- uploadDataReceiver);
- int size = getUploadDataResult().size();
- List<String> resultString = new ArrayList<String>();
- for (int i = 0; i < size; i++) {
- String[] splitResult = uploadDataResult.get(i).split("\\/"); //$NON-NLS-1$
- resultString.add(new String(splitResult[0].trim()));
- }
+ }
+ if (readelfSize != uploadSize) {
+ System.out.println("readelf file size is different!! "); //$NON-NLS-1$
+ return false;
+ }
+ return true;
+ }
- boolean ret = true;
- // readelf
- if (readelfSize != Long.parseLong(resultString.get(0))) {
- System.out.println("readelf file size is different!! "); //$NON-NLS-1$
- ret = false;
- }
+ private static long getReadelfSize() {
+ long ret = -1;
+ getUploadDataResult().clear();
+ execShellCommand(AnalyzerShellCommands.CMD_UPLOAD_FILE_LIST,
+ uploadDataReceiver);
+ if (getUploadDataResult().isEmpty()) {
return ret;
}
+
+ String duResult = getUploadDataResult().get(0);
+ if (!duResult.contains("cannot access")) {
+ String[] splitResult = duResult.split("\\/"); //$NON-NLS-1$
+ duResult = new String(splitResult[0].trim());
+ ret = Long.parseLong(duResult);
+ }
+ return ret;
}
private static MultiLineReceiver uploadDataReceiver = new MultiLineReceiver() {
SmartDevelopmentBridge.removeDeviceChangeListener(deviceChanged);
}
+ public static void testDisConnected() {
+ deviceChanged.deviceDisconnected(currentDevice.getIDevice());
+ }
+
public static boolean isDeviceConnected() {
if (null == devices || devices.isEmpty()) {
return false;
private static IDeviceChangeListener deviceChanged = new IDeviceChangeListener() {
@Override
public void deviceDisconnected(IDevice device) {
- // called : each device disconnected time
- System.out.println("device disconnected : "
- + device.getSerialNumber());
- DeviceInfo deviceInfo = getDeviceBySerial(device.getSerialNumber());
- devices.remove(deviceInfo);
- checkDevices();
- if (isRunning()) {
- System.out.println("Disconnected while DA is running."); //$NON-NLS-1$
- UIRecorderTool.getInstance().stop();
- DACommunicator.setRunning(false);
+ if (!AnalyzerManager.isRunning()) {
+ // called : each device disconnected time
+ System.out.println("device disconnected : "
+ + device.getSerialNumber());
+ DeviceInfo deviceInfo = getDeviceByName(device
+ .getSerialNumber());
+ if (null != devices && !devices.isEmpty()) {
+ devices.remove(deviceInfo);
+ checkDevices();
+ if (isRunning()) {
+ System.out.println("Disconnected while DA is running."); //$NON-NLS-1$
+ UIRecorderTool.getInstance().stop();
+ DACommunicator.setRunning(false);
+ }
+ }
}
}
public void deviceChanged(IDevice device, int changeMask) {
// called : device added - already dynamic-analyzer running (not
// tracing)
- System.out.println("device changed : " + device.getSerialNumber()
- + " " + changeMask);
- if (1 == changeMask) {
- addDevice(device);
- checkDevices();
- if (null != getSelectedDevice() && null != getSelectedApp()) {
- Display.getDefault().syncExec(new Runnable() {
- @Override
- public void run() {
- ToolbarArea.getInstance().setStartButtonEnablement(
- true);
- }
- });
+ if (!AnalyzerManager.isRunning()) {
+ System.out.println("device changed : "
+ + device.getSerialNumber() + " " + changeMask);
+ if (1 == changeMask) {
+ addDevice(device);
+ checkDevices();
+ if (null != getSelectedDevice() && null != getSelectedApp()) {
+ Display.getDefault().syncExec(new Runnable() {
+ @Override
+ public void run() {
+ ToolbarArea.getInstance()
+ .setStartButtonEnablement(true);
+ ToolbarArea.getInstance()
+ .setStartButtonEnablement(true);
+ }
+ });
+ }
}
}
}
private static void clearDeviceAppInfo() {
setSelectedDevice(null);
setSelectedApp(null);
- appInfoList.clear();
packageInfoMultiLines.clear();
}
}
}
- // NEW_COM
- protected static void initRemotePort() {
- int count = 0;
- while (count < PORT_WAIT_TIME) {
- try {
- execShellCommand("cat /tmp/port.da", portReceiver);
- if (!portLines.isEmpty()) {
- String line = portLines.get(0);
- remotePort = Integer.parseInt(line);
- break;
- }
- count++;
- System.out.println("wait for remote port get");
- Thread.sleep(1000);
- } catch (InterruptedException e) {
- e.printStackTrace();
- } catch (NumberFormatException e) {
- e.printStackTrace();
- }
- }
- }
-
- // NEW_COM
- private static MultiLineReceiver portReceiver = new MultiLineReceiver() {
- @Override
- public void processNewLines(String[] lines) {
- portLines.clear();
- for (int i = 0; i < lines.length; i++) {
- portLines.add(lines[i]);
- }
- }
- };
-
- public static int getRemotePort() {
- return remotePort;
- }
-
- public static boolean connect() {
-
- killDaemon();
-
- System.out.println("upload readelf");
- if (!uploadReadelf()) {
- System.out.println("Failed to upload files..."); //$NON-NLS-1$
- return false;
- }
-
- execCommand(AnalyzerShellCommands.DACOMMAND_RUN_MANAGER);
-
- initRemotePort();
- if (remotePort < 0) {
- System.out.println("get port failed! : "
- + ErrorCode.getError(remotePort).getMessage());
- return false;
- }
- foward(LOCAL_PORT, remotePort);
-
- setRunning(true);
+ public static String getLocalhost() {
+ NetworkInterface ni;
+ InetAddress i;
- if (null == createControlSocket(LOCAL_PORT)) {
- System.out.println("socket creation failed."); //$NON-NLS-1$
- return false;
+ Enumeration<NetworkInterface> ne;
+ try {
+ ne = NetworkInterface.getNetworkInterfaces();
+ } catch (SocketException e1) {
+ e1.printStackTrace();
+ return null;
}
-
- return true;
- }
-
- // NEW_COM
- public static boolean sendVersionMessage() {
- String message = AnalyzerConstants.MSG_VERSION
- + CommonConstants.CMD_SPLIT + AnalyzerConstants.DA_VERSION.length() +
- CommonConstants.CMD_SPLIT + AnalyzerConstants.DA_VERSION;
- System.out.println("Send control message :" + message); //$NON-NLS-1$
-
- String result = handleControlMessage(message);
-
- if (null != result) {
- System.out.println("version message ack :" + result);
- String[] splitResult = result.split(CommonConstants.CMD_SPLIT_READ);
-
- if (AnalyzerConstants.MSG_NOT_OK.equals(splitResult[0])) {
- final String deviceVersion = splitResult[2];
- Display.getDefault().syncExec(new Runnable() {
- @Override
- public void run() {
- Shell shell = AnalyzerUtil.getWorkbenchWindow()
- .getShell();
- DADialog warning = new DADialog(shell, SWT.NONE);
- warning.setMessage("Version is invalid (device :"
- + deviceVersion + " host :"
- + AnalyzerConstants.DA_VERSION);
- warning.setIcon(ImageResources.DIALOG_WARNING_ICON);
- warning.open();
+ while (ne.hasMoreElements()) {
+ ni = (NetworkInterface) ne.nextElement();
+ if (ni.getName().contains("lo")) {//$NON-NLS-1$
+ Enumeration<InetAddress> e = ni.getInetAddresses();
+ while (e.hasMoreElements()) {
+ i = (InetAddress) e.nextElement();
+ if (!i.getHostAddress().contains(CommonConstants.PERCENT)
+ && !i.getHostAddress().contains(
+ CommonConstants.COLON)) {
+ return i.getHostAddress();
}
- });
- return false;
- } else if (AnalyzerConstants.MSG_OK.equals(splitResult[0])) {
- return true;
- }
- }
- return false;
- }
-
- // NEW_COM
- public static boolean sendStartMessage() {
- int isArm = 0;
- int isEmul = 0;
- int res = 0;
-
- if (!isCurrentDeviceArmArch()) {
- isArm = 1;
- }
-
- DeviceInfo device = getSelectedDevice();
- if (null != device
- && device.getIDevice().getSerialNumber()
- .startsWith(CommonConstants.EMULATOR)) {
- isEmul = 1;
- }
-
- String rearMessage = CommonConstants.EMPTY + res + isEmul + isArm
- + CommonConstants.CMD_SPLIT + getConfiguration()
- + CommonConstants.CMD_SPLIT
- + getSelectedApp().getInfo(AppInfo.EXEC_INDEX);
-
- String message = AnalyzerConstants.MSG_START
- + CommonConstants.CMD_SPLIT + rearMessage.length()
- + CommonConstants.CMD_SPLIT + rearMessage;
- System.out.println("Send message :" + message); //$NON-NLS-1$
-
- String result = handleControlMessage(message);
- if (null != result) {
- System.out.println("start message ack :" + result);
- String[] splitResult = result.split(CommonConstants.CMD_SPLIT_READ);
- if (AnalyzerConstants.MSG_OK.equals(splitResult[0])) {
- createSocket(LOCAL_PORT);
- return true;
- }
- }
- return false;
- }
-
- // NEW_COM
- public static boolean sendStopMessage() {
- if (isRunning()) {
- String message = AnalyzerConstants.MSG_STOP
- + CommonConstants.CMD_SPLIT + 0 + CommonConstants.CMD_SPLIT;
- System.out.println("stop send message :" + message);
-
- String result = handleControlMessage(message);
- if (null != result) {
- System.out.println("stop message ack :" + result);
- String[] splitResult = result
- .split(CommonConstants.CMD_SPLIT_READ);
- if (AnalyzerConstants.MSG_OK.equals(splitResult[0])) {
- return true;
}
}
}
- return false;
- }
-
- // NEW_COM
- public static boolean sendSnapshotMessage(int state) {
- String statestr = Integer.toString(state);
- String message = AnalyzerConstants.MSG_OPTION
- + CommonConstants.CMD_SPLIT + statestr.length()
- + CommonConstants.CMD_SPLIT + statestr;
-
- String result = handleControlMessage(message);
- if (null != result) {
- System.out.println("snapshot message ack :" + result);
- String[] splitResult = result.split(CommonConstants.CMD_SPLIT_READ);
- if (AnalyzerConstants.MSG_OK.equals(splitResult[0])) {
- return true;
- }
- }
- return false;
+ return null;
}
- public static int getConfiguration() {
- int state = 0;
-
- state |= ConfigureManager.getInstance().getValueInt(
- ConfigureLabels.FUNCTIONPROFILING);
- state |= ConfigureManager.getInstance().getValueInt(
- ConfigureLabels.ALLOCATION);
- state |= ConfigureManager.getInstance().getValueInt(
- ConfigureLabels.FILE);
- state |= ConfigureManager.getInstance().getValueInt(
- ConfigureLabels.THREAD);
- state |= ConfigureManager.getInstance().getValueInt(
- ConfigureLabels.USERINTERFACE);
- state |= ConfigureManager.getInstance().getValueInt(
- ConfigureLabels.SNAPSHOT);
- state |= ConfigureManager.getInstance().getValueInt(
- ConfigureLabels.EVENT);
- state |= ConfigureManager.getInstance().getValueInt(
- ConfigureLabels.RECORDING);
-
- return state;
+ public static boolean isWaitControlMessage() {
+ return blocked;
}
}
private final static String IDE_DA_COMMUNICATION_TYPE_3 = "SOURCE";//$NON-NLS-1$
private final String IDE_DA_COMMUNICATION_TYPE_1_RECORD = "record";//$NON-NLS-1$
private final String IDE_DA_COMMUNICATION_TYPE_1_STOP = "stop";//$NON-NLS-1$
+
+ // private final int MSG_INDEX_CMD = 0;
+ private final int MSG_INDEX_DEVICE = 1;
+ private final int MSG_INDEX_APPID = 2;
+ private final int MSG_INDEX_APPNAME = 3;
+ private final int MSG_LENGTH = 4;
+ private final int APPNAME_LENGTH = 20;
+
private static Socket socket = null;
private int port = 0;
private static BufferedWriter writer = null;
private static boolean openWelcomeDlg = false;
private static Boolean waitingWelcomeDlg = false;
+ DADialog warning = null;
+
public void run() {
while (true) {
try {
// trace Application
private void autoStartApplication(String[] strMsg) {
- final String deviceName = new String(strMsg[1].trim());
- final String appid = new String(strMsg[2].trim());
-
- System.out.println("auto start : " + appid);
- DeviceInfo device = DACommunicator.getDeviceBySerial(deviceName);
- DACommunicator.setSelectedDevice(device);
-
- DACommunicator.getAppListFromTarget();
- AppInfo appInfo = DACommunicator.getAppInfoByAppPkgId(appid);
- if (null == appInfo) {
- System.out.println("invalid application name :" + appid);
+ if (strMsg.length < MSG_LENGTH) {
+ System.out.println("wrong message format!!");
return;
}
- final String appLabel = appInfo.getInfo(AppInfo.LABEL_INDEX);
- System.out.println("IDE recv - deviceName: " + deviceName
- + " appName : " + appLabel);
+ ToolbarArea.getInstance().setToolbarStartStopState(false);
+ final String deviceName = new String(strMsg[MSG_INDEX_DEVICE].trim());
+ final String appid = new String(strMsg[MSG_INDEX_APPID].trim());
+ final String appName = new String(strMsg[MSG_INDEX_APPNAME].trim());
if (isOpenWelcomeDlg()) {
System.out.println("Start -AutoRun Waiting...");
}
System.out.println("End - AutoRun Waiting");
}
-
+
+ System.out.println("auto start : " + appid);
+ DeviceInfo device = DACommunicator.getDeviceByName(deviceName);
+ DACommunicator.setSelectedDevice(device);
+
+ DACommunicator.getAppListFromTarget();
+ AppInfo appInfo = DACommunicator.getPkgInfoByAppPkgId(appid);
+ if (null == appInfo) {
+ Display.getDefault().syncExec(new Runnable() {
+ public void run() {
+ Shell shell = AnalyzerUtil.getWorkbenchWindow().getShell();
+ DADialog warning = new DADialog(shell, SWT.NONE);
+ String name = appName;
+ if (name.length() > APPNAME_LENGTH) {
+ name = appName.substring(0, APPNAME_LENGTH - 1) + "...";//$NON-NLS-1$
+ }
+ warning.setMessage(name + " is not supported application");
+ warning.setIcon(ImageResources.DIALOG_WARNING_ICON);
+ warning.open();
+
+ ToolbarArea.getInstance().setToolbarStartStopState(true);
+ }
+ });
+ System.out.println("invalid application name :" + appid);
+ return;
+ }
+ final String appLabel = appInfo.getInfo(AppInfo.LABEL_INDEX);
+ System.out.println("IDE recv - deviceName: " + deviceName
+ + " appName : " + appLabel);
+
Display.getDefault().syncExec(new Runnable() {
public void run() {
ToolbarArea.getInstance().setDeviceComboText(deviceName);
ToolbarArea.getInstance().startTrace();
}
});
+
DASingletonFocusManager.setFocusDA();
}
@Override
public void run() {
- MessageProcess.getInstance().run(
- DACommunicator.getSockBufferedReader());
+ MessageProcess.getInstance()
+ .run(DACommunicator.getSockBufferedReader());
}
}
import org.tizen.dynamicanalyzer.logparser.LogInserter;
import org.tizen.dynamicanalyzer.logparser.LogParser;
import org.tizen.dynamicanalyzer.sql.SqlManager;
-import org.tizen.dynamicanalyzer.ui.info.callstack.CallStackManager;
import org.tizen.dynamicanalyzer.ui.page.BaseView;
import org.tizen.dynamicanalyzer.ui.toolbar.StopLogProcessor;
import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea;
AnalyzerManager.clear();
LogParser.clear();
LogInserter.clear();
- CallStackManager.clear();
+// CallStackManager.clear();
AnalyzerManager.getWarningChecker().clear();
StopLogProcessor.clear();
SqlManager.getInstance().clear();
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.tizen.dynamicanalyzer.common.AnalyzerManager;
+import org.tizen.dynamicanalyzer.common.AnalyzerShellCommands;
import org.tizen.dynamicanalyzer.communicator.DACommunicator;
import org.tizen.dynamicanalyzer.communicator.IDECommunicator;
import org.tizen.dynamicanalyzer.logparser.LogInserter;
IDECommunicator.stopIDEcommunicatorThread();
OpenTraceInputReader.stopOpenTraceInputReader();
LogInserter.stopInsertLogThread();
-// if (DACommunicator.isDaemonAlive()) {
- DACommunicator.killDaemon();
-// }
+ DACommunicator
+ .execCommand(AnalyzerShellCommands.DACOMMAND_KILL_MANAGER);
DACommunicator.pullDaemonLog();
return null;
}
import org.tizen.dynamicanalyzer.resources.ImageResources;\r
import org.tizen.dynamicanalyzer.sql.SqlManager;\r
import org.tizen.dynamicanalyzer.ui.info.callstack.CallStackData;\r
-import org.tizen.dynamicanalyzer.ui.info.callstack.CallStackManager;\r
import org.tizen.dynamicanalyzer.ui.info.callstack.CallStackUnit;\r
import org.tizen.dynamicanalyzer.ui.page.DAPageComposite;\r
import org.tizen.dynamicanalyzer.ui.range.RangeDataManager;\r
p.getSavePath());\r
\r
if (null == pInfo || pInfo.isEmpty()) {\r
- // TODO: message box\r
- // TODO: valid check\r
System.out.println("The trace file is invalid."); //$NON-NLS-1$\r
+ createWarningDialog(AnalyzerLabels.OPEN_TRACE_PROGRESS_VERSION_INVALID_REMOVE);\r
AnalyzerUtil.executeCommand(ClearHandler.ID);\r
return null;\r
}\r
}\r
\r
ToolbarArea.getInstance().setTime(p.getLastTime());\r
+ ToolbarArea.getInstance().setDeviceComboText(p.getDevice());\r
ToolbarArea.getInstance().setAppComboText(p.getAppName());\r
ToolbarArea.getInstance().setRepalyButtonEnable(true);\r
if (AnalyzerManager.getProject().getBinaryPath().isEmpty()) {\r
long addr = Long.parseLong(splitAddrs[j]);\r
addrList.add(addr);\r
}\r
- CallStackManager.getInstance().getCallStackDataBySeqMap()\r
+ AnalyzerManager.getCallstackManager().getCallStackDataBySeqMap()\r
.put(seq, csd);\r
}\r
return isSuccess;\r
isSuccess = false;\r
}\r
\r
- HashMap<Long, CallStackUnit> apiHash = CallStackManager.getInstance()\r
- .getCallStackApiByAddrMap();\r
+ HashMap<Long, CallStackUnit> apiHash = AnalyzerManager\r
+ .getCallstackManager().getCallStackApiByAddrMap();\r
for (int i = 0; i < dbInfo.size(); i++) {\r
List<String> pInfo = dbInfo.get(i);\r
long addr = Long.parseLong(pInfo.get(0));\r
String seq = pInfo.get(ProfilingData.SEQUENCE_INDEX);\r
profiler.getProfilingDataMap().put(seq, fupData);\r
String symbol = pInfo.get(ProfilingData.KEY_INDEX);\r
- FunctionUsageProfiler.getSymbolSeqHash().put(symbol, seq);\r
+ profiler.getSymbolSeqHash().put(symbol, seq);\r
UIDataManager.getInstance().getfunctionProfilingDataChecker()\r
.addProfilingData(fupData);\r
}\r
import org.eclipse.core.commands.ExecutionException;
import org.tizen.dynamicanalyzer.common.AnalyzerManager;
import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea;
+import org.tizen.dynamicanalyzer.ui.toolbar.configuration.ConfigurationDialogValues;
import org.tizen.dynamicanalyzer.uirecorder.UIRecorderTool;
import org.tizen.dynamicanalyzer.widgets.timer.IAlarm;
import org.tizen.dynamicanalyzer.widgets.timer.TimerClock;
}
public static void setStopAlarm() {
- TimerClock timer = ToolbarArea.getInstance().getTimer();
- timer.setAlarm(stopTime, new IAlarm() {
+ if (ConfigurationDialogValues.getInstance().isAutoStop()) {
+ TimerClock timer = ToolbarArea.getInstance().getTimer();
+ timer.setAlarm(stopTime, new IAlarm() {
- @Override
- public void action() {
- ToolbarArea.getInstance().stopTrace();
- isReplay = false;
- stopTime = -1;
- }
- });
+ @Override
+ public void action() {
+ ToolbarArea.getInstance().stopTrace();
+ isReplay = false;
+ stopTime = -1;
+ }
+ });
+ }
}
}
pageId = FilePage.ID;
// }
// else {
- // TODO: pageId = NetworkPage.ID;
+ // pageId = NetworkPage.ID;
// }
} else if (id == LogCenterConstants.LOG_THREAD) {
pageId = ThreadPage.ID;
import org.tizen.dynamicanalyzer.resources.ColorResources;\r
import org.tizen.dynamicanalyzer.resources.FontResources;\r
import org.tizen.dynamicanalyzer.resources.ImageResources;\r
-import org.tizen.dynamicanalyzer.ui.info.callstack.CallStackManager;\r
import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea;\r
import org.tizen.dynamicanalyzer.ui.widgets.DADialog;\r
import org.tizen.dynamicanalyzer.ui.widgets.table.DATableDataFormat;\r
sl.setError(AnalyzerConstants.SOURCELINE_NO_SOURCELINE_DATA);\r
return sl;\r
}\r
- addr = CallStackManager.getInstance().getPCAddrBySeq(seqNum);\r
+ addr = AnalyzerManager.getCallstackManager().getPCAddrBySeq(seqNum);\r
}\r
boolean isPieBuild = AnalyzerManager.getProject().isPieBuild();\r
String baseAddr = AnalyzerManager.getProject().getBaseAddress();\r
public static final int FD_TYPE_THREAD = 2;
/* Log File */
+// public static final int FD_API_TYPE_OPEN = 0;
+// public static final int FD_API_TYPE_CLOSE = 1;
+// public static final int FD_API_TYPE_READ_START = 2;
+// public static final int FD_API_TYPE_READ_END = 3;
+// public static final int FD_API_TYPE_WRITE_START = 4;
+// public static final int FD_API_TYPE_WRITE_END = 5;
+// public static final int FD_API_TYPE_OTHERS = 6;
+
public static final int FD_API_TYPE_OPEN = 0;
public static final int FD_API_TYPE_CLOSE = 1;
public static final int FD_API_TYPE_READ_START = 2;
- public static final int FD_API_TYPE_READ_END = 3;
- public static final int FD_API_TYPE_WRITE_START = 4;
- public static final int FD_API_TYPE_WRITE_END = 5;
- public static final int FD_API_TYPE_OTHERS = 6;
+ public static final int FD_API_TYPE_READ_END = 23;
+ public static final int FD_API_TYPE_WRITE_START = 3;
+ public static final int FD_API_TYPE_WRITE_END = 35;
+ public static final int FD_API_TYPE_OTHERS = 4;
/* Log snapshot */
public static final int SNAPSHOT_IMAGE_PATH_INDEX = 12;
if (null != insertLogThread && insertLogThread.isAlive()) {
try {
sendNotify();
- insertLogThread.join();
+ insertLogThread.join(AnalyzerManager.THREAD_JOIN_WAIT_TIME);
System.out.println("insert thread join complete!!"); //$NON-NLS-1$
} catch (InterruptedException e) {
e.printStackTrace();
import org.tizen.dynamicanalyzer.model.LogCenter;
import org.tizen.dynamicanalyzer.nl.InformationViewLabels;
import org.tizen.dynamicanalyzer.project.Project;
-import org.tizen.dynamicanalyzer.ui.info.callstack.CallStackManager;
import org.tizen.dynamicanalyzer.ui.page.BaseView;
import org.tizen.dynamicanalyzer.ui.summary.profiling.FunctionUsageProfiler;
import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea;
+import org.tizen.dynamicanalyzer.uirecorder.UIRecorderPlayThread;
+import org.tizen.dynamicanalyzer.uirecorder.UIRecorderTool;
import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
import org.tizen.dynamicanalyzer.utils.ImageUtil;
import org.tizen.sdblib.SyncService;
/** thread **/
private String pid = null;
- // private String lastLogSeqNumber = CommonConstants.ZERO;
-
public static void clear() {
stopLogParser();
getLogQueue().clear();
}
try {
System.out.println("wait for log parser join");//$NON-NLS-1$
- logParser.join();
+ logParser.join(AnalyzerManager.THREAD_JOIN_WAIT_TIME);
} catch (InterruptedException e) {
e.printStackTrace();
}
String seq = slicedLog[LogCenterConstants.SEQUENCE_NUMBER_INDEX];
long seqNum = Long.parseLong(seq);
- // long lastSeqNum = Long.parseLong(lastLogSeqNumber);
- // if (lastSeqNum < seqNum) {
- // lastLogSeqNumber =
- // slicedLog[LogCenterConstants.SEQUENCE_NUMBER_INDEX];
- // }
if (id == LogCenterConstants.LOG_USER_FUNCTION) {
String apiName = slicedLog[LogCenterConstants.APINAME_INDEX];
AnalyzerManager.setBinaryStartEndAddr(start, end);
}
- if (CallStackManager.getInstance().isIrregularUserCall(
+ if (AnalyzerManager.getCallstackManager().isIrregularUserCall(
slicedLog)) {
continue;
}
pushLog(logId, slicedLog, logPack);
/* user callstack create by entry and exit */
- CallStackManager.getInstance().makeUserCallstack(
+ AnalyzerManager.getCallstackManager().makeUserCallstack(
slicedLog,
FunctionUsageProfiler.getInstance()
.getProfileDataMaker());
- } else if (id == LogCenterConstants.LOG_DEVICE
- || id == LogCenterConstants.LOG_PROFILING) {
+ } else if (id == LogCenterConstants.LOG_DEVICE) {
+ if (seqNum == 1) {
+ UIRecorderPlayThread rp = UIRecorderTool.getInstance()
+ .getPlayThead();
+ if (null != rp && rp.isAlive()) {
+ UIRecorderTool.getInstance().getPlayThead().interrupt();
+ }
+ }
+ pushLog(logId, slicedLog, logPack);
+ } else if (id == LogCenterConstants.LOG_PROFILING) {
pushLog(logId, slicedLog, logPack);
} else {
if (id == LogCenterConstants.LOG_SCREENSHOT) {
processImage(remoteImgPath, rotate);
}
pushLog(logId, slicedLog, logPack);
- CallStackManager.getInstance().makeCallstackWithoutBacktrace(
- slicedLog);
+ AnalyzerManager.getCallstackManager()
+ .makeCallstackWithoutBacktrace(slicedLog);
if (id == LogCenterConstants.LOG_RESOURCE
|| id == LogCenterConstants.LOG_MEMORY) {
AnalyzerManager.getLeakDetector().runLeakDectect(slicedLog);
}
- AnalyzerManager.getFailedChecker().check(slicedLog);
+ AnalyzerManager.getFailedChecker().check(slicedLog,
+ AnalyzerManager.getCallstackManager());
}
// set last log number
+ File.separator + AnalyzerConstants.IMAGE_FOLDER_NAME
+ File.separator + fileName;
final int angle = Integer.parseInt(rotate);
+ if (angle != 0) {
+ System.out.println("[ image rotate : " + angle + " ]");
+ }
new Thread(null, new Runnable() {
+ int count = 0;
+
@Override
public void run() {
- SyncResult res = DACommunicator.pull(from, to);
- if (null != res && SyncService.RESULT_OK == res.getCode()) {
- DACommunicator.removeCommand(from);
- /* image resizing */
- String smallImagePath = AnalyzerManager.getProject()
- .getSavePath()
- + File.separator
- + AnalyzerConstants.IMAGE_FOLDER_NAME
- + File.separator
- + AnalyzerConstants.SMALL_IMAGE_FOLDER_NAME
- + File.separator + fileName;
- ImageUtil.transform(to, to, DEFAULT_IMG_WIDTH,
- DEFAULT_IMG_HEIGHT, angle);
- if (angle == 90 || angle == 270) {
- ImageUtil.resize(to, smallImagePath, SMALL_IMG_HEIGHT,
- SMALL_IMG_WIDTH);
+ while (true && count < 5) {
+ SyncResult res = DACommunicator.pull(from, to);
+ if (null != res && SyncService.RESULT_OK == res.getCode()) {
+ DACommunicator.removeCommand(from);
+ /* image resizing */
+ String smallImagePath = AnalyzerManager.getProject()
+ .getSavePath()
+ + File.separator
+ + AnalyzerConstants.IMAGE_FOLDER_NAME
+ + File.separator
+ + AnalyzerConstants.SMALL_IMAGE_FOLDER_NAME
+ + File.separator + fileName;
+ ImageUtil.transform(to, to, DEFAULT_IMG_WIDTH,
+ DEFAULT_IMG_HEIGHT, angle);
+ if (angle == 90 || angle == 270) {
+ ImageUtil.resize(to, smallImagePath,
+ SMALL_IMG_HEIGHT, SMALL_IMG_WIDTH);
+ } else {
+ ImageUtil.resize(to, smallImagePath,
+ SMALL_IMG_WIDTH, SMALL_IMG_HEIGHT);
+ }
+
+ break;
} else {
- ImageUtil.resize(to, smallImagePath, SMALL_IMG_WIDTH,
- SMALL_IMG_HEIGHT);
+ System.out.println("Failed to get '" + from + "' file"); //$NON-NLS-1$ //$NON-NLS-2$
+ try {
+ Thread.sleep(1000);
+ count++;
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
}
- } else {
- System.out.println("Failed to get '" + from + "' file"); //$NON-NLS-1$ //$NON-NLS-2$
}
}
}, AnalyzerConstants.MESSAGE_INTERNAL_IMAGE_THREAD).start();
import org.tizen.dynamicanalyzer.ui.toolbar.StopLogProcessor;
import org.tizen.dynamicanalyzer.ui.toolbar.StopProcessManager;
import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea;
-import org.tizen.dynamicanalyzer.uirecorder.UIRecorderTool;
+import org.tizen.dynamicanalyzer.uirecorder.RecordingQueue;
+import org.tizen.dynamicanalyzer.uirecorder.UIRecorderRecordThread;
import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
import org.tizen.sdblib.SyncService;
import org.tizen.sdblib.SyncService.SyncResult;
final int MSG_BUFFER_MAX = 100;
final int MSG_BUFFER_TIMER_DELAY = 5;
final int MSG_BUFFER_TIMER_PERIOD = 1000; // 1 second
- private static int count = 0;
final int WAITING_TIME = 10;
class AddBufferTimerTask extends TimerTask {
+ private int count = 0;
+
@Override
public void run() {
if (!buffer.isEmpty()) {
public void processMessage(String message) {
// DO NOT DELETE : for debugging
- // System.out.println("count " + messageCount + ": " + message);
+// System.out.println("count " + messageCount + ": " + message);
try {
- String[] messages = message
- .split(CommonConstants.CMD_SPLIT_READ, MSG_SPLIT_SIZE);
+ String[] messages = message.split(CommonConstants.CMD_SPLIT_READ,
+ MSG_SPLIT_SIZE);
int messageIndex = Integer.parseInt(messages[MSG_ID_INDEX]);
switch (messageIndex) {
case AnalyzerConstants.MSG_TERMINATE: /* terminate : 7 */
processTerminate();
break;
+ case AnalyzerConstants.MSG_RECORD: /* terminate : 7 */
+ processRecordLog(messages[MSG_PAYLOAD_INDEX]);
+ break;
case AnalyzerConstants.MSG_DEBUG: /* debug message : 9 */
default:
// System.out.println("DA_LOG : " + message); //$NON-NLS-1$
} catch (NumberFormatException e) {
e.printStackTrace();
- } catch (IndexOutOfBoundsException e) {
- e.printStackTrace();
}
}
return name;
}
+ private void processRecordLog(final String record) {
+ RecordingQueue rq = UIRecorderRecordThread.getRecordingQueue();
+ rq.putLog(record);
+ }
+
private void processImage(final String from) {
final String fileName = getImageName(from);
final String to = AnalyzerManager.getProject().getSavePath()
}
}
} // end while()
- Display.getDefault().syncExec(new Runnable() {
+ System.out.println("Receive thread end!!");
+ Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
StopProcessManager.getInstance().stopProcessStart(
System.out
.println("### socket timeout - TODO: show this as a dialog."); //$NON-NLS-1$
- Display.getDefault().syncExec(new Runnable() {
+ Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
StopProcessManager
}
private void endingSteps() {
+ System.out.println("Ending steps!");
message = null;
DACommunicator.setRunning(false);
AnalyzerUtil.setRecordState(RecordStateSourceProvider.RECORD_READY);
});
stopTimer();
addBufferToList();
- UIRecorderTool.getInstance().stop();
System.out.println("stop log process start");//$NON-NLS-1$
StopLogProcessor.runStopLogProcessThread();
DACommunicator.closeSocket();
package org.tizen.dynamicanalyzer.model;
-import org.tizen.sdblib.IDevice;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import org.tizen.dynamicanalyzer.project.AppInfo;
+import org.tizen.sdblib.IDevice;
public class DeviceInfo {
private IDevice device;
private String selectedApplication;
+ private List<AppInfo> appInfoList = null;
+ private HashMap<String, AppInfo> appInfoHash = null;
+
public DeviceInfo(IDevice device) {
this.device = device;
+ appInfoList = new ArrayList<AppInfo>();
+ appInfoHash = new HashMap<String, AppInfo>();
}
public void setSelectedAppName(String name) {
public IDevice getIDevice() {
return device;
}
+
+ public List<AppInfo> getAppInfoList() {
+ return appInfoList;
+ }
+
+ public HashMap<String, AppInfo> getAppInfoHash() {
+ return appInfoHash;
+ }
}
public static String STOP_TRACE;
public static String SAVE_TRACE;
public static String OPEN_TRACE;
+ public static String OPEN_TRACE_TITLE;
public static String REPLAY;
+
+ public static String START_TRACE_MAC;
+ public static String STOP_TRACE_MAC;
+ public static String SAVE_TRACE_MAC;
+ public static String OPEN_TRACE_MAC;
+ public static String REPLAY_MAC;
+
public static String RANGE_PAGE;
public static String VIEW_SOURCE;
public static String SNAPSHOT_ENABLE;
public static String ABOUT;
public static String LICENSE;
public static String CONFIGURATION;
+ public static String WELCOME;
// SingletonInfoDlg.
public static String DA_WARNING;
public static String COOLBAR_AREA_TIMELINE_TOOLTIP;
public static String COOLBAR_AREA_RANGE_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;
+ public static String COOLBAR_AREA_UI_TOOLTIP_MAC;
+ public static String COOLBAR_AREA_TIMELINE_TOOLTIP_MAC;
+ public static String COOLBAR_AREA_RANGE_TOOLTIP_MAC;
+
public static String COOLBAR_AREA_CONFIGURATION_FEATURES;
public static String COOLBAR_AREA_CONFIGURATION_SETTING;
CLOSE=Close
#Toolbar button
-START_TRACE=Start trace [Ctrl + Space]
-STOP_TRACE=Stop trace [Ctrl + Space]
-SAVE_TRACE=Save trace [Ctrl + s]
-OPEN_TRACE=Open trace [Ctrl + o]
-REPLAY=Replay [Ctrl + r]
+START_TRACE=Start trace [Ctrl + G]
+STOP_TRACE=Stop trace [Ctrl + G]
+SAVE_TRACE=Save trace [Ctrl + S]
+OPEN_TRACE=Open trace [Ctrl + O]
+OPEN_TRACE_TITLE=Open trace
+REPLAY=Replay [Ctrl + P]
+
+START_TRACE_MAC=Start trace [Command + G]
+STOP_TRACE_MAC=Stop trace [Command + G]
+SAVE_TRACE_MAC=Save trace [Command + S]
+OPEN_TRACE_MAC=Open trace [Command + O]
+REPLAY_MAC=Replay [Command + P]
+
RANGE_PAGE=Range page
-VIEW_SOURCE=View source [F2]
-SNAPSHOT_ENABLE=Take snapshot [F3]
-SETTING=Settings [F6]
+VIEW_SOURCE=View source [F3]
+SNAPSHOT_ENABLE=Take snapshot
+SETTING=Settings [F2]
#Setting menu
ABOUT=About Tizen Dynamic Analyzer [F1]
LICENSE=License
CONFIGURATION=Configuration
-
+WELCOME=Welcome
# SingletonInfoDlg.
DA_WARNING=Warning
COOLBAR_AREA_SUMMARY_TOOLTIP=Summary [Ctrl + 5]
COOLBAR_AREA_RANGE_TOOLTIP=Range [Ctrl + 6]
+COOLBAR_AREA_TIMELINE_TOOLTIP_MAC=Timeline [Command + 1]
+COOLBAR_AREA_FILE_TOOLTIP_MAC=File [Command + 2]
+COOLBAR_AREA_THREAD_TOOLTIP_MAC=Thread [Command + 3]
+COOLBAR_AREA_UI_TOOLTIP_MAC=UI [Command + 4]
+COOLBAR_AREA_SUMMARY_TOOLTIP_MAC=Summary [Command + 5]
+COOLBAR_AREA_RANGE_TOOLTIP_MAC=Range [Command + 6]
+
COOLBAR_AREA_CONFIGURATION_FEATURES=Features
COOLBAR_AREA_CONFIGURATION_SETTING=Configuration
OS_WARNING=Current OS not supported. Please check your OS.
RE_TRACE_FORM_IDE=Another application is already running.
IDE_DA_COMMUNICATION_ERROR_MESSAGE=IDE connection error.
-START_TRACE_ERROR=Start trace failed.\nSee log.
+START_TRACE_ERROR=Start trace failed.
INVALID_APPLICATION=Invalid Application
STOP_PROCESS_DLG_PLEASE_WAIT=Please wait
SNAPSHOT=Snapshot
EVENT=Event
RECORDING=Recording <always on>
-DETAIL_FUNCTIONPROFILING=Shows profile of Function.
-DETAIL_ALLOCATION=Shows heap memory allocation.
-DETAIL_FILE=Shows an analysis of the file usage on the file tab and file chart in the timeLine Page.
-DETAIL_THREAD=The thread tab shows information about thread and synchronization.
-DETAIL_USERINTERFACE=The UI tab shows UI component hierarchy and UI-related function profiling.
-DETAIL_SNAPSHOT=Shows screen shots of application.
+
+DETAIL_FUNCTIONPROFILING=Shows the function profile.
+DETAIL_ALLOCATION=Shows the heap memory allocation.
+DETAIL_FILE=Shows the file usage analysis on the File tab and the file chart on the Timeline tab.
+DETAIL_THREAD=Shows information about thread and synchronization.
+DETAIL_USERINTERFACE=Shows the UI component hierarchy and UI-related function profiling.
+DETAIL_SNAPSHOT=Shows application screenshots.
DETAIL_EVENT=Shows UI events that occur on the device.
-DETAIL_RECORDING= Save profiling information for replay.
+DETAIL_RECORDING= Record profiling information for playback.
THEME=theme
-FEATURE_TABLE_TITLE=Default Analysis Features Settings
+FEATURE_TABLE_TITLE=Default Settings for Analysis Features
FEATURE_TABLE_FEATURE_EMPTY=
FEATURE_TABLE_FEATURE_NAME=Name
FEATURE_DETAIL_TITLE=Details
-SETTING_TABLE_TITLE=Appearance Setting
+SETTING_TABLE_TITLE=Appearance Settings
SETTING_WHITE=White
SETTING_BLACK=Black
-SETTING_CONFIGURATION_TITLE=Configuration Setting
-SHOW_INITIAL=Not show initial feature setting
-AUTO_STOP=Auto stop while replaying
+SETTING_CONFIGURATION_TITLE=Configuration Settings
+SHOW_INITIAL=Do not show the configuration at start-up.
+AUTO_STOP=Auto-stop while replaying
WELCONE_ASK_USE_AGAIN=Use this as the default and do not ask again.
\ No newline at end of file
public static String RANGE_CONTEXT_TITLE;
public static String RANGE_CONTEXT_SET_START;
public static String RANGE_CONTEXT_SET_END;
- public static String RANGE_CONTEXT_SET_TO_SELECTION;
+ public static String RANGE_CONTEXT_SET_FROM_SELECTION;
public static String RANGE_CONTEXT_ANALYSIS;
public static String RANGE_CONTEXT_CLEAR;
public static String RANGE_CONTEXT_EVENT_LIST;
RANGE_CONTEXT_TITLE=Range setting
RANGE_CONTEXT_SET_START=Set range start
RANGE_CONTEXT_SET_END=Set range end
-RANGE_CONTEXT_SET_TO_SELECTION=Set range to selection
+RANGE_CONTEXT_SET_FROM_SELECTION=Set range from selection
RANGE_CONTEXT_ANALYSIS=Analyze range
RANGE_CONTEXT_CLEAR=Clear Analyze range
RANGE_CONTEXT_EVENT_LIST=Event list
+++ /dev/null
-/*
- * Dynamic Analyzer
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * Jooyoul Lee <jy.exe.lee@samsung.com>
- * Juyoung Kim <j0.kim@samsung.com>
- *
- * 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.project;
-
-public class AppDesktopInfo {
- private String desktopName;
- private String name;
- private String id;
- private String execPath;
-
- public String getDesktopName() {
- return desktopName;
- }
-
- public void setDesktopName(String desktopName) {
- this.desktopName = desktopName;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getExecPath() {
- return execPath;
- }
-
- public void setExecPath(String execPath) {
- this.execPath = execPath;
- }
-
- public void setPkgId(String pkgid) {
- id = pkgid;
- }
-
- public String getPkgId() {
- return id;
- }
-}
public static final int NODISPLAY_INDEX = 8;
public static final int TASKMANAGE_INDEX = 9;
public static final int HW_ACCELERATION_INDEX = 10;
- public static final int APPINFO_SIZE = 11;
+ public static final int USER_DATA_INDEX = 11;
+ public static final int PKGINFO_SIZE = 12;
- public static final String APPTYPE_CPP = "c++";
+ public static final String APPTYPE_CPP = "c++";//$NON-NLS-1$
+ public static final String FLAG_ZERO = "0";//$NON-NLS-1$
+ public static final String FLAG_ONE = "1";//$NON-NLS-1$
- private List<String> pkginfo = new ArrayList<String>();
+ private String installTime = null;
+ public String getInstallTime() {
+ return installTime;
+ }
+
+ public void setInstallTime(String installTime) {
+ this.installTime = installTime;
+ }
+
+ private List<String> appInfo = new ArrayList<String>();
public AppInfo() {
- for (int i = 0; i < APPINFO_SIZE; i++) {
- pkginfo.add(CommonConstants.EMPTY);
+ for (int i = 0; i < PKGINFO_SIZE; i++) {
+ appInfo.add(CommonConstants.EMPTY);
}
}
public void setInfo(int index, String data) {
- pkginfo.set(index, data);
+ appInfo.set(index, data);
}
public String getInfo(int index) {
- return pkginfo.get(index);
+ return appInfo.get(index);
}
}
public static final Image TREE_OPEN = getPngImage("tree_open"); //$NON-NLS-1$\r
public static final Image TREE_FOLD = getPngImage("tree_fold"); //$NON-NLS-1$\r
public static final Image NO_IMAGE = getPngImage("empty_snapshot"); //$NON-NLS-1$\r
+ public static final Image NO_IMAGE_SMALL = getPngImage("empty_snapshot_small"); //$NON-NLS-1$\r
\r
/* score */\r
public static final Image SCORE_0 = getPngImage("score_0"); //$NON-NLS-1$\r
import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
import org.tizen.dynamicanalyzer.common.AnalyzerManager;
import org.tizen.dynamicanalyzer.handlers.ReplayTraceHandler;
+import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;
import org.tizen.dynamicanalyzer.ui.file.FilePage;
import org.tizen.dynamicanalyzer.ui.range.RangeDataManager;
import org.tizen.dynamicanalyzer.ui.range.RangePage;
public class ShortCutManager {
private static ShortCutManager instance = null;
private boolean enabled = true;
+ private int CTRL_STATE_MASK = SWT.CTRL;
+
+ public static String START_TRACE = null;
+ public static String STOP_TRACE = null;
+ public static String SAVE_TRACE = null;
+ public static String OPEN_TRACE = null;
+ public static String REPLAY = null;
+ public static String COOLBAR_AREA_FILE_TOOLTIP = null;
+ public static String COOLBAR_AREA_SUMMARY_TOOLTIP = null;
+ public static String COOLBAR_AREA_THREAD_TOOLTIP = null;
+ public static String COOLBAR_AREA_UI_TOOLTIP = null;
+ public static String COOLBAR_AREA_TIMELINE_TOOLTIP = null;
+ public static String COOLBAR_AREA_RANGE_TOOLTIP = null;
+
+ static {
+ if (AnalyzerUtil.isMac()) {
+ START_TRACE = AnalyzerLabels.START_TRACE_MAC;
+ STOP_TRACE = AnalyzerLabels.STOP_TRACE_MAC;
+ SAVE_TRACE = AnalyzerLabels.SAVE_TRACE_MAC;
+ OPEN_TRACE = AnalyzerLabels.OPEN_TRACE_MAC;
+ REPLAY = AnalyzerLabels.REPLAY_MAC;
+ COOLBAR_AREA_FILE_TOOLTIP = AnalyzerLabels.COOLBAR_AREA_FILE_TOOLTIP_MAC;
+ COOLBAR_AREA_SUMMARY_TOOLTIP = AnalyzerLabels.COOLBAR_AREA_SUMMARY_TOOLTIP_MAC;
+ COOLBAR_AREA_THREAD_TOOLTIP = AnalyzerLabels.COOLBAR_AREA_THREAD_TOOLTIP_MAC;
+ COOLBAR_AREA_UI_TOOLTIP = AnalyzerLabels.COOLBAR_AREA_UI_TOOLTIP_MAC;
+ COOLBAR_AREA_TIMELINE_TOOLTIP = AnalyzerLabels.COOLBAR_AREA_TIMELINE_TOOLTIP_MAC;
+ COOLBAR_AREA_RANGE_TOOLTIP = AnalyzerLabels.COOLBAR_AREA_RANGE_TOOLTIP_MAC;
+ } else {
+ START_TRACE = AnalyzerLabels.START_TRACE;
+ STOP_TRACE = AnalyzerLabels.STOP_TRACE;
+ SAVE_TRACE = AnalyzerLabels.SAVE_TRACE;
+ OPEN_TRACE = AnalyzerLabels.OPEN_TRACE;
+ REPLAY = AnalyzerLabels.REPLAY;
+ COOLBAR_AREA_FILE_TOOLTIP = AnalyzerLabels.COOLBAR_AREA_FILE_TOOLTIP;
+ COOLBAR_AREA_SUMMARY_TOOLTIP = AnalyzerLabels.COOLBAR_AREA_SUMMARY_TOOLTIP;
+ COOLBAR_AREA_THREAD_TOOLTIP = AnalyzerLabels.COOLBAR_AREA_THREAD_TOOLTIP;
+ COOLBAR_AREA_UI_TOOLTIP = AnalyzerLabels.COOLBAR_AREA_UI_TOOLTIP;
+ COOLBAR_AREA_TIMELINE_TOOLTIP = AnalyzerLabels.COOLBAR_AREA_TIMELINE_TOOLTIP;
+ COOLBAR_AREA_RANGE_TOOLTIP = AnalyzerLabels.COOLBAR_AREA_RANGE_TOOLTIP;
+ }
+ }
public static ShortCutManager getInstance() {
if (null == instance) {
return instance;
}
+ private ShortCutManager() {
+ if (AnalyzerUtil.isMac()) {
+ CTRL_STATE_MASK = SWT.COMMAND;
+ }
+ }
+
// for normal listener
public void handleShortCutEvent(Event event) {
if (!enabled) {
AboutDialog dialog = new AboutDialog(shell, SWT.NONE); // FIXME
dialog.open();
} else if (event.keyCode == SWT.F2) {
- System.out.println("view source toggle");
- DACustomToggleButton button = (DACustomToggleButton) ToolbarArea
- .getInstance().getButton(ToolbarArea.SOURCE_BUTTON);
- button.setToggled(!button.isToggled());
- } else if (event.keyCode == SWT.F3) {
- System.out.println("snap shot toggle");
-
- } else if (event.keyCode == SWT.F4) {
- System.out.println("range toggle");
- if (RangeDataManager.getInstance().isBeingAnalyzed()) {
- RangeDataManager.getInstance().initRange();
- } else {
- if (RangeDataManager.getInstance().isAnalyzable()) {
- RangeDataManager.getInstance().startRangeAnalysis();
- }
- }
- } else if (event.keyCode == SWT.F5) {
- System.out.println("refresh page");
- AnalyzerManager.getCurrentPage().updateView();
- } else if (event.keyCode == SWT.F6) {
System.out.println("configuration");
Shell shell = AnalyzerUtil.getWorkbenchWindow().getShell();
ConfigurationDialog dialog = new ConfigurationDialog(shell,
SWT.NONE); // FIXME
dialog.open();
+ } else if (event.keyCode == SWT.F3) {
+ System.out.println("view source toggle");
+ DACustomToggleButton button = (DACustomToggleButton) ToolbarArea
+ .getInstance().getButton(ToolbarArea.SOURCE_BUTTON);
+ button.setToggled(!button.isToggled());
}
// ctrl + number 1 ~ 6 page
- else if (event.stateMask == SWT.CTRL && event.keyCode == 49) {
+ else if (event.stateMask == CTRL_STATE_MASK && event.keyCode == 49) {
System.out.println("timeline page");
AnalyzerUtil.changePage(TimelinePage.ID);
- } else if (event.stateMask == SWT.CTRL && event.keyCode == 50) {
+ } else if (event.stateMask == CTRL_STATE_MASK && event.keyCode == 50) {
System.out.println("file page");
AnalyzerUtil.changePage(FilePage.ID);
- } else if (event.stateMask == SWT.CTRL && event.keyCode == 51) {
+ } else if (event.stateMask == CTRL_STATE_MASK && event.keyCode == 51) {
System.out.println("thread page");
AnalyzerUtil.changePage(ThreadPage.ID);
- } else if (event.stateMask == SWT.CTRL && event.keyCode == 52) {
+ } else if (event.stateMask == CTRL_STATE_MASK && event.keyCode == 52) {
System.out.println("ui page");
AnalyzerUtil.changePage(UIPage.ID);
- } else if (event.stateMask == SWT.CTRL && event.keyCode == 53) {
+ } else if (event.stateMask == CTRL_STATE_MASK && event.keyCode == 53) {
System.out.println("summary page");
AnalyzerUtil.changePage(SummaryPage.ID);
- } else if (event.stateMask == SWT.CTRL && event.keyCode == 54) {
+ } else if (event.stateMask == CTRL_STATE_MASK && event.keyCode == 54) {
System.out.println("range page");
AnalyzerUtil.changePage(RangePage.ID);
}
// ctrl + t = 116
- // 32 -> space
- else if (event.stateMask == SWT.CTRL && event.keyCode == 32) {
- System.out.println("start trace");
+ // 103 -> g
+ else if (event.stateMask == CTRL_STATE_MASK && event.keyCode == 103) {
if (!AnalyzerManager.isRunning()) {
+ System.out.println("start trace");
+ enabled = false;
+ System.out.println("start trace start");
ToolbarArea.getInstance().startTrace();
+ System.out.println("start trace end");
} else {
+ System.out.println("stop trace");
+ enabled = false;
ToolbarArea.getInstance().stopTrace();
}
}
// o
- else if (event.stateMask == SWT.CTRL && event.keyCode == 111) {
+ else if (event.stateMask == CTRL_STATE_MASK && event.keyCode == 111) {
System.out.println("open trace");
if (!AnalyzerManager.isRunning()) {
Shell shell = AnalyzerUtil.getWorkbenchWindow().getShell();
}
}
// s
- else if (event.stateMask == SWT.CTRL && event.keyCode == 115) {
+ else if (event.stateMask == CTRL_STATE_MASK && event.keyCode == 115) {
System.out.println("save trace");
if (ToolbarArea.getInstance().getButton(ToolbarArea.SAVE_BUTTON)
.isButtonEnabled()) {
}
}
}
- // r
- else if (event.stateMask == SWT.CTRL && event.keyCode == 114) {
+ // p
+ else if (event.stateMask == CTRL_STATE_MASK && event.keyCode == 112) {
System.out.println("replay ");
if (!AnalyzerManager.isRunning()) {
DACustomButton button = (DACustomButton) ToolbarArea
}
}
}
+ // r
+ else if (event.stateMask == CTRL_STATE_MASK && event.keyCode == 114) {
+ System.out.println("range ");
+ if (RangeDataManager.getInstance().isBeingAnalyzed()) {
+ RangeDataManager.getInstance().initRange();
+ } else {
+ if (RangeDataManager.getInstance().isAnalyzable()) {
+ RangeDataManager.getInstance().startRangeAnalysis();
+ }
+ }
+ }
}
public void setEnabled(boolean enabled) {
import org.tizen.dynamicanalyzer.model.LogCenter;
import org.tizen.dynamicanalyzer.project.Project;
import org.tizen.dynamicanalyzer.ui.info.callstack.CallStackData;
-import org.tizen.dynamicanalyzer.ui.info.callstack.CallStackManager;
import org.tizen.dynamicanalyzer.ui.info.callstack.CallStackUnit;
import org.tizen.dynamicanalyzer.ui.summary.failed.FailedChecker;
import org.tizen.dynamicanalyzer.ui.summary.failed.FailedData;
private Semaphore semaphore = new Semaphore(PERMIT);
private static SqlManager instance = null;
private Connection connection = null;
+
private Connection getConnection() {
Project project = AnalyzerManager.getProject();
if (null != project && !AnalyzerManager.isExit()) {
public Connection getConnection(String path) {
try {
- semaphore.acquire();
if (null != connection) {
return connection;
}
e.printStackTrace();
} catch (SQLException e) {
e.printStackTrace();
- } catch (InterruptedException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } finally {
- if (connection == null) {
- semaphore.release();
- }
}
return connection;
}
+ public void semaphoreAcquire() {
+ if (connection != null) {
+ try {
+ semaphore.acquire();
+ } catch (InterruptedException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+ }
+
public void semaphoreRelease() {
if (connection == null) {
return;
if (null == conn) {
return;
}
-
+ semaphoreAcquire();
Statement stat = conn.createStatement();
stat.executeUpdate(createDropTableQuery(lcenter.getName()));
stat.executeUpdate(createTableQuery(lcenter));
if (null == conn) {
return;
}
+ semaphoreAcquire();
Statement stat = conn.createStatement();
stat.executeUpdate(createDropTableQuery("project")); //$NON-NLS-1$
String query = "create table project (info TEXT not null)"; //$NON-NLS-1$
if (null == conn) {
return;
}
-
+ semaphoreAcquire();
DBTableManager dbManager = DBTableManager.getInstance();
Statement stat = conn.createStatement();
if (!executeUpdateCreateTable(stat,
System.out.println("failed sql inset : " + input);
return false;
}
+ semaphoreAcquire();
prep = conn.prepareStatement(query);
int dataRowSize = input.size();
for (int i = 0; i < dataRowSize; i++) {
DBTableManager.TABLE_INDEX_CALLSTACK_UNITS);
List<List<String>> insetData = new ArrayList<List<String>>();
String insertQuery = unitTableInfo.insertQuery();
- HashMap<Long, CallStackUnit> callstackMap = CallStackManager
- .getInstance().getCallStackApiByAddrMap();
+ HashMap<Long, CallStackUnit> callstackMap = AnalyzerManager
+ .getCallstackManager().getCallStackApiByAddrMap();
+ // HashMap<Long, CallStackUnit> callstackMap = CallStackManager
+ // .getInstance().getCallStackApiByAddrMap();
List<CallStackUnit> callstackUnits = new ArrayList<CallStackUnit>();
callstackUnits.addAll(callstackMap.values());
int size = callstackUnits.size();
DBTableManager.TABLE_INDEX_CALLSTACK_DATA);
List<List<String>> insetData = new ArrayList<List<String>>();
String insertQuery = callstackData.insertQuery();
- Collection<CallStackData> col = CallStackManager.getInstance()
+ // Collection<CallStackData> col = CallStackManager.getInstance()
+ // .getCallStackDataBySeqMap().values();
+ Collection<CallStackData> col = AnalyzerManager.getCallstackManager()
.getCallStackDataBySeqMap().values();
List<CallStackData> callstackDataList = new ArrayList<CallStackData>();
callstackDataList.addAll(col);
if (null == conn) {
return null;
}
-
+ semaphoreAcquire();
if (null == tableName || tableName.length() < 1) {
System.out.println("tableName is null");
return null;
stat = conn.createStatement();
rs = stat.executeQuery(query);
- if(null == rs){
+ if (null == rs) {
return null;
}
dbInfo = new ArrayList<List<String>>();
public List<String> getDetailsInfo(String path) {
List<List<String>> dbInfo = new ArrayList<List<String>>();
dbInfo = selectQuery(path, new String[] { "info" }, "project", null);//$NON-NLS-1$//$NON-NLS-2$
- if( dbInfo == null){
+ if (dbInfo == null) {
return null;
}
List<String> pInfo = new ArrayList<String>();
import org.tizen.dynamicanalyzer.widgets.contextMenu.DAContextMenuItem;
import org.tizen.dynamicanalyzer.widgets.contextMenu.DAContextMenuListener;
-public class ContextToSelectionMenuItemClickListener extends
+public class ContextFromSelectionMenuItemClickListener extends
DAContextMenuListener {
- // private DAContextMenuItem toSelectionItem;
private DAChartBoard chartBoard;
private RangeDataManager rangeDataManager = RangeDataManager.getInstance();
- public ContextToSelectionMenuItemClickListener(DAContextMenuItem item,
+ public ContextFromSelectionMenuItemClickListener(DAContextMenuItem item,
DAChartBoard board) {
- // toSelectionItem = item;
chartBoard = board;
}
@Override
public void widgetSelected(DAContextMenuItem menuItem) {
// TODO Auto-generated method stub
- // double startTime = chartBoard.getSelectionStartTime();
- // double endTime = chartBoard.getSelectionEndTime();
double startTime = ((DAChartPlotIntervalMarker) chartBoard.getMarkers()
.get(UICommonConstants.SELECTION_MARKER_INDEX)).getStartVal();
double endTime = ((DAChartPlotIntervalMarker) chartBoard.getMarkers()
-/*
- * Dynamic Analyzer
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * Sanghyun Lee <sanghyunnim.lee@samsung.com>
- * Juyoung Kim <j0.kim@samsung.com>
- *
- * 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.common;
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.eclipse.swt.widgets.Canvas;
import org.tizen.dynamicanalyzer.common.AnalyzerManager;
import org.tizen.dynamicanalyzer.common.DASelectionData;
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.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.timeline.DATimeline;
-public class TimelineChartMouseAdapter extends MouseAdapter {
+public class TimelineChartMouseEventListener extends MouseAdapter implements
+ MouseMoveListener {
private RangeDataManager rangeDataManager = RangeDataManager.getInstance();
private DAContextMenu menu;
+ private DATimeline timeline;
+ private double baseTime = TimelineConstants.NOT_INITED;
private final int SELECTION_MARKER_INDEX = 0; // FIXME
- public TimelineChartMouseAdapter(DAContextMenu menu) {
+ public TimelineChartMouseEventListener(DAContextMenu menu,
+ DATimeline timeline) {
this.menu = menu;
+ this.timeline = timeline;
}
@Override
List<DAContextMenuItem> itemList = menu.getItems();
DAContextMenuItem startItem = itemList.get(0);
DAContextMenuItem endItem = itemList.get(1);
- DAContextMenuItem toSelectionItem = itemList.get(2);
+ DAContextMenuItem fromSelectionItem = itemList.get(2);
DAContextMenuItem analysisItem = itemList.get(3);
DAContextMenuItem clearItem = itemList.get(4);
analysisItem.setButtonEnabled(rangeDataManager.isAnalyzable());
clearItem.setButtonEnabled(rangeDataManager.isBeingAnalyzed());
}
-
- if (intervalMarker.getStartVal() != intervalMarker.getEndVal())
- {
- toSelectionItem.setButtonEnabled(true);
+
+ if (intervalMarker.getStartVal() != intervalMarker.getEndVal()) {
+ fromSelectionItem.setButtonEnabled(true);
+ } else {
+ fromSelectionItem.setButtonEnabled(false);
}
if (plot instanceof DAUIEventChartPlot) {
- plot.getVisibleStartX();
if (eventTime > itemTime && eventTime < imageRightTime) {
- if (e.button == 3) {
- intervalMarker.setInterval(itemTime, itemTime);
- } else if (bShift == true
- && intervalMarker.getStartVal() != -1) {
- intervalMarker.setEndVal(eventTime);
+ 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(itemTime, eventTime);
+ baseTime = itemTime;
}
} else {
- intervalMarker.setInterval(eventTime, eventTime);
+ 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) {
- intervalMarker.setEndVal(eventTime);
+ 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();
screenshotChartPlot, chartWidget.getSeriesList(), e.x));
} else {
if (bShift == true && intervalMarker.getStartVal() != -1) {
- intervalMarker.setEndVal(eventTime);
+ if (baseTime > eventTime) {
+ intervalMarker.setStartVal(eventTime);
+ intervalMarker.setEndVal(baseTime);
+ } else {
+ intervalMarker.setStartVal(baseTime);
+ intervalMarker.setEndVal(eventTime);
+ }
} else {
intervalMarker.setInterval(eventTime, eventTime);
+ baseTime = eventTime;
}
- // intervalMarker.setInterval(eventTime, eventTime);
}
chart.redraw();
return;
}
DAChartPlotIntervalMarker intervalMarker = (DAChartPlotIntervalMarker) marker;
- // DAChartPlotTooltip tooltip = plot.getTooltip();
- //
- // if (null == tooltip) {
- // return;
- // }
- //
- // double oldYPosRatio = tooltip.getYPosRatio();
- // double newYPosRatio = (double) e.y / ((Canvas) e.widget).getSize().y;
- //
- // if (oldYPosRatio != newYPosRatio) {
- // tooltip.setYPosRatio(newYPosRatio);
- // }
- //
- // tooltip.setStartVal(getTooltipStartX(plot, chart.getSeriesList(),
- // e.x,
- // newYPosRatio));
- // tooltip.setTooltip(true);
double eventTime = plot.getXFromXPixcel(e.x);
+ double markerStartTime;
+ double markerEndTime;
- double markerStartTime = intervalMarker.getStartVal();
- double markerEndTime = eventTime;
+ if (intervalMarker.getStartVal() >= eventTime) {
+ markerStartTime = eventTime;
+ markerEndTime = intervalMarker.getEndVal();
+ } else {
+ markerStartTime = intervalMarker.getStartVal();
+ markerEndTime = eventTime;
+ }
- // if (markerStartTime > markerEndTime) {
- // double temp = markerStartTime;
- // markerStartTime = markerEndTime;
- // markerEndTime = temp;
- // }
double toolbarTime = TimelineChartManager.getInstance().getChartBoard()
.getLifecycleEndTime();
- // double toolbarTime = ToolbarArea.getInstance().getTime()
- // / TimelineConstants.MEGA +1;
+
if (markerStartTime < 0) {
markerStartTime = 0;
} else if (markerStartTime > toolbarTime) {
intervalMarker.getEndVal());
}
- // private double getTooltipStartX(DAChartPlot plot,
- // List<DAChartSeries> seriesList, int x, double yPosRatio) {
- // double ret = -1;
- // 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));
- // 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;
- // }
+ @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 oldYPosRatio = tooltip.getYPosRatio();
+ double newYPosRatio = (double) e.y / ((Canvas) e.widget).getSize().y;
+
+ if (oldYPosRatio != newYPosRatio) {
+ if (newYPosRatio < 0) {
+ newYPosRatio = 0.01;
+ } else if (newYPosRatio >= 1) {
+ newYPosRatio = 0.99;
+ }
+
+ tooltip.setYPosRatio(newYPosRatio);
+ }
+
+ double oldStartVal = tooltip.getStartVal();
+ double newStartVal = getTooltipStartX(plot, chart.getSeriesList(), e.x,
+ newYPosRatio);
+
+ if (oldStartVal != newStartVal) {
+ tooltip.setStartVal(newStartVal);
+ }
+
+ if (plot instanceof DAScreenshotChartPlot) {
+ ((DAScreenshotChartPlot) plot)
+ .setHighlightedImageIndex(getHighlightedImageIndex(e));
+ chart.redraw();
+ } else if (plot instanceof DAUIEventChartPlot) {
+ DAUIEventChartPlot uiEventChartPlot = (DAUIEventChartPlot) plot;
+ int seriesIndex = (int) (newYPosRatio * chart.getSeriesList()
+ .size());
+
+ uiEventChartPlot.setHighlightedEventIndexX(chart.getSeriesList()
+ .get(seriesIndex)
+ .getPrevIndexByXvalue(plot.getXFromXPixcel(e.x)));
+ uiEventChartPlot.setHighlightedEventIndexY(seriesIndex);
+ chart.redraw();
+ }
+
+ 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);
return TimelineConstants.NOT_INITED;
}
}
+
+ private double getTooltipStartX(DAChartPlot plot,
+ List<DAChartSeries> seriesList, int x, double yPosRatio) {
+ double ret = -1;
+ 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));
+ 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;
+ }
+
+ private int getHighlightedImageIndex(MouseEvent e) {
+ DAChart chart = (DAChart) e.widget;
+ DAChartPlot plot = chart.getPlot();
+ DAChartSeries series = chart.getSeriesList().get(0);
+
+ int index = series.getPrevIndexByXvalue(plot.getXFromXPixcel(e.x));
+ if (index < 0) {
+ return -1;
+ }
+
+ DAChartSeriesItem item = series.getSeriesItemList().get(index);
+ int screenshotWidth = item.getImage().getBounds().width;
+ if (chart.getBounds().height != DAChartBoard.DEFAULT_CHART_ZOOMIN_HEIGHT - 1) {
+ screenshotWidth /= 2;
+ }
+
+ if (e.x < plot.getXPixcelFromX(item.getX()) + screenshotWidth
+ && e.x >= plot.getXPixcelFromX(item.getX())) {
+ return index;
+ } else {
+ return -1;
+ }
+ }
}
+++ /dev/null
-/*
- * Dynamic Analyzer
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * Sanghyun Lee <sanghyunnim.lee@samsung.com>
- * Juyoung Kim <j0.kim@samsung.com>
- *
- * 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.common;
-
-import java.util.List;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.MouseMoveListener;
-import org.eclipse.swt.widgets.Canvas;
-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.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.timeline.DATimeline;
-
-public class TimelineChartMouseMoveListener implements MouseMoveListener {
- private DATimeline timeline;
- private final int SELECTION_MARKER_INDEX = 0; // FIXME
-
- public TimelineChartMouseMoveListener(DATimeline timeline) {
- this.timeline = timeline;
- }
-
- @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) {
- intervalMarker.setEndVal(plot.getXFromXPixcel(e.x));
- }
- tooltip = plot.getTooltip();
- if (null == tooltip) {
- return;
- }
-
- double oldYPosRatio = tooltip.getYPosRatio();
- double newYPosRatio = (double) e.y / ((Canvas) e.widget).getSize().y;
-
- if (oldYPosRatio != newYPosRatio) {
- if (newYPosRatio < 0) {
- newYPosRatio = 0.01;
- } else if (newYPosRatio >= 1) {
- newYPosRatio = 0.99;
- }
-
- tooltip.setYPosRatio(newYPosRatio);
- }
-
- double oldStartVal = tooltip.getStartVal();
- double newStartVal = getTooltipStartX(plot, chart.getSeriesList(), e.x,
- newYPosRatio);
-
- if (oldStartVal != newStartVal) {
- tooltip.setStartVal(newStartVal);
- }
-
- if (plot instanceof DAScreenshotChartPlot) {
- ((DAScreenshotChartPlot) plot)
- .setHighlightedImageIndex(getHighlightedImageIndex(e));
- chart.redraw();
- } else if (plot instanceof DAUIEventChartPlot) {
- DAUIEventChartPlot uiEventChartPlot = (DAUIEventChartPlot) plot;
- int seriesIndex = (int) (newYPosRatio * chart.getSeriesList()
- .size());
-
- uiEventChartPlot.setHighlightedEventIndexX(chart.getSeriesList()
- .get(seriesIndex)
- .getPrevIndexByXvalue(plot.getXFromXPixcel(e.x)));
- uiEventChartPlot.setHighlightedEventIndexY(seriesIndex);
- chart.redraw();
- }
-
- timeline.setDetailedTime(plot.getXFromXPixcel(e.x));
- timeline.setDetailedTimePosition(e.x);
- timeline.setDrawDetailedTime(true);
- timeline.redraw();
- }
-
- private double getTooltipStartX(DAChartPlot plot,
- List<DAChartSeries> seriesList, int x, double yPosRatio) {
- double ret = -1;
- 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));
- 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;
- }
-
- private int getHighlightedImageIndex(MouseEvent e) {
- DAChart chart = (DAChart) e.widget;
- DAChartPlot plot = chart.getPlot();
- DAChartSeries series = chart.getSeriesList().get(0);
-
- int index = series.getPrevIndexByXvalue(plot.getXFromXPixcel(e.x));
- if (index < 0) {
- return -1;
- }
-
- DAChartSeriesItem item = series.getSeriesItemList().get(index);
- int screenshotWidth = item.getImage().getBounds().width;
- if (chart.getBounds().height != DAChartBoard.DEFAULT_CHART_ZOOMIN_HEIGHT - 1) {
- screenshotWidth /= 2;
- }
-
- if (e.x < plot.getXPixcelFromX(item.getX()) + screenshotWidth
- && e.x >= plot.getXPixcelFromX(item.getX())) {
- return index;
- } else {
- return -1;
- }
- }
-}
import org.tizen.dynamicanalyzer.resources.ColorResources;
import org.tizen.dynamicanalyzer.ui.range.RangeDataManager;
import org.tizen.dynamicanalyzer.ui.widgets.ViewContainer;
-import org.tizen.dynamicanalyzer.ui.widgets.table.DefaultTableComparator;
import org.tizen.dynamicanalyzer.ui.widgets.table.TableColumnSizePackListener;
public class FileApiListView extends DAView {
contents.setLayout(new FillLayout());
tableComp = new FileApiListTable(contents, SWT.NONE, SWT.MULTI
| SWT.BORDER | SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL);
- tableComp.setComparator(new DefaultTableComparator());
tableComp.setSortTypes(sortTypes);
tableComp.setSourceColumns(sourceColumns);
tableComp.setColumns(columnNames);
}
public boolean isFileOpenFailed() {
- return isFailedAPI;
+ if (isParent()) {
+ this.isClosedFile = true;
+ for (int i = 0; i < children.size(); i++) {
+ if (!children.get(i).isFileOpenFailed()) {
+ return false;
+ }
+ }
+ return true;
+ } else {
+ return isFailedAPI;
+ }
}
public void setFileOpenFailed(boolean data) {
for (int i = 0; i < size; i++) {
if ((!children.get(i).isClosed(null))
&& (!children.get(i).getFD().contains("-1"))) {
- setNotAccessFileStatus();
+ setNotClosedFileStatus();
break;
}
}
} else {
if (!isClosed(event)) {
- setNotAccessFileStatus();
+ setNotClosedFileStatus();
}
}
}
}
}
- private void setNotAccessFileStatus() {
+ private void setNotClosedFileStatus() {
int nStatusLastIndex = statueSeries.getSeriesItemList().size() - 1;
if (nStatusLastIndex > -1) {
statueSeries.getSeriesItemList().get(nStatusLastIndex)
.setEventGradationForegroundColor(
ColorResources.FILE_AREA_NOT_ACCESS_START);
statueSeries.getSeriesItemList().get(nStatusLastIndex)
- .setTooltipText(FilePageLabels.FILE_CHART_TOOLTIP_CLOSED);
+ .setTooltipText(FilePageLabels.FILE_CHART_TOOLTIP_OPEND);
}
}
if (null != updateLogThread && updateLogThread.isAlive()) {
try {
sendNotify();
- updateLogThread.join();
+ updateLogThread.join(AnalyzerManager.THREAD_JOIN_WAIT_TIME);
System.out.println("file chart manager joined!"); //$NON-NLS-1$
} catch (InterruptedException e) {
e.printStackTrace();
ImageResources.TIMELINE_DROPDOWN_PUSH,
ImageResources.TIMELINE_DROPDOWN_NORMAL);
fileCombo.add(FilePageLabels.FILE_CHART_FILE);
+ fileCombo.setTextAlign(DACustomCombo.TEXT_ALIGN_CENTER);
fileCombo.select(0);
fileCombo.setEnabled(false);
fileCombo.setComboRender(new TitleComboRenderer());
/ TimelineConstants.MEGA,
rangeDataManager.getAnalysisEndTime()
/ TimelineConstants.MEGA);
+ } else {
+ ((DAChartPlotIntervalMarker) fileChart.getMarkers().get(
+ UICommonConstants.RANGE_ANALYSIS_MARKER_INDEX))
+ .setInterval(-1, -1);
}
((DAChartPlotIntervalMarker) fileChart.getMarkers().get(
private void initIntervalMarkers(DAChartBoard board) {
// selection marker
DAChartPlotIntervalMarker selectionMarker = new DAChartPlotIntervalMarker(
- -1, -1);
+ -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);
+ -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);
- rangeMarker.setBackgroundColor(ColorResources.YELLOW);
- rangeMarker.setAlpha((int) (255 * 0.10));
+ -1, -1, DAChartPlotIntervalMarker.INTERVAL_MARKER_STYLE_LINE);
+ rangeMarker.setForegroundColor(ColorResources.RED);
+ rangeMarker.setAlpha((int) (255 * 0.25));
board.addIntervalMarker(rangeMarker);
}
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.ContextToSelectionMenuItemClickListener;
-import org.tizen.dynamicanalyzer.ui.common.TimelineChartMouseAdapter;
-import org.tizen.dynamicanalyzer.ui.common.TimelineChartMouseMoveListener;
+import org.tizen.dynamicanalyzer.ui.common.TimelineChartMouseEventListener;
import org.tizen.dynamicanalyzer.ui.common.TimelineChartMouseTrackAdapter;
import org.tizen.dynamicanalyzer.ui.summary.failed.FailedChecker;
import org.tizen.dynamicanalyzer.ui.summary.failed.FailedData;
// System.out.println("wrong fd : " + fd + " input : " + input);
continue;
}
+ if (!fdApiType.equals(Integer
+ .toString(LogCenterConstants.FD_API_TYPE_OPEN))) {
+ path = AnalyzerLabels.EMPTY_STRING;
+ }
FileChartDataEvent event = new FileChartDataEvent(path, fd, time,
name, input);
endItem.addClickListener(new ContextEndMenuItemClickListener(endItem,
board));
- DAContextMenuItem toSelectionItem = new DAContextMenuItem(popupMenu);
- toSelectionItem
- .setText(TimelineChartLabels.RANGE_CONTEXT_SET_TO_SELECTION);
- toSelectionItem
- .addClickListener(new ContextToSelectionMenuItemClickListener(
- toSelectionItem, board));
+ DAContextMenuItem fromSelectionItem = new DAContextMenuItem(popupMenu);
+ fromSelectionItem
+ .setText(TimelineChartLabels.RANGE_CONTEXT_SET_FROM_SELECTION);
+ fromSelectionItem
+ .addClickListener(new ContextFromSelectionMenuItemClickListener(
+ fromSelectionItem, board));
DAContextMenuItem analysisItem = new DAContextMenuItem(popupMenu);
analysisItem.setText(TimelineChartLabels.RANGE_CONTEXT_ANALYSIS);
clearItem
.addClickListener(new ContextClearMenuItemClickListener(board));
- chart.addMouseListener(new TimelineChartMouseAdapter(popupMenu));
- chart.addMouseMoveListener(new TimelineChartMouseMoveListener(board
- .getTimeline()));
+ TimelineChartMouseEventListener timelineChartMouseEventListener = new TimelineChartMouseEventListener(
+ popupMenu, board.getTimeline());
+ chart.addMouseListener(timelineChartMouseEventListener);
+ chart.addMouseMoveListener(timelineChartMouseEventListener);
chart.addMouseTrackListener(new TimelineChartMouseTrackAdapter(board
.getTimeline()));
plot.setMarkers(board.getMarkers());
chart = item.getChart();
initFileChart(chart, false);
}
- setChartStyle(chart);
sync.setItem(item);
item.setData(sync);
chart.setData(sync);
return true;
}
- protected void setChartStyle(DAChart chart) {
- if (null == chart) {
- return;
- }
- DAChartPlot plot = chart.getPlot();
- if (null == plot) {
- return;
- }
- plot.setBackgroundImage(ImageResources.BG_GRADIENT);
- plot.setAutoHeightRange(false);
- DAChartPlotTooltip tooltip = new DAChartPlotTooltip(-1);
- tooltip.setFont(FontResources.CHART_TOOLTIP_FONT);
- plot.setTooltip(tooltip);
- plot.setAxisFont(FontResources.CHART_AXIS_FONT);
- plot.setAxisRangeY(0, 101);
- plot.setAxisRangeX(board.getVisibleStartTime(),
- board.getVisibleEndTime());
- chart.addMouseMoveListener(new TimelineChartMouseMoveListener(board
- .getTimeline()));
- chart.addMouseTrackListener(new TimelineChartMouseTrackAdapter(board
- .getTimeline()));
- }
-
private FileChartData findParent(String filePath, String fd) {
filePath = findPathHashMap.get(fd);
int size = rows.size();
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Composite;
import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;
+import org.tizen.dynamicanalyzer.shortcut.ShortCutManager;
import org.tizen.dynamicanalyzer.ui.info.callstack.CallstackView;
import org.tizen.dynamicanalyzer.ui.info.snapshot.SnapshotView;
import org.tizen.dynamicanalyzer.ui.page.DAPageComposite;
public FilePage(Composite parent, int style) {
super(parent, style);
name = AnalyzerLabels.COOLBAR_AREA_FILE;
- this.setData(DAPageComposite.KEY_TOOLTIP, AnalyzerLabels.COOLBAR_AREA_FILE_TOOLTIP);
+ this.setData(DAPageComposite.KEY_TOOLTIP, ShortCutManager.COOLBAR_AREA_FILE_TOOLTIP);
this.setLayout(new FillLayout());
baseForm = new SashForm(this, SWT.HORIZONTAL);
}
}
- private static CallStackManager instance;
- private HashMap<Long, CallStackUnit> callstackApiByAddrMap;
- private HashMap<Integer, CallStackData> callstackDataBySeqMap;
+ private HashMap<Long, CallStackUnit> callstackApiByAddrMap = new HashMap<Long, CallStackUnit>();
+ private HashMap<Integer, CallStackData> callstackDataBySeqMap = new HashMap<Integer, CallStackData>();
private String userFunctionBin = null;
- private HashMap<Integer, List<CallStackUnit>> userCallstackByTidMap;
- private HashMap<Integer, DuplicateUserCall> dupUserCallByTidMap;
-
- public static CallStackManager getInstance() {
- if (null == instance) {
- instance = new CallStackManager();
- }
- return instance;
- }
+ private HashMap<Integer, List<CallStackUnit>> userCallstackByTidMap = new HashMap<Integer, List<CallStackUnit>>();
+ private HashMap<Integer, DuplicateUserCall> dupUserCallByTidMap = new HashMap<Integer, CallStackManager.DuplicateUserCall>();
public void makeUserCallstack(String[] input, ProfileDataMaker profiler) {
HashMap<Long, CallStackUnit> addrMap = getCallStackApiByAddrMap();
addrMap.put(
LogCenterConstants.USER_FUNCTION_CALLBACK_FUNC_ADDR,
defaultCallstackUnit);
- }
- userCallstack.add(callerCallstackUnit);
+ }
+ userCallstack.add(callerCallstackUnit);
} else {
CallStackUnit callerCsa = addrMap.get(callerAddr);
if (null == callerCsa) {
if (selfCallstackUnit.getFunctionName().equals(
removeCallStackUnit.getFunctionName())) {
userCallstack.remove(size - 1);
- if(callerCallstackUnit.getFunctionName().contains(
- AnalyzerConstants.VIRTUAL_THUNK)) {
- if(callerCallstackUnit.getFunctionName().equals(
- userCallstack.get(size - 2).getFunctionName())) {
- userCallstack.remove(size - 2);
- } else {
- System.out
- .println("makeUserCallstack : [virtual thunk] EXIT caller is not the same" +
- "as top of user callstack after remove EXIT self");
+ if (size - 2 > 0) {
+ if (callerCallstackUnit.getFunctionName().contains(
+ AnalyzerConstants.VIRTUAL_THUNK)) {
+ if (callerCallstackUnit.getFunctionName().equals(
+ userCallstack.get(size - 2).getFunctionName())) {
+ userCallstack.remove(size - 2);
+ } else {
+ System.out
+ .println("makeUserCallstack : [virtual thunk] EXIT caller is not the same"
+ + "as top of user callstack after remove EXIT self");
+ }
}
}
size = userCallstack.size();
return Long.toString(addrs.get(0));
}
- public static void clear() {
- instance = null;
+ public void clear() {
+ callstackApiByAddrMap.clear();
+ callstackDataBySeqMap.clear();
+ userFunctionBin = null;
+ userCallstackByTidMap.clear();
+ dupUserCallByTidMap.clear();
}
}
public void widgetSelected(SelectionEvent e) {
AnalyzerManager.getCurrentPage().controlSelection(
DATabComposite.ID);
- GridItem[] sels = table.getSelection();
+ GridItem[] sels = table.getSelection();
if (sels.length < 0) {
return;
}
String seq = logData.get(LogCenterConstants.SEQUENCE_NUMBER_INDEX);
if (null != seq && !seq.isEmpty()) {
int seqNum = Integer.parseInt(seq);
- HashMap<Integer, CallStackData> cdMap = CallStackManager.getInstance()
- .getCallStackDataBySeqMap();
- HashMap<Long, CallStackUnit> addrMap = CallStackManager.getInstance()
- .getCallStackApiByAddrMap();
+ HashMap<Integer, CallStackData> cdMap = AnalyzerManager
+ .getCallstackManager().getCallStackDataBySeqMap();
+ HashMap<Long, CallStackUnit> addrMap = AnalyzerManager
+ .getCallstackManager().getCallStackApiByAddrMap();
if (null == cdMap || null == addrMap) {
return;
}
}
List<Long> addrs = csd.getAddrs();
- int size = addrs.size();
+ int size = addrs.size();
for (int i = 0; i < size; i++) {
CallStackUnit api = addrMap.get(addrs.get(i));
String addrInput = (addrs.get(i) == 0) ? "" : addr; //$NON-NLS-1$
gridItem.setText(1, addrInput);
-// String fName = InformationViewLables.CALLSTACK_TABLE_UNKNOWN;
String fName = api.getFunctionName();
-// if (apiData.length > 1) {
-// fName = new String(apiData[1]);
-// } else {
-// String binPath = AnalyzerManager.getProject()
-// .getBinaryPath();
-// boolean isPieBuild = AnalyzerManager.getProject()
-// .isPieBuild();
-// String baseAddr = AnalyzerManager.getProject()
-// .getBaseAddress();
-// String addrStr = Long.toString(addrs.get(i));
-// if (AnalyzerManager.isInBinaryRange(addrStr)) {
-// fName = SymbolManager.addr2func(binPath, addrStr,
-// isPieBuild, baseAddr);
-// fName = SymbolNameDemangler.nameDemangle(fName);
-// }
-// }
-
-// if (CallStackManager.getInstance().checkUserCall(path)) {
-// gridItem.setForeground(ColorResources.TITLEBAR_TEXT_COLOR);
-// }
gridItem.setText(0, fName);
gridItem.setText(2, path);
-// apiData = null;
}
}
}
+++ /dev/null
-/*
- * Dynamic Analyzer
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * Jooyoul Lee <jy.exe.lee@samsung.com>
- * Juyoung Kim <j0.kim@samsung.com>
- *
- * 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.info.snapshot;
-
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.widgets.Display;
-
-public class ImageSelectionListener implements SelectionListener {
-
- @Override
- public void widgetSelected(final SelectionEvent e) {
- Display.getDefault().syncExec(new Runnable() {
- @Override
- public void run() {
-
-// String[] data = null;
-// if (e.widget instanceof Grid) {
-// final Grid table = (Grid) e.widget;
-// GridItem[] ti = table.getSelection();
-// // get center id
-// if (null == ti || 0 == ti.length) {
-// return;
-// }
-// data = (String[]) ti[0].getData();
-// }
-
- //TODO:implements action
- }
- });
- }
-
- @Override
- public void widgetDefaultSelected(SelectionEvent e) {
- }
-
-}
package org.tizen.dynamicanalyzer.ui.info.snapshot;
import java.io.File;
-import java.util.HashMap;
import java.util.List;
import java.util.Timer;
import java.util.TimerTask;
private Image image;
private Canvas canvas;
private Canvas popup;
- private HashMap<String, ImageSelectionListener> listeners;
private Shell childShell;
private Composite parent;
int childShellWidth = 0;
canvas.setEnabled(enabled);
}
- public HashMap<String, ImageSelectionListener> getSelectionListeners() {
- if (null == listeners) {
- listeners = new HashMap<String, ImageSelectionListener>();
- }
- return listeners;
- }
-
private void setImage(Image input) {
if (input == null) {
image = null;
} else {
try {
img = new Image(Display.getDefault(), path);
+ } catch (IllegalArgumentException e) {
+ e.printStackTrace();
+ img = ImageResources.NO_IMAGE;
} catch (SWTError err) {
err.printStackTrace();
img = ImageResources.NO_IMAGE;
- } catch (Exception e) {
+ } catch (SWTException e) {
System.out.println("Wait for receiving image : " + path);//$NON-NLS-1$
img = ImageResources.NO_IMAGE;
}
+
if (img.isDisposed()) {
System.out.println("before set image : disposed"); //$NON-NLS-1$
}
private WarningChecker warningChecker = null;
private FileDataMaker fileDataMaker = null;
private ProfileDataMaker profileDataMaker = null;
+ private CallStackManager callstackManager = null;
private long markerStartTime = 0;
private long markerEndTime = 0;
failedChecker = new FailedChecker();
leakDetector = new LeakDetector();
warningChecker = new WarningChecker();
- profileDataMaker = new ProfileDataMaker();
+ callstackManager = new CallStackManager();
+ profileDataMaker = new ProfileDataMaker(callstackManager);
fileDataMaker = new FileDataMaker(failedChecker, leakDetector,
warningChecker);
leakDetector.clear();
warningChecker.clear();
profileDataMaker.clear();
+ callstackManager.clear();
}
public void initRange() {
SWT.NONE);
DATabButton rangeTab = mainTab.addView(rangePage, true, true);
rangeTab.addCloseButtonListener(new DACustomButtonClickEventListener() {
-
@Override
public void handleClickEvent(DACustomButton button) {
RangeDataManager.getInstance().initRange();
}
});
-
startRangeThread();
} else {
startRangeThread();
&& !AnalyzerManager.isBinStartEndSet()) {
AnalyzerManager.setBinaryStartEndAddr(start, end);
}
- CallStackManager.getInstance().makeUserCallstack(input,
- profileDataMaker);
+ callstackManager.makeUserCallstack(input, profileDataMaker);
}
}
/* created failed and warning/leak data */
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Composite;
import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;
+import org.tizen.dynamicanalyzer.shortcut.ShortCutManager;
import org.tizen.dynamicanalyzer.ui.info.callstack.CallstackView;
import org.tizen.dynamicanalyzer.ui.info.snapshot.SnapshotView;
import org.tizen.dynamicanalyzer.ui.page.DAPageComposite;
public RangePage(Composite parent, int style) {
super(parent, style);
name = AnalyzerLabels.COOLBAR_AREA_RANGE;
- this.setData(DAPageComposite.KEY_TOOLTIP, AnalyzerLabels.COOLBAR_AREA_RANGE_TOOLTIP);
+ this.setData(DAPageComposite.KEY_TOOLTIP, ShortCutManager.COOLBAR_AREA_RANGE_TOOLTIP);
this.setLayout(new FillLayout());
baseForm = new SashForm(this, SWT.VERTICAL);
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Composite;
import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;
+import org.tizen.dynamicanalyzer.shortcut.ShortCutManager;
import org.tizen.dynamicanalyzer.ui.info.callstack.CallstackView;
import org.tizen.dynamicanalyzer.ui.info.snapshot.SnapshotView;
import org.tizen.dynamicanalyzer.ui.page.DAPageComposite;
public SummaryPage(Composite parent, int style) {
super(parent, style);
name = AnalyzerLabels.COOLBAR_AREA_SUMMARY;
- this.setData(DAPageComposite.KEY_TOOLTIP, AnalyzerLabels.COOLBAR_AREA_SUMMARY_TOOLTIP);
+ this.setData(DAPageComposite.KEY_TOOLTIP, ShortCutManager.COOLBAR_AREA_SUMMARY_TOOLTIP);
this.setLayout(new FillLayout());
baseForm = new SashForm(this, SWT.VERTICAL);
import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
+import org.tizen.dynamicanalyzer.ui.info.callstack.CallStackManager;
import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
public class FailedChecker {
List<FailedData> failedList;
- public void check(String[] log) {
+ public void check(String[] log, CallStackManager cm) {
String logcId = log[LogCenterConstants.ID_INDEX];
int cid = Integer.parseInt(logcId);
if (cid == LogCenterConstants.LOG_MEMORY) {
if (!addr.equals("0") && !addr.equals("0x0")) { //$NON-NLS-1$ //$NON-NLS-2$
return;
}
- checkUserDefinedFunc(log);
+ checkUserDefinedFunc(log, cm);
}
if (cid == LogCenterConstants.LOG_RESOURCE) {
if (AnalyzerUtil.isInternal(log)) {
if (fdType == 0 || errno == 0) {
return;
}
- checkUserDefinedFunc(log);
+ checkUserDefinedFunc(log, cm);
}
if (cid == LogCenterConstants.LOG_USER_FUNCTION) {
// TODO : check user function error???
}
}
- private void checkUserDefinedFunc(String[] input) {
+ private void checkUserDefinedFunc(String[] input, CallStackManager cm) {
if (AnalyzerConstants.USER_CALL == AnalyzerUtil.checkUserCall(input)) {
FailedData fd = new FailedData(input);
getFailedList().add(fd);
import org.tizen.dynamicanalyzer.model.Check;
import org.tizen.dynamicanalyzer.model.LeakCheckList;
import org.tizen.dynamicanalyzer.ui.info.callstack.CallStackData;
-import org.tizen.dynamicanalyzer.ui.info.callstack.CallStackManager;
import org.tizen.dynamicanalyzer.ui.info.callstack.CallStackUnit;
public class LeakDetector {
}
private void checkUserFuncLeakData(String[] input, Check chk) {
- HashMap<Integer, CallStackData> cdMap = CallStackManager.getInstance()
+ HashMap<Integer, CallStackData> cdMap = AnalyzerManager.getCallstackManager()
.getCallStackDataBySeqMap();
// HashMap<Long, String> apiMap = LogSpliter.getCallStackApiByAddrMap();
- HashMap<Long, CallStackUnit> addrMap = CallStackManager.getInstance()
+ HashMap<Long, CallStackUnit> addrMap = AnalyzerManager.getCallstackManager()
.getCallStackApiByAddrMap();
if (null == cdMap || null == addrMap) {
.parseInt(input[LogCenterConstants.SEQUENCE_NUMBER_INDEX]);
CallStackData csd = cdMap.get(seqNum);
if (null == csd) {
- System.out.println("no callstack : "); //$NON-NLS-1$
- for (int i = 0; i < input.length; i++)
- System.out.print(input[i] + " "); //$NON-NLS-1$
- System.out.println();
+// System.out.println("no callstack "); //$NON-NLS-1$
+// for (int i = 0; i < input.length; i++)
+// {
+// System.out.print(input[i] + " "); //$NON-NLS-1$
+// }
+// System.out.println();
return;
}
List<Long> addrs = null;
CallStackUnit callerFunc = addrMap.get(addrs.get(0));
// user call
- if (CallStackManager.getInstance().isUserCall(
+ if (AnalyzerManager.getCallstackManager().isUserCall(
callerFunc.getFunctionName())) {
HashMap<String, LeakData> leaks = getLeakHash();
LeakData newLeak = new LeakData(input[chk.getKeyIndex()], input,
package org.tizen.dynamicanalyzer.ui.summary.profiling;
import java.util.ArrayList;
-import java.util.HashMap;
import java.util.List;
import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
* key: symbol(child) or file path (parent) - value : sequence num of
* profiling data. all parent and child data is in
*/
- private static HashMap<String, String> symbolSeqHash = null;
private List<List<List<String>>> sampleInputs = null;
private static Thread profiler = null;
public FunctionUsageProfiler() {
- profileDataMaker = new ProfileDataMaker();
+ profileDataMaker = new ProfileDataMaker(
+ AnalyzerManager.getCallstackManager());
}
public ProfileDataMaker getProfileDataMaker() {
return instance;
}
- public static HashMap<String, String> getSymbolSeqHash() {
- if (null == symbolSeqHash) {
- symbolSeqHash = new HashMap<String, String>();
- }
- return symbolSeqHash;
- }
-
private List<List<List<String>>> getSampleInputs() {
if (null == sampleInputs) {
sampleInputs = new ArrayList<List<List<String>>>();
if (null != profiler && profiler.isAlive()) {
try {
sendNotify();
- profiler.join();
+ profiler.join(AnalyzerManager.THREAD_JOIN_WAIT_TIME);
System.out.println("profiling thread joined!"); //$NON-NLS-1$
} catch (InterruptedException e) {
e.printStackTrace();
private CallstackTree current = null;
private int totalSampleCount = 0;
+ private CallStackManager callstackManager = null;
/**
* key: seq - value : function usage profiling data hash map all function
* usage profiling data are in this hash map
**/
private HashMap<String, ProfilingData> profilingDataMap = null;
+ private HashMap<String, String> symbolSeqHash = null;
/**
* key : seq - value : child seq list // all child lists are in this hash
private ProfilingData dependentLib = null;
private String appBinName = null;
+ public ProfileDataMaker(CallStackManager callstackManager) {
+ this.callstackManager = callstackManager;
+ }
+
public void clear() {
getProfilingDataMap().clear();
getChildListMap().clear();
dependentLib = null;
appBinName = null;
totalSampleCount = 0;
+ getSymbolSeqHash().clear();
+ }
+
+ public CallStackManager getCallstackManager() {
+ return callstackManager;
}
public String getAppBinName() {
}
public ProfilingData getProfilingDataByKey(String key) {
- String seq = FunctionUsageProfiler.getSymbolSeqHash().get(key);
+ String seq = getSymbolSeqHash().get(key);
if (null == seq) {
return null;
}
return childListMap;
}
+ public HashMap<String, String> getSymbolSeqHash() {
+ if (null == symbolSeqHash) {
+ symbolSeqHash = new HashMap<String, String>();
+ }
+ return symbolSeqHash;
+ }
+
public String getCpuRate(ProfilingData data, boolean exclusive) {
int count = 0;
double rate = 0.;
private void checkUserCall(CallStackUnit csa, ProfilingData parent,
ProfilingData pp) {
- if (CallStackManager.getInstance().checkUserCall(csa.getPath())) {
+ if (callstackManager.checkUserCall(csa.getPath())) {
if (null == appBin) {
CallStackUnit appBinCsa = new CallStackUnit(-1,
FunctionUsageProfiler.APPLICATION);
}
List<Long> addrs = makeCallstackHashAndList(sampleCallstack);
- HashMap<Long, CallStackUnit> addrMap = CallStackManager.getInstance()
+ HashMap<Long, CallStackUnit> addrMap = callstackManager
.getCallStackApiByAddrMap();
String selfAddrStr = sampleLog
.get(LogCenterConstants.PROFILING_LOG_PCADDR_INDEX);
for (int i = 0; i < addrs.size(); i++) {
CallStackUnit callstackCsa = addrMap.get(addrs.get(i));
// disable inclusive cpu time of dependent library
- if (!CallStackManager.getInstance().checkUserCall(
- callstackCsa.getPath())) {
+ if (!callstackManager.checkUserCall(callstackCsa.getPath())) {
continue;
}
}
private List<Long> makeCallstackHashAndList(List<String> callstackLog) {
- HashMap<Long, CallStackUnit> addrMap = CallStackManager.getInstance()
+ HashMap<Long, CallStackUnit> addrMap = callstackManager
.getCallStackApiByAddrMap();
List<Long> addrs = new ArrayList<Long>();
int size = callstackLog.size();
getProfilingDataMap().put(newProfilingData.getSequence(),
newProfilingData);
if (isParent) {
- FunctionUsageProfiler.getSymbolSeqHash().put(inputData.getPath(),
+ getSymbolSeqHash().put(inputData.getPath(),
newProfilingData.getSequence());
} else {
- FunctionUsageProfiler.getSymbolSeqHash().put(inputData.getSymbol(),
+ getSymbolSeqHash().put(inputData.getSymbol(),
newProfilingData.getSequence());
}
return newProfilingData;
if (null == current) {
// bug
System.out
- .println("bug found!! must debug!!!" + inputCallstackApiData.getFunctionName()); //$NON-NLS-1$
+ .println("exit without entry - range only :" + inputCallstackApiData.getFunctionName()); //$NON-NLS-1$
} else {
CallstackTree parentCt = current.getParent();
if (null != parentCt) {
import org.tizen.dynamicanalyzer.resources.ColorResources;
import org.tizen.dynamicanalyzer.ui.range.RangeDataManager;
import org.tizen.dynamicanalyzer.ui.widgets.ViewContainer;
-import org.tizen.dynamicanalyzer.ui.widgets.table.DefaultTableComparator;
import org.tizen.dynamicanalyzer.ui.widgets.table.TableColumnSizePackListener;
public class ThreadAPIListView extends DAView {
tableComp = new ThreadAPIListTable(contents, SWT.NONE, SWT.MULTI
| SWT.BORDER | SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL);
tableComp.setTableName("Thread API List");
- tableComp.setComparator(new DefaultTableComparator());
tableComp.setSortTypes(sortTypes);
tableComp.setSourceColumns(sourceColumns);
tableComp.setColumns(columnNames);
if (null != updateLogThread && updateLogThread.isAlive()) {
try {
sendNotify();
- updateLogThread.join();
+ updateLogThread.join(AnalyzerManager.THREAD_JOIN_WAIT_TIME);
System.out.println("thread chart manager joined!"); //$NON-NLS-1$
} catch (InterruptedException e) {
e.printStackTrace();
ImageResources.TIMELINE_DROPDOWN_NORMAL);
threadCombo.add("Thread");
threadCombo.add("Sync");
+ threadCombo.setTextAlign(DACustomCombo.TEXT_ALIGN_CENTER);
threadCombo.select(0);
threadCombo.setComboButtonGradation(
ColorResources.DEVICE_APPLICATION_BUTTON_NORMAL_START,
ImageResources.TIMELINE_DROPDOWN_NORMAL);
syncCombo.add("Thread");
syncCombo.add("Sync");
+ syncCombo.setTextAlign(DACustomCombo.TEXT_ALIGN_CENTER);
syncCombo.select(1);
syncCombo.setComboButtonGradation(
ColorResources.DEVICE_APPLICATION_BUTTON_NORMAL_START,
/ TimelineConstants.MEGA,
rangeDataManager.getAnalysisEndTime()
/ TimelineConstants.MEGA);
+ } else {
+ ((DAChartPlotIntervalMarker) threadChart.getMarkers().get(
+ UICommonConstants.RANGE_ANALYSIS_MARKER_INDEX))
+ .setInterval(-1, -1);
+
+ ((DAChartPlotIntervalMarker) syncChart.getMarkers().get(
+ UICommonConstants.RANGE_ANALYSIS_MARKER_INDEX))
+ .setInterval(-1, -1);
}
((DAChartPlotIntervalMarker) threadChart.getMarkers().get(
private void initIntervalMarkers(DAChartBoard board) {
// selection marker
DAChartPlotIntervalMarker selectionMarker = new DAChartPlotIntervalMarker(
- -1, -1);
+ -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);
+ -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);
- rangeMarker.setBackgroundColor(ColorResources.YELLOW);
- rangeMarker.setAlpha((int) (255 * 0.10));
+ -1, -1, DAChartPlotIntervalMarker.INTERVAL_MARKER_STYLE_LINE);
+ rangeMarker.setForegroundColor(ColorResources.RED);
+ rangeMarker.setAlpha((int) (255 * 0.25));
board.addIntervalMarker(rangeMarker);
}
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Composite;
import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;
+import org.tizen.dynamicanalyzer.shortcut.ShortCutManager;
import org.tizen.dynamicanalyzer.ui.info.callstack.CallstackView;
import org.tizen.dynamicanalyzer.ui.info.snapshot.SnapshotView;
import org.tizen.dynamicanalyzer.ui.page.DAPageComposite;
public ThreadPage(Composite parent, int style) {
super(parent, style);
name = AnalyzerLabels.COOLBAR_AREA_THREAD;
- this.setData(DAPageComposite.KEY_TOOLTIP, AnalyzerLabels.COOLBAR_AREA_THREAD_TOOLTIP);
+ this.setData(DAPageComposite.KEY_TOOLTIP, ShortCutManager.COOLBAR_AREA_THREAD_TOOLTIP);
this.setLayout(new FillLayout());
baseForm = new SashForm(this, SWT.HORIZONTAL);
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.ContextToSelectionMenuItemClickListener;
-import org.tizen.dynamicanalyzer.ui.common.TimelineChartMouseAdapter;
-import org.tizen.dynamicanalyzer.ui.common.TimelineChartMouseMoveListener;
+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;
endItem.addClickListener(new ContextEndMenuItemClickListener(endItem,
board));
- DAContextMenuItem toSelectionItem = new DAContextMenuItem(popupMenu);
- toSelectionItem
- .setText(TimelineChartLabels.RANGE_CONTEXT_SET_TO_SELECTION);
- toSelectionItem
- .addClickListener(new ContextToSelectionMenuItemClickListener(
- toSelectionItem, board));
+ DAContextMenuItem fromSelectionItem = new DAContextMenuItem(popupMenu);
+ fromSelectionItem
+ .setText(TimelineChartLabels.RANGE_CONTEXT_SET_FROM_SELECTION);
+ fromSelectionItem
+ .addClickListener(new ContextFromSelectionMenuItemClickListener(
+ fromSelectionItem, board));
DAContextMenuItem analysisItem = new DAContextMenuItem(popupMenu);
analysisItem.setText(TimelineChartLabels.RANGE_CONTEXT_ANALYSIS);
clearItem
.addClickListener(new ContextClearMenuItemClickListener(board));
- chart.addMouseListener(new TimelineChartMouseAdapter(popupMenu));
- chart.addMouseMoveListener(new TimelineChartMouseMoveListener(board
- .getTimeline()));
+ TimelineChartMouseEventListener timelineChartMouseEventListener = new TimelineChartMouseEventListener(
+ popupMenu, board.getTimeline());
+ chart.addMouseListener(timelineChartMouseEventListener);
+ chart.addMouseMoveListener(timelineChartMouseEventListener);
chart.addMouseTrackListener(new TimelineChartMouseTrackAdapter(board
.getTimeline()));
plot.setMarkers(board.getMarkers());
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.ContextToSelectionMenuItemClickListener;
-import org.tizen.dynamicanalyzer.ui.common.TimelineChartMouseAdapter;
-import org.tizen.dynamicanalyzer.ui.common.TimelineChartMouseMoveListener;
+import org.tizen.dynamicanalyzer.ui.common.TimelineChartMouseEventListener;
import org.tizen.dynamicanalyzer.ui.common.TimelineChartMouseTrackAdapter;
import org.tizen.dynamicanalyzer.ui.summary.warning.WarningCase;
import org.tizen.dynamicanalyzer.ui.summary.warning.WarningData;
endItem.addClickListener(new ContextEndMenuItemClickListener(endItem,
board));
- DAContextMenuItem toSelectionItem = new DAContextMenuItem(popupMenu);
- toSelectionItem
- .setText(TimelineChartLabels.RANGE_CONTEXT_SET_TO_SELECTION);
- toSelectionItem
- .addClickListener(new ContextToSelectionMenuItemClickListener(
- toSelectionItem, board));
+ DAContextMenuItem fromSelectionItem = new DAContextMenuItem(popupMenu);
+ fromSelectionItem
+ .setText(TimelineChartLabels.RANGE_CONTEXT_SET_FROM_SELECTION);
+ fromSelectionItem
+ .addClickListener(new ContextFromSelectionMenuItemClickListener(
+ fromSelectionItem, board));
DAContextMenuItem analysisItem = new DAContextMenuItem(popupMenu);
analysisItem.setText(TimelineChartLabels.RANGE_CONTEXT_ANALYSIS);
clearItem
.addClickListener(new ContextClearMenuItemClickListener(board));
- chart.addMouseListener(new TimelineChartMouseAdapter(popupMenu));
- chart.addMouseMoveListener(new TimelineChartMouseMoveListener(board
- .getTimeline()));
+ TimelineChartMouseEventListener timelineChartMouseEventListener = new TimelineChartMouseEventListener(
+ popupMenu, board.getTimeline());
+ chart.addMouseListener(timelineChartMouseEventListener);
+ chart.addMouseMoveListener(timelineChartMouseEventListener);
chart.addMouseTrackListener(new TimelineChartMouseTrackAdapter(board
.getTimeline()));
endItem.addClickListener(new ContextEndMenuItemClickListener(endItem,
board));
- DAContextMenuItem toSelectionItem = new DAContextMenuItem(popupMenu);
- toSelectionItem
- .setText(TimelineChartLabels.RANGE_CONTEXT_SET_TO_SELECTION);
- toSelectionItem
- .addClickListener(new ContextToSelectionMenuItemClickListener(
- toSelectionItem, board));
+ DAContextMenuItem fromSelectionItem = new DAContextMenuItem(popupMenu);
+ fromSelectionItem
+ .setText(TimelineChartLabels.RANGE_CONTEXT_SET_FROM_SELECTION);
+ fromSelectionItem
+ .addClickListener(new ContextFromSelectionMenuItemClickListener(
+ fromSelectionItem, board));
DAContextMenuItem analysisItem = new DAContextMenuItem(popupMenu);
analysisItem.setText(TimelineChartLabels.RANGE_CONTEXT_ANALYSIS);
clearItem
.addClickListener(new ContextClearMenuItemClickListener(board));
- chart.addMouseListener(new TimelineChartMouseAdapter(popupMenu));
- chart.addMouseMoveListener(new TimelineChartMouseMoveListener(board
- .getTimeline()));
+ TimelineChartMouseEventListener timelineChartMouseEventListener = new TimelineChartMouseEventListener(
+ popupMenu, board.getTimeline());
+ chart.addMouseListener(timelineChartMouseEventListener);
+ chart.addMouseMoveListener(timelineChartMouseEventListener);
chart.addMouseTrackListener(new TimelineChartMouseTrackAdapter(board
.getTimeline()));
plot.setMarkers(board.getMarkers());
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Composite;
import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;
+import org.tizen.dynamicanalyzer.shortcut.ShortCutManager;
import org.tizen.dynamicanalyzer.ui.info.callstack.CallstackView;
import org.tizen.dynamicanalyzer.ui.info.snapshot.SnapshotView;
import org.tizen.dynamicanalyzer.ui.page.DAPageComposite;
public TimelinePage(Composite parent, int style) {
super(parent, style);
name = AnalyzerLabels.COOLBAR_AREA_TIMELINE;
- this.setData(DAPageComposite.KEY_TOOLTIP, AnalyzerLabels.COOLBAR_AREA_TIMELINE_TOOLTIP);
+ this.setData(DAPageComposite.KEY_TOOLTIP, ShortCutManager.COOLBAR_AREA_TIMELINE_TOOLTIP);
this.setLayout(new FillLayout());
leftForm = new SashForm(this, SWT.HORIZONTAL);
return instance;
}
+ @Override
+ public void clear() {
+ super.clear();
+ coreSize = TimelineConstants.NOT_INITED;
+ }
+
public CPUCoreChart() {
chartType = TimelineConstants.CHART_TYPE_CPU_CORE;
probeType = LogCenterConstants.LOG_DEVICE;
import org.tizen.dynamicanalyzer.resources.ImageResources;
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.DAChartSeries;
import org.tizen.dynamicanalyzer.widgets.chart.DAChartSeriesItem;
import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoard;
private static FileChart instance = null;
private final int MIN_FDCOUNT = 5;
- private final int MIN_READ_WRITE_BYTE = 5;
+ private final int MIN_READ_WRITE_BYTE = 0;
private final int TYPE_FDCOUNT = 0;
private final int TYPE_READ = 1;
TimelineChartLabels.FILE_CHART_SERIES_NAME_READ,
DAChartSeries.SERIES_STYLE_BAR,
ColorResources.SERIESE_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);
+ 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);
-
}
@Override
DAChartBoardItem item = super.createBoardItem(board);
chart.addSeries(readSeries);
- chart.addSeries(writeSeries);
chart.addSeries(fdCountSeries);
+ chart.addSeries(writeSeries);
chart.getPlot().setAutoHeightRange(false);
chart.getPlot().setSeriesHeightRange(true);
- chart.getPlot().setShowAxis(true);
-
+ chart.getPlot().setAxisUnit("B");
+ chart.getPlot().setSecondAxisUnit("");
+ chart.getPlot().setAxisUnitType(DAChartPlot.UnitType.BINARY);
+ chart.getPlot().setShowAxis(true);
+
fdCountSeries.setEndY(maxFDCount);
readSeries.setEndY(maxReadWrite);
writeSeries.setEndY(maxReadWrite);
writeSeries.setEndY(maxReadWrite * 1.1);
}
break;
+ default:
+ System.out.println("FileChart.java : wrong file api type");//$NON-NLS-1$
}
fileDataQ.remove(0);
import org.tizen.dynamicanalyzer.resources.ImageResources;
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.DAChartSeries;
import org.tizen.dynamicanalyzer.widgets.chart.DAChartSeriesItem;
import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoard;
chart.addSeries(totalAllocationSeries);
chart.addSeries(userAllocationSeries);
-
+
chart.getPlot().setAxisUnit("B");
+ chart.getPlot().setAxisUnitType(DAChartPlot.UnitType.BINARY);
chart.getPlot().setShowAxis(true);
return item;
.get(LogCenterConstants.DEVICE_ALLOCATION_SIZE_INDEX))
- allocByte;
totalAllocationSeries
- .addSeriesItem(new DAChartSeriesItem(
- time, value, Formatter
+ .addSeriesItem(new DAChartSeriesItem(time,
+ value, Formatter
.toByteFormat(value)));
if (!isUserAllocUpdated) {
try {
size = Double.parseDouble(log
.get(LogCenterConstants.MEMORY_SIZE_INDEX));
-
+
allocByte += size;
allocationSeriesDataSetMap.put(addressString, size);
} catch (NumberFormatException ne) {
import org.tizen.dynamicanalyzer.resources.ImageResources;
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.DAChartSeries;
import org.tizen.dynamicanalyzer.widgets.chart.DAChartSeriesItem;
import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoard;
chart.addSeries(VSSMemorySeries);
chart.addSeries(RSSMemorySeries);
chart.addSeries(PSSMemorySeries);
-
+
chart.getPlot().setAxisUnit("B");
+ chart.getPlot().setAxisUnitType(DAChartPlot.UnitType.BINARY);
chart.getPlot().setShowAxis(true);
return item;
yPostion = 23;
}
- new CreateImageThread(imagePath, time, yPostion).run();
+ Thread createImageThread = new Thread(null, new CreateImageThread(
+ imagePath, time, yPostion), "small image getter thread");
+ createImageThread.start();
} catch (NumberFormatException ne) {
ne.printStackTrace();
}
public void run() {
Image image = null;
+ int count = 0;
- while (true) {
+ while (true && count < 5) {
try {
image = new Image(Display.getDefault(), imagePath);
+ break;
} catch (SWTException se) {
+ count++;
try {
Thread.sleep(1000);
- continue;
} catch (InterruptedException ie) {
- continue;
+ break;
}
}
-
- break;
}
- screenshotSeries.addSeriesItem(new DAChartSeriesItem(time,
- yPosition, image));
+ if (null != image) {
+ screenshotSeries.addSeriesItem(new DAChartSeriesItem(time,
+ yPosition, image));
+ } else {
+ screenshotSeries.addSeriesItem(new DAChartSeriesItem(time,
+ yPosition, ImageResources.NO_IMAGE_SMALL));
+ }
}
}
}
import org.tizen.dynamicanalyzer.resources.ImageResources;
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.DAChartSeries;
import org.tizen.dynamicanalyzer.widgets.chart.DAChartSeriesItem;
import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoard;
chart.addSeries(totalSeries);
chart.addSeries(systemSeries);
chart.addSeries(processSeries);
-
+
chart.getPlot().setAxisUnit("B");
+ chart.getPlot().setAxisUnitType(DAChartPlot.UnitType.BINARY);
chart.getPlot().setShowAxis(true);
return item;
import org.tizen.dynamicanalyzer.ui.common.ContextClearMenuItemClickListener;
import org.tizen.dynamicanalyzer.ui.common.ContextEndMenuItemClickListener;
import org.tizen.dynamicanalyzer.ui.common.ContextStartMenuItemClickListener;
-import org.tizen.dynamicanalyzer.ui.common.ContextToSelectionMenuItemClickListener;
+import org.tizen.dynamicanalyzer.ui.common.ContextFromSelectionMenuItemClickListener;
import org.tizen.dynamicanalyzer.ui.widgets.DAContextMenu;
import org.tizen.dynamicanalyzer.widgets.chart.DAChart;
import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlot;
endItem.addClickListener(new ContextEndMenuItemClickListener(endItem,
chartBoard));
- DAContextMenuItem toSelectionItem = new DAContextMenuItem(popupMenu);
- toSelectionItem
- .setText(TimelineChartLabels.RANGE_CONTEXT_SET_TO_SELECTION);
- toSelectionItem
- .addClickListener(new ContextToSelectionMenuItemClickListener(
- toSelectionItem, chartBoard));
+ DAContextMenuItem fromSelectionItem = new DAContextMenuItem(popupMenu);
+ fromSelectionItem
+ .setText(TimelineChartLabels.RANGE_CONTEXT_SET_FROM_SELECTION);
+ fromSelectionItem
+ .addClickListener(new ContextFromSelectionMenuItemClickListener(
+ fromSelectionItem, chartBoard));
DAContextMenuItem analysisItem = new DAContextMenuItem(popupMenu);
analysisItem.setText(TimelineChartLabels.RANGE_CONTEXT_ANALYSIS);
public class UIEventChart extends TimelineChart {
private static UIEventChart instance = null;
- private DAChartSeries keyEventSeries;
private DAChartSeries touchEventSeries;
private DAChartSeries gestureEventSeries;
private DAChartSeries orientationEventSeries;
- private final int TYPE_KEY = 1;
private final int TYPE_TOUCH = 2;
private final int TYPE_GESTURE = 3;
private final int TYPE_ORIENTATION = 4;
private final int GESTURE_TYPE_TAP = 5;
private final String NEW_LINE = CommonConstants.NEW_LINE;
- private final String KEY_UP = "up"; //$NON-NLS-1$
- private final String KEY_DOWN = "down"; //$NON-NLS-1$
private UIEventListDialog uiEventListDialog = new UIEventListDialog(
AnalyzerUtil.getWorkbenchWindow().getShell());
chartIcon = ImageResources.CHART_UI_EVENT;
addIcon = ImageResources.ADD_CHART_UI_EVENT;
- keyEventSeries = new DAChartSeries(
- TimelineChartLabels.UI_EVENT_CHART_SERIES_NAME_KEY,
- DAChartSeries.SERIES_STYLE_MULTY_CHECK_BAR,
- ColorResources.SERIES_COLOR_UI_EVENT_KEY);
touchEventSeries = new DAChartSeries(
TimelineChartLabels.UI_EVENT_CHART_SERIES_NAME_TOUCH,
DAChartSeries.SERIES_STYLE_MULTY_CHECK_BAR,
DAChartSeries.SERIES_STYLE_MULTY_CHECK_BAR,
ColorResources.SERIES_COLOR_UI_EVENT_ORIENTATION);
- keyEventSeries.setFont(FontResources.TIMELINE_UIEVENT_FONT);
touchEventSeries.setFont(FontResources.TIMELINE_UIEVENT_FONT);
gestureEventSeries.setFont(FontResources.TIMELINE_UIEVENT_FONT);
orientationEventSeries.setFont(FontResources.TIMELINE_UIEVENT_FONT);
});
item.useExpand(false);
- chart.addSeries(keyEventSeries);
chart.addSeries(touchEventSeries);
chart.addSeries(gestureEventSeries);
chart.addSeries(orientationEventSeries);
.get(LogCenterConstants.UI_EVENT_EVENT_TYPE));
String info;
switch (type) {
- case TYPE_KEY:
- String keyStatus;
- String keyName = log.get(LogCenterConstants.UI_EVENT_INFO1);
- detailType = Integer.parseInt(log
- .get(LogCenterConstants.UI_EVENT_DETAIL_TYPE));
- if (detailType == 0) {
- keyStatus = KEY_DOWN;
- } else {
- keyStatus = KEY_UP;
- }
- keyEventSeries.addSeriesItem(new DAChartSeriesItem(time, 0,
- keyName + CommonConstants.SPACE + keyStatus));
- break;
case TYPE_TOUCH:
detailType = Integer.parseInt(log
.get(LogCenterConstants.UI_EVENT_DETAIL_TYPE));
import java.util.List;
import org.tizen.dynamicanalyzer.nl.ConfigureLabels;
-import org.tizen.dynamicanalyzer.ui.common.TimelineChartMouseAdapter;
-import org.tizen.dynamicanalyzer.ui.common.TimelineChartMouseMoveListener;
+import org.tizen.dynamicanalyzer.ui.common.TimelineChartMouseEventListener;
import org.tizen.dynamicanalyzer.ui.common.TimelineChartMouseTrackAdapter;
import org.tizen.dynamicanalyzer.ui.timeline.chart.CPUChart;
import org.tizen.dynamicanalyzer.ui.timeline.chart.CPUCoreChart;
public List<TimelineChart> getSelectedChartList() {
return selectedChartList;
}
-
- public DAChartBoard getChartBoard(){
+
+ public DAChartBoard getChartBoard() {
return chartBoard;
}
chartBoard.getVisibleEndTime());
chartWidget.getPlot().setMarkers(chartBoard.getMarkers());
- chartWidget.addMouseListener(new TimelineChartMouseAdapter(
- chart.getPopupMenu()));
+ TimelineChartMouseEventListener timelineChartMouseEventListener = new TimelineChartMouseEventListener(
+ chart.getPopupMenu(), chartBoard.getTimeline());
+ chartWidget.addMouseListener(timelineChartMouseEventListener);
chartWidget
- .addMouseMoveListener(new TimelineChartMouseMoveListener(
- chartBoard.getTimeline()));
+ .addMouseMoveListener(timelineChartMouseEventListener);
chartWidget
.addMouseTrackListener(new TimelineChartMouseTrackAdapter(
chartBoard.getTimeline()));
import java.util.List;
+import org.eclipse.swt.custom.StackLayout;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.tizen.dynamicanalyzer.resources.ColorResources;
import org.tizen.dynamicanalyzer.resources.FontResources;
import org.tizen.dynamicanalyzer.ui.common.SetRangeMarkerMouseMoveListener;
-import org.tizen.dynamicanalyzer.ui.common.TimelineChartMouseAdapter;
-import org.tizen.dynamicanalyzer.ui.common.TimelineChartMouseMoveListener;
+import org.tizen.dynamicanalyzer.ui.common.TimelineChartMouseEventListener;
import org.tizen.dynamicanalyzer.ui.common.TimelineChartMouseTrackAdapter;
import org.tizen.dynamicanalyzer.ui.common.UICommonConstants;
import org.tizen.dynamicanalyzer.ui.range.RangeDataManager;
import org.tizen.dynamicanalyzer.ui.timeline.logparser.DeviceLogParser;
import org.tizen.dynamicanalyzer.ui.timeline.logparser.LifecycleLogParser;
import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea;
+import org.tizen.dynamicanalyzer.ui.widgets.ViewContainer;
import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
import org.tizen.dynamicanalyzer.widgets.chart.DAChart;
import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlotIntervalMarker;
super(parent, style);
setLayout(new FillLayout());
- chartBoard = new DAChartBoard(this, "Timeline"); //$NON-NLS-1$
+ ViewContainer viewContainer = new ViewContainer(this, false);
+
+ Composite contents = viewContainer.getContentArea();
+ contents.setBackground(ColorResources.WINDOW_BG_COLOR);
+
+ chartBoard = new DAChartBoard(contents, "Timeline"); //$NON-NLS-1$
chartBoard.setNameFont(FontResources.CHART_NAME_FONT);
timelineChartManager.setChartTimelineChartBoard(chartBoard);
chartBoard.setSelection(false);
+ StackLayout stackLayout = new StackLayout();
+ stackLayout.topControl = chartBoard;
+ contents.setLayout(stackLayout);
+
initializeCharts();
new AddChartMenuComposite(chartBoard.getTitleComp());
/ TimelineConstants.MEGA,
rangeDataManager.getAnalysisEndTime()
/ TimelineConstants.MEGA);
+ } else {
+ ((DAChartPlotIntervalMarker) chartBoard.getMarkers().get(
+ UICommonConstants.RANGE_ANALYSIS_MARKER_INDEX))
+ .setInterval(-1, -1);
}
((DAChartPlotIntervalMarker) chartBoard.getMarkers().get(
chartBoard.getVisibleEndTime());
chartWidget.getPlot().setMarkers(chartBoard.getMarkers());
- chartWidget.addMouseListener(new TimelineChartMouseAdapter(
- timelineChart.getPopupMenu()));
- chartWidget
- .addMouseMoveListener(new TimelineChartMouseMoveListener(
- chartBoard.getTimeline()));
+ TimelineChartMouseEventListener timelineChartMouseEventListener = new TimelineChartMouseEventListener(
+ timelineChart.getPopupMenu(), chartBoard.getTimeline());
+ chartWidget.addMouseListener(timelineChartMouseEventListener);
+ chartWidget.addMouseMoveListener(timelineChartMouseEventListener);
chartWidget
.addMouseTrackListener(new TimelineChartMouseTrackAdapter(
chartBoard.getTimeline()));
private void initIntervalMarkers(DAChartBoard board) {
// selection marker
DAChartPlotIntervalMarker selectionMarker = new DAChartPlotIntervalMarker(
- -1, -1);
+ -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);
+ -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);
- rangeMarker.setBackgroundColor(ColorResources.YELLOW);
- rangeMarker.setAlpha((int) (255 * 0.10));
+ -1, -1, DAChartPlotIntervalMarker.INTERVAL_MARKER_STYLE_LINE);
+ rangeMarker.setForegroundColor(ColorResources.RED);
+ rangeMarker.setAlpha((int) (255 * 0.25));
board.addIntervalMarker(rangeMarker);
}
}
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.nebula.widgets.grid.GridColumn;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.PaintEvent;
+import org.eclipse.swt.events.PaintListener;
+import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoard;
public class UIEventListDialog extends Dialog {
- static final String KEY_START_CHECK_INDEX = "start_check_index";
- static final String KEY_END_CHECK_INDEX = "end_check_index";
- static final String KEY_START_TIME = "start_time";
- static final String KEY_END_TIME = "end_time";
+ static final String KEY_START_OLD_CHECKED_ITEM = "start_old_checked_item"; //$NON-NLS-1$
+ static final String KEY_END_OLD_CHECKED_ITEM = "end_old_checked_item"; //$NON-NLS-1$
+ static final String KEY_OLD_HOVERED_ITEM = "old_hovered_item"; //$NON-NLS-1$
+ static final String KEY_OLD_HOVERED_INDEX = "old_hovered_INDEX"; //$NON-NLS-1$
+ static final String KEY_START_TIME = "start_time"; //$NON-NLS-1$
+ static final String KEY_END_TIME = "end_time"; //$NON-NLS-1$
private Shell shell;
private Shell parent;
private String[] columnNames = { TimelinePageLabels.UI_EVENT_LIST_NAME,
TimelinePageLabels.UI_EVENT_LIST_TIME,
TimelinePageLabels.UI_EVENT_LIST_SET_RANGE };
- private int[] columnSizes = { 140, 50, 110 };
+ private int[] columnSizes = { 180, 112, 140 };
private boolean[] columnVisibility = { true, true, true };
public UIEventListDialog(Shell parent) {
public int open() {
shell = new Shell(parent, SWT.APPLICATION_MODAL | SWT.DIALOG_TRIM);
shell.setText(eventType + " event list");
- shell.setSize(450, 450);
+ shell.setSize(446, 450);
shell.setLayout(new FormLayout());
Composite tableComp = new Composite(shell, SWT.NONE);
- tableComp.setBackground(ColorResources.RED);
+ tableComp
+ .setBackground(ColorResources.CONFIGURATION_TABLE_COVER_BACKGROUND_COLOR);
tableComp.setLayout(new FormLayout());
FormData data = new FormData();
data.top = new FormAttachment(0, 0);
- data.bottom = new FormAttachment(80, 0);
+ data.bottom = new FormAttachment(100, -49);
data.left = new FormAttachment(0, 0);
data.right = new FormAttachment(100, 0);
tableComp.setLayoutData(data);
uiEventListTable.getTable().setData(UIEventListDialog.KEY_END_TIME,
-1.0);
data = new FormData();
- data.top = new FormAttachment(tableComp, 0);
- data.bottom = new FormAttachment(100, 0);
- data.left = new FormAttachment(10, 0);
- data.right = new FormAttachment(90, 0);
+ data.top = new FormAttachment(tableComp, 15);
+ data.bottom = new FormAttachment(100, -15);
+ data.left = new FormAttachment(0, 6);
+ data.right = new FormAttachment(100, -6);
uiEventListTable.setLayoutData(data);
Composite buttonComp = new Composite(shell, SWT.NONE);
- buttonComp.setBackground(ColorResources.BLUE);
+ buttonComp
+ .setBackground(ColorResources.CONFIGURATION_BUTTON_COVER_BACKGROUND_COLOR);
buttonComp.setLayout(new FormLayout());
data = new FormData();
data.top = new FormAttachment(tableComp, 0);
data.height = DesignConstants.DA_BUTTON_HEIGHT;
cancelButton.setLayoutData(data);
+ buttonComp.addPaintListener(new PaintListener() {
+ @Override
+ public void paintControl(PaintEvent e) {
+ Composite comp = (Composite) e.widget;
+ Rectangle rect = comp.getClientArea();
+ e.gc.setForeground(ColorResources.DIALOG_SUNKEN_1);
+ e.gc.drawLine(rect.x, rect.y, rect.x + rect.width, rect.y);
+ e.gc.setForeground(ColorResources.DIALOG_SUNKEN_2);
+ e.gc.drawLine(rect.x, rect.y + 1, rect.x + rect.width,
+ rect.y + 1);
+ }
+ });
+
uiEventListTable.updateTable();
shell.open();
List<TableInput> inputList = new ArrayList<TableInput>();
for (DAChartSeriesItem item : seriesItemList) {
List<String> columnTexts = new ArrayList<String>();
- columnTexts.add(item.getTooltipText());
+ columnTexts.add(item.getTooltipText().split("\n")[0]);//$NON-NLS-1$
columnTexts.add(String.valueOf(item.getX()));
TableInput tableInput = new TableInput();
private int CHECK_INDEX = 2;
+ private final int buttonWidth = ImageResources.UIEVENT_DIALOG_START_SELECTED_NORMAL
+ .getBounds().width;
+
@Override
public void paint(GC gc, Object value) {
GridItem item = (GridItem) value;
int x = leftMargin;
if (getColumn() == CHECK_INDEX) {
Image buttonImage;
+ Integer data = (Integer) item
+ .getData(UIEventListDialog.KEY_OLD_HOVERED_INDEX);
if (item.getChecked(CHECK_INDEX)) {
- buttonImage = ImageResources.CHECKBOX_SELECTED;
- } else
- buttonImage = ImageResources.CHECKBOX_UNSELECTED;
- gc.drawImage(buttonImage, getStartButtonXPostion(buttonImage),
+ if (data != null && data == CHECK_INDEX) {
+ buttonImage = ImageResources.UIEVENT_DIALOG_START_SELECTED_HOVER;
+ } else {
+ buttonImage = ImageResources.UIEVENT_DIALOG_START_SELECTED_NORMAL;
+ }
+ } else {
+ if (data != null && data == CHECK_INDEX) {
+ buttonImage = ImageResources.UIEVENT_DIALOG_START_HOVER;
+ } else {
+ buttonImage = ImageResources.UIEVENT_DIALOG_START_NORMAL;
+ }
+ }
+ gc.drawImage(buttonImage, getStartButtonXPostion(),
getBounds().y + 1);
if (item.getChecked(CHECK_INDEX - 1)) {
- buttonImage = ImageResources.CHECKBOX_SELECTED;
- } else
- buttonImage = ImageResources.CHECKBOX_UNSELECTED;
- gc.drawImage(buttonImage, getEndButtonXPosition(buttonImage),
+ if (data != null && data == CHECK_INDEX - 1) {
+ buttonImage = ImageResources.UIEVENT_DIALOG_END_SELECTED_HOVER;
+ } else {
+ buttonImage = ImageResources.UIEVENT_DIALOG_END_SELECTED_NORMAL;
+ }
+ } else {
+ if (data != null && data == CHECK_INDEX - 1) {
+ buttonImage = ImageResources.UIEVENT_DIALOG_END_HOVER;
+ } else {
+ buttonImage = ImageResources.UIEVENT_DIALOG_END_NORMAL;
+ }
+ }
+ gc.drawImage(buttonImage, getEndButtonXPosition(),
getBounds().y + 1);
}
}
}
- private int getStartButtonXPostion(Image buttonImage) {
- return getBounds().x + getBounds().width / 2
- - buttonImage.getBounds().width - 2;
+ private int getStartButtonXPostion() {
+ return getBounds().x + getBounds().width / 2 - buttonWidth - 5;
}
- private int getEndButtonXPosition(Image buttonImage) {
- return getBounds().x + getBounds().width / 2 + 2;
+ private int getEndButtonXPosition() {
+ return getBounds().x + getBounds().width / 2 + 5;
}
private int getCheckBoxIndex(Point point) {
Image buttonImage;
if (point.x < getBounds().x + getBounds().width / 2) {
- buttonImage = ImageResources.CHECKBOX_SELECTED;
+ buttonImage = ImageResources.UIEVENT_DIALOG_START_NORMAL;
} else {
- buttonImage = ImageResources.CHECKBOX_UNSELECTED;
+ buttonImage = ImageResources.UIEVENT_DIALOG_END_NORMAL;
}
- if (point.x >= getStartButtonXPostion(buttonImage)
- && point.x <= getStartButtonXPostion(buttonImage)
+ if (point.x >= getStartButtonXPostion()
+ && point.x <= getStartButtonXPostion()
+ buttonImage.getBounds().width) {
return CHECK_INDEX;
- } else if (point.x >= getEndButtonXPosition(buttonImage)
- && point.x <= getEndButtonXPosition(buttonImage)
+ } else if (point.x >= getEndButtonXPosition()
+ && point.x <= getEndButtonXPosition()
+ buttonImage.getBounds().width) {
return CHECK_INDEX - 1;
} else {
public boolean notify(int event, Point point, Object value) {
if (getColumn() == CHECK_INDEX) {
- if (event == IInternalWidget.LeftMouseButtonDown) {
+ if (event == IInternalWidget.MouseMove) {
+ GridItem item = (GridItem) value;
+ int checkBoxIndex = getCheckBoxIndex(point);
+ Grid parentGrid = item.getParent();
+ GridItem oldHoveredItem = (GridItem) parentGrid
+ .getData(UIEventListDialog.KEY_OLD_HOVERED_ITEM);
+ if (oldHoveredItem != null) {
+ oldHoveredItem.setData(
+ UIEventListDialog.KEY_OLD_HOVERED_INDEX, null);
+ }
+
+ if (checkBoxIndex != -1) {
+ parentGrid.setData(UIEventListDialog.KEY_OLD_HOVERED_ITEM,
+ item);
+ item.setData(UIEventListDialog.KEY_OLD_HOVERED_INDEX,
+ checkBoxIndex);
+ }
+
+ parentGrid.redraw();
+ } else if (event == IInternalWidget.LeftMouseButtonDown) {
GridItem item = (GridItem) value;
int checkBoxIndex = getCheckBoxIndex(point);
if (checkBoxIndex != -1) {
if (checkBoxIndex == CHECK_INDEX) {
GridItem oldCheckedItem = (GridItem) parentGrid
- .getData(UIEventListDialog.KEY_START_CHECK_INDEX);
+ .getData(UIEventListDialog.KEY_START_OLD_CHECKED_ITEM);
if (oldCheckedItem != null) {
oldCheckedItem.setChecked(CHECK_INDEX, false);
}
- parentGrid.setData(
- UIEventListDialog.KEY_START_CHECK_INDEX,
- item);
+ parentGrid
+ .setData(
+ UIEventListDialog.KEY_START_OLD_CHECKED_ITEM,
+ item);
parentGrid.setData(
UIEventListDialog.KEY_START_TIME, data);
} else {
GridItem oldCheckedItem = (GridItem) parentGrid
- .getData(UIEventListDialog.KEY_END_CHECK_INDEX);
+ .getData(UIEventListDialog.KEY_END_OLD_CHECKED_ITEM);
if (oldCheckedItem != null) {
oldCheckedItem.setChecked(CHECK_INDEX - 1,
false);
}
- parentGrid
- .setData(
- UIEventListDialog.KEY_END_CHECK_INDEX,
- item);
+ parentGrid.setData(
+ UIEventListDialog.KEY_END_OLD_CHECKED_ITEM,
+ item);
parentGrid.setData(UIEventListDialog.KEY_END_TIME,
data);
Display display = PlatformUI.createDisplay();
while (!shell.isDisposed()) {
- if (!display.readAndDispatch())
+ if (!display.readAndDispatch()) {
display.sleep();
+ }
}
shell.dispose();
data = new HashMap<String, String>();
return 0;
}
- String valuestr = data.get(key);
- if(valuestr == null)
+ String valueStr = data.get(key);
+ try {
+ if (null == valueStr) {
+ return 0;
+ } else {
+ return Integer.parseInt(valueStr);
+ }
+ } catch (NumberFormatException e) {
+ e.printStackTrace();
return 0;
- else
- return Integer.parseInt(valuestr);
-// if (valuestr.equalsIgnoreCase(ConfigureLabels.ON)) {
-// return 1;
-// } else {
-// return 0;
-// }
+ }
}
public void setValue(String key, String val) {
import org.eclipse.swt.widgets.Shell;
import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
import org.tizen.dynamicanalyzer.common.AnalyzerManager;
-import org.tizen.dynamicanalyzer.common.CommonConstants;
-import org.tizen.dynamicanalyzer.common.PathManager;
import org.tizen.dynamicanalyzer.communicator.DACommunicator;
import org.tizen.dynamicanalyzer.handlers.ReplayTraceHandler;
import org.tizen.dynamicanalyzer.logparser.LogParser;
import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;
import org.tizen.dynamicanalyzer.resources.ImageResources;
import org.tizen.dynamicanalyzer.services.RecordStateSourceProvider;
+import org.tizen.dynamicanalyzer.shortcut.ShortCutManager;
import org.tizen.dynamicanalyzer.ui.file.FileChartManager;
import org.tizen.dynamicanalyzer.ui.summary.profiling.FunctionUsageProfiler;
import org.tizen.dynamicanalyzer.ui.thread.ThreadChartManager;
@Override
public void run() {
- String state = AnalyzerUtil.getRecordState();
- if (state.equals(RecordStateSourceProvider.RECORD_RECORDING)) {
+ if (AnalyzerManager.isRunning()) {
boolean isStarted = recordStart();
if (isStarted) {
if (ReplayTraceHandler.isReplay) {
ToolbarArea.getInstance()
.setStartButtonEnablement(true);
ToolbarArea.getInstance().setStartButtonToolTipText(
- AnalyzerLabels.STOP_TRACE);
+ ShortCutManager.STOP_TRACE);
ToolbarArea.getInstance().setSnapshotButtonEnablement(
true);
+ ToolbarArea.getInstance().setSettingsButtonEnablement(
+ true);
}
});
+ ShortCutManager.getInstance().setEnabled(true);
} else {
AnalyzerUtil
.setRecordState(RecordStateSourceProvider.RECORD_READY);
.getShell();
DADialog dialog = new DADialog(shell, SWT.NONE);
dialog.setIcon(ImageResources.DIALOG_WARNING_ICON);
- dialog.setMessage(AnalyzerLabels.START_TRACE_ERROR
- + PathManager.getLogPath());
+ dialog.setMessage(AnalyzerLabels.START_TRACE_ERROR);
dialog.open();
ToolbarArea.getInstance().setToolbarState(
ToolbarArea.TOOLBAR_STATE_READY);
ToolbarArea.getInstance()
.setStartButtonEnablement(true);
+ ToolbarArea.getInstance().setSettingsButtonEnablement(
+ true);
+ ShortCutManager.getInstance().setEnabled(true);
}
});
}
ToolbarArea.getInstance().setToolbarState(
ToolbarArea.TOOLBAR_STATE_RECORDING);
ToolbarArea.getInstance().setStartButtonEnablement(false);
+ ToolbarArea.getInstance().setSettingsButtonEnablement(false);
}
});
AnalyzerManager.initRecordStart();
- if (!DACommunicator.connect()) {
+
+ if (!DACommunicator.connectionProcess()) {
System.out.println("failed to connect the device.");//$NON-NLS-1$
Display.getDefault().syncExec(new Runnable() {
@Override
public void run() {
ToolbarArea.getInstance().setStartButtonEnablement(true);
- ToolbarArea.getInstance().setSnapshotButtonEnablement(true);
+ ToolbarArea.getInstance().setSettingsButtonEnablement(true);
+ // ToolbarArea.getInstance().setSnapshotButtonEnablement(true);
}
});
return false;
}
if (!AnalyzerManager.isExit()) {
+ if (!DACommunicator.sendStartMessage()) {
+ DACommunicator.setRunning(false);
+ return false;
+ }
UIRecorderTool.getInstance().startRecorder();
- DACommunicator.sendStartMessage();
ToolbarArea.getInstance().startTimer();
LogParser.startLogParser();
FileChartManager.getInstance().startUpdateLogThread();
/* Timeline */
UpdateViewTimer.start();
+ System.out
+ .println("Start recorder, timer, log parser, file, thread, ui, profile , update timer");
return true;
}
ToolbarArea.getInstance().setToolbarState(
ToolbarArea.TOOLBAR_STATE_READY);
ToolbarArea.getInstance().setStartButtonEnablement(false);
+ ToolbarArea.getInstance().setSettingsButtonEnablement(false);
StopProcessManager.getInstance().stopProcessStart(
AnalyzerLabels.STOP_PROCESS_DLG_SUMMARIZING_DATA);
}
});
DACommunicator.sendStopMessage();
-// if (DACommunicator.isRunning()) {
-// String message = AnalyzerConstants.MSG_STOP
-// + CommonConstants.CMD_SPLIT + 0 + CommonConstants.CMD_SPLIT;
-// DACommunicator.sendMessage(message);
-// System.out.println("stop send message :" + message);
-// }
}
}
--- /dev/null
+package org.tizen.dynamicanalyzer.ui.toolbar;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.tizen.dynamicanalyzer.common.AnalyzerManager;
+import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;
+import org.tizen.dynamicanalyzer.ui.widgets.ProgressDialog;
+import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
+
+public class StartProcessManager implements Runnable {
+ private static ProgressDialog dialog = null;
+ private static int count = 1;
+
+ private static StartProcessManager instance = new StartProcessManager();
+
+ public static StartProcessManager getInstance() {
+ return instance;
+ }
+
+ public void startProcessStart(String waitMessage) {
+ Shell shell = AnalyzerUtil.getWorkbenchWindow().getShell();
+ dialog = new ProgressDialog(shell, SWT.APPLICATION_MODAL);
+ if (null != dialog) {
+ dialog.open();
+ dialog.setProgressMessage(waitMessage);
+ dialog.setProgressInfo(AnalyzerLabels.STOP_PROCESS_DLG_PLEASE_WAIT);
+ }
+
+ Thread thread = new Thread(new StartProcessManager());
+ thread.start();
+ }
+
+ public void setValue(final int nSelect) {
+
+ if (null != dialog) {
+ Display.getDefault().syncExec(new Runnable() {
+ @Override
+ public void run() {
+ dialog.setValue(nSelect);
+ }
+ });
+ }
+ }
+
+ public void stopProgress() {
+ if (null != dialog) {
+ dialog.setValue(100);
+ dialog.close();
+ }
+ }
+
+ @Override
+ public void run() {
+ count = 10;
+ System.out.println("appinfo : " + AnalyzerManager.isAppInfoArrived()
+ + "is exit :" + AnalyzerManager.isExit());
+ while (!AnalyzerManager.isExit()) {
+
+ if (AnalyzerManager.isRunning()
+ && AnalyzerManager.isAppInfoArrived()) {
+ break;
+ }
+ count += 2;
+
+ if (count > 50 && !AnalyzerManager.isRunning()) {
+ break;
+ } else if (count / 10 < 99) {
+ Display.getDefault().syncExec(new Runnable() {
+ @Override
+ public void run() {
+ dialog.setValue(count / 10);
+ }
+ });
+ }
+
+ try {
+ Thread.sleep(100);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ Display.getDefault().syncExec(new Runnable() {
+ @Override
+ public void run() {
+ stopProgress();
+ }
+ });
+
+ }
+}
import org.eclipse.swt.widgets.Display;
import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
import org.tizen.dynamicanalyzer.common.AnalyzerManager;
+import org.tizen.dynamicanalyzer.communicator.DACommunicator;
import org.tizen.dynamicanalyzer.logparser.LogInserter;
import org.tizen.dynamicanalyzer.logparser.LogParser;
import org.tizen.dynamicanalyzer.project.Project;
import org.tizen.dynamicanalyzer.ui.summary.profiling.FunctionUsageProfiler;
import org.tizen.dynamicanalyzer.ui.thread.ThreadChartManager;
import org.tizen.dynamicanalyzer.ui.userinterface.UIDataManager;
+import org.tizen.dynamicanalyzer.uirecorder.UIRecorderTool;
import org.tizen.dynamicanalyzer.utils.UpdateViewTimer;
public class StopLogProcessor implements Runnable {
FileChartManager.getInstance().stopUpdateLogThread();
percent += 10;
StopProcessManager.getInstance().setValue(percent);
-
+
ThreadChartManager.getInstance().stopUpdateLogThread();
FunctionUsageProfiler.stopProfiler();
percent += 10;
StopProcessManager.getInstance().setValue(percent);
+ System.out.println("record thread stop");
+ UIRecorderTool.getInstance().stop();
+ percent += 10;
+ StopProcessManager.getInstance().setValue(percent);
+
+ int exitCount = 0;
+ while (DACommunicator.isWaitControlMessage() && exitCount < 60) {
+ System.out.println("wait for control ack message...");
+ try {
+ Thread.sleep(100);
+ exitCount++;
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
/* save Project */
System.out.println(" save project and others..."); //$NON-NLS-1$
public void run() {
ToolbarArea.getInstance().setStartButtonEnablement(true);
ToolbarArea.getInstance().setMainControlEnablement(true);
+ ToolbarArea.getInstance().setSettingsButtonEnablement(true);
}
});
count--;
import org.eclipse.swt.widgets.Shell;
import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;
import org.tizen.dynamicanalyzer.services.RecordStateSourceProvider;
+import org.tizen.dynamicanalyzer.shortcut.ShortCutManager;
import org.tizen.dynamicanalyzer.ui.summary.SummaryPage;
import org.tizen.dynamicanalyzer.ui.widgets.ProgressDialog;
import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
return instance;
}
- public void stopProcessStart(String EndMessage) {
+ public void stopProcessStart(String endMessage) {
if (state == STOP_PROCESS_START || state == STOP_PROCESS_END) {
return;
}
dialog = new ProgressDialog(shell, SWT.APPLICATION_MODAL);
if (null != dialog) {
dialog.open();
- dialog.setProgressMessage(EndMessage);
+ dialog.setProgressMessage(endMessage);
dialog.setProgressInfo(AnalyzerLabels.STOP_PROCESS_DLG_PLEASE_WAIT);
}
}
dialog.close();
state = STOP_PROCESS_END;
}
+ ShortCutManager.getInstance().setEnabled(true);
}
public int getState() {
package org.tizen.dynamicanalyzer.ui.toolbar;
+import java.io.File;
import java.util.HashMap;
import java.util.List;
import org.tizen.dynamicanalyzer.resources.FontResources;
import org.tizen.dynamicanalyzer.resources.ImageResources;
import org.tizen.dynamicanalyzer.services.RecordStateSourceProvider;
+import org.tizen.dynamicanalyzer.shortcut.ShortCutManager;
import org.tizen.dynamicanalyzer.ui.timeline.TimelinePage;
import org.tizen.dynamicanalyzer.ui.toolbar.configuration.ConfigurationDialog;
import org.tizen.dynamicanalyzer.ui.toolbar.opentrace.OpenTraceDialog;
import org.tizen.dynamicanalyzer.ui.widgets.DADialog;
import org.tizen.dynamicanalyzer.ui.widgets.TitleComboPopupRenderer;
import org.tizen.dynamicanalyzer.ui.widgets.TitleComboRenderer;
+import org.tizen.dynamicanalyzer.uirecorder.RecorderXml;
import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
import org.tizen.dynamicanalyzer.widgets.button.DACustomButton;
import org.tizen.dynamicanalyzer.widgets.button.DACustomButtonClickEventListener;
}
public int setCursor(int oldStyle, int newStyle) {
- if (oldStyle == newStyle)
+ if (oldStyle == newStyle) {
return newStyle;
- if (null != cursor)
+ }
+ if (null != cursor) {
cursor.dispose();
+ }
cursor = new Cursor(null, newStyle);
shell.setCursor(cursor);
return newStyle;
@Override
public void run() {
Project p = AnalyzerManager.getProject();
- if (null == p || !enabled) {
+ if (null == p || !p.isValid() || !enabled) {
+ replayButton.setButtonEnabled(false);
+ return;
+ }
+
+ if (!checkRecordFile(p)) {
replayButton.setButtonEnabled(false);
return;
}
+ String device = deviceCombo.getText();
+ String deviceName = p.getDevice();
String appName = p.getAppName();
String text = appCombo.getText();
- if (null != appName && !appName.isEmpty() && !text.isEmpty()
- && appName.equals(text)) {
+ if ((null != deviceName && !deviceName.isEmpty()
+ && !device.isEmpty() && deviceName.equals(device))
+ && (null != appName && !appName.isEmpty()
+ && !text.isEmpty() && appName.equals(text))) {
replayButton.setButtonEnabled(true);
return;
}
});
}
+ private boolean checkRecordFile(Project p) {
+ String path = p.getSavePath() + RecorderXml.xmlFileName;
+ File file = new File(path);
+ if (file.exists()) {
+ return true;
+ }
+ return false;
+ }
+
private void addToolbarListeners() {
deviceCombo.addSelectionListener(new DACustomComboSelectionListener() {
String appName = combo.getText();
if (null != appName && !appName.isEmpty()) {
AppInfo selectedApp = DACommunicator
- .getAppInfoByName(appName);
+ .getPkgInfoByName(appName);
if (null != selectedApp) {
DACommunicator.setSelectedApp(selectedApp);
@Override
public void handleEvent(Event event) {
if (!appCombo.isChildShellOpened()) {
- List<AppInfo> apps = DACommunicator
- .getAppListFromTarget();
+ List<AppInfo> apps = DACommunicator.getAppListFromTarget();
if (apps.isEmpty()) {
return;
}
appCombo.initCombo();
int size = apps.size();
for (int i = 0; i < size; i++) {
- appCombo.add(apps.get(i).getInfo(
- AppInfo.LABEL_INDEX));
+ appCombo.add(apps.get(i).getInfo(AppInfo.LABEL_INDEX));
}
appCombo.setText(selectedApp);
}
public void handleClickEvent(DACustomButton button) {
// TODO : use for test code...
+ // DACommunicator.getLocalhost();
+ // System.out.println(CommonConstants.LOCAL_HOST);
+
/** for disconnect test **/
// DACommunicator.testDisConnected();
ConfigureLabels.SNAPSHOT, CommonConstants.ON);
} else {
DACommunicator
+ .sendSnapshotMessage(AnalyzerConstants.OPT_OFF);
+ DACommunicator
.sendSnapshotMessage(AnalyzerConstants.SNAPSHOT_OFF);
ConfigureManager.getInstance().setValue(
ConfigureLabels.SNAPSHOT, CommonConstants.OFF);
}
public void startTrace() {
+ ShortCutManager.getInstance().setEnabled(false);
+ Display.getDefault().syncExec(new Runnable() {
+ @Override
+ public void run() {
+ StartProcessManager.getInstance().startProcessStart(
+ "Prepare trace");
+ }
+ });
if (!checkValidApplication()) {
// fail message box
Shell shell = AnalyzerUtil.getWorkbenchWindow().getShell();
warning.setMessage(AnalyzerLabels.INVALID_APPLICATION);
warning.setIcon(ImageResources.DIALOG_WARNING_ICON);
warning.open();
+
+ setToolbarStartStopState(true);
+
+ if (null == DACommunicator.getDevices()
+ || DACommunicator.getDevices().isEmpty()) {
+ deviceCombo.setEnabled(false);
+ }
+
+ if (!deviceCombo.isEnabled()
+ || null == DACommunicator.getSelectedDevice()) {
+ appCombo.setEnabled(false);
+ }
+
+ if (!appCombo.isEnabled()
+ || null == DACommunicator.getSelectedApp()) {
+ setStartButtonEnablement(false);
+ }
+
+ setSaveButtonEnable(false);
+
+ ShortCutManager.getInstance().setEnabled(true);
return;
}
AnalyzerUtil.changePage(TimelinePage.ID);
}
public void stopTrace() {
+ ShortCutManager.getInstance().setEnabled(false);
AnalyzerManager.getProject().setStopTime(getTime());
AnalyzerUtil.setRecordState(RecordStateSourceProvider.RECORD_READY);
RecordStartStopThread.runStartStopThread();
ImageResources.START_PUSH, ImageResources.START_HOVER,
ImageResources.START_DISABLE);
startButton.setButtonEnabled(false);
- startButton.setToolTipText(AnalyzerLabels.START_TRACE);
+ startButton.setToolTipText(ShortCutManager.START_TRACE);
buttons.put(START_BUTTON, startButton);
// Creates TimerClock widget.
ImageResources.SAVE_PUSH, ImageResources.SAVE_HOVER,
ImageResources.SAVE_DISABLE);
saveTraceButton.setButtonEnabled(false);
- saveTraceButton.setToolTipText(AnalyzerLabels.SAVE_TRACE);
+ saveTraceButton.setToolTipText(ShortCutManager.SAVE_TRACE);
buttons.put(SAVE_BUTTON, saveTraceButton);
// // Creates open trace button.
openTraceButton = new DACustomButton(parent, ImageResources.OPEN,
ImageResources.OPEN_PUSH, ImageResources.OPEN_HOVER,
ImageResources.OPEN_DISABLE);
- openTraceButton.setToolTipText(AnalyzerLabels.OPEN_TRACE);
+ openTraceButton.setToolTipText(ShortCutManager.OPEN_TRACE);
buttons.put(OPEN_BUTTON, openTraceButton);
// Creates replay button.
replayButton = new DACustomButton(parent, ImageResources.REPLAY,
ImageResources.REPLAY_PUSH, ImageResources.REPLAY_HOVER,
ImageResources.REPLAY_DISABLE);
- replayButton.setToolTipText(AnalyzerLabels.REPLAY);
+ replayButton.setToolTipText(ShortCutManager.REPLAY);
buttons.put(REPLAY_BUTTON, replayButton);
// Creates setting button
data = new FormData();
data.top = new FormAttachment(0, 4);
data.left = new FormAttachment(openTraceButton, 0, SWT.RIGHT);
- data.width = 31;
+ data.width = 31; // 31
data.height = 30;
replayButton.setLayoutData(data);
data = new FormData();
data.top = new FormAttachment(0, 4);
data.right = new FormAttachment(viewSourceButton, 0);
- data.width = 0;
- data.height = 0;
+ data.width = 0; // 31
+ data.height = 30;
snapshotButton.setLayoutData(data);
/** device and application combo */
}
appCombo.setEnabled(true);
List<AppInfo> apps = DACommunicator.getAppListFromTarget();
- if (apps.isEmpty()) {
- return;
- }
appCombo.initCombo();
int size = apps.size();
DACommunicator.getSelectedDevice().setSelectedAppName(
apps.get(0).getInfo(AppInfo.LABEL_INDEX));
} else {
- AppInfo appInfo = DACommunicator.getAppInfoByName(appName);
+ AppInfo appInfo = DACommunicator.getPkgInfoByName(appName);
appCombo.setText(appName);
setSelectedApp(appInfo);
DACommunicator.setSelectedApp(appInfo);
+ DACommunicator.getSelectedDevice().setSelectedAppName(
+ appInfo.getInfo(AppInfo.LABEL_INDEX));
}
startButton.setButtonEnabled(true);
} else {
appCombo.add(CommonConstants.EMPTY);
+ appCombo.select(0);
+ setSelectedApp(null);
+ DACommunicator.setSelectedApp(null);
+
}
}
appCombo.setEnabled(true);
setRepalyButtonEnable(true);
setStartButtonEnablement(true);
+ setSettingsButtonEnablement(true);
}
}
public void setAppComboItems(List<String> items) {
appCombo.initCombo();
-
if (null == items) {
return;
}
appCombo.add(items.get(i));
}
appCombo.select(COMBO_FIRST_INDEX);
- AppInfo appInfo = DACommunicator.getAppInfoByName(items.get(0));
+ AppInfo appInfo = DACommunicator.getPkgInfoByName(items.get(0));
DACommunicator.setSelectedApp(appInfo);
DACommunicator.getSelectedDevice().setSelectedAppName(
appInfo.getInfo(AppInfo.LABEL_INDEX));
}
public void setAppComboText(final String text) {
- AppInfo appInfo = DACommunicator.getAppInfoByName(text);
+ AppInfo appInfo = DACommunicator.getPkgInfoByName(text);
if (null != appInfo) {
DACommunicator.setSelectedApp(appInfo);
DACommunicator.getSelectedDevice().setSelectedAppName(
}
public void setAppComboTextByAppId(String id) {
- AppInfo appInfo = DACommunicator.getAppInfoByAppPkgId(id);
+ AppInfo appInfo = DACommunicator.getPkgInfoByAppPkgId(id);
if (null != appInfo) {
DACommunicator.setSelectedApp(appInfo);
DACommunicator.getSelectedDevice().setSelectedAppName(
}
}
- public void setDeviceComboText(String text) {
+ public void setDeviceComboText(final String text) {
DACommunicator.setSelectedDeviceBySerial(text);
- deviceCombo.setText(text);
- initAppCombo();
+ Display.getDefault().syncExec(new Runnable() {
+ @Override
+ public void run() {
+ deviceCombo.setText(text);
+ initAppCombo();
+ }
+ });
+
}
public boolean isSourceViewEnabled() {
startButton.setButtonEnabled(enabled);
}
+ public void setSettingsButtonEnablement(boolean enabled) {
+ settingsButton.setButtonEnabled(enabled);
+ }
+
private void setStartButtonImagesToStop(boolean isStarted) {
if (isStarted) {
startButton.setImages(ImageResources.STOP,
ImageResources.STOP_PUSH, ImageResources.STOP_HOVER,
ImageResources.START_DISABLE);
- startButton.setToolTipText(AnalyzerLabels.STOP_TRACE);
+ startButton.setToolTipText(ShortCutManager.STOP_TRACE);
} else {
startButton.setImages(ImageResources.START,
ImageResources.START_PUSH, ImageResources.START_HOVER,
ImageResources.START_DISABLE);
- startButton.setToolTipText(AnalyzerLabels.START_TRACE);
+ startButton.setToolTipText(ShortCutManager.START_TRACE);
}
}
private boolean checkValidApplication() {
List<AppInfo> apps = DACommunicator.getAppListFromTarget();
- if (apps.isEmpty()) {
+ if (null == apps || apps.isEmpty()) {
return false;
}
String selectedApp = appCombo.getText();
return buttons.get(id);
}
+ public void setToolbarStartStopState(final boolean isStop) {
+ Display.getDefault().syncExec(new Runnable() {
+ @Override
+ public void run() {
+ ToolbarArea.getInstance().setStartButtonEnablement(isStop);
+ ToolbarArea.getInstance().setMainControlEnablement(isStop);
+ ToolbarArea.getInstance().setSettingsButtonEnablement(isStop);
+ }
+ });
+ }
}
}
};
-// private KeyListener keyListener = new KeyListener() {
-//
-// @Override
-// public void keyReleased(KeyEvent e) {
-// if (e.keyCode == SWT.DEL) {
-// // TODO Auto-generated method stub
-// }
-// }
-//
-// @Override
-// public void keyPressed(KeyEvent e) {
-// // TODO Auto-generated method stub
-// }
-// };
-
private void updateDetails() {
GridItem[] items = featuresTable.getTable().getSelection();
if (items.length == 0) {
detaillMsg = ConfigureLabels.DETAIL_SNAPSHOT;
}else if( featueName.equals(ConfigureLabels.EVENT)){
detaillMsg = ConfigureLabels.DETAIL_EVENT;
- }else if( featueName.equals(ConfigureLabels.RECORDING)){
- detaillMsg = ConfigureLabels.DETAIL_RECORDING;
}else{
System.out.println("failed undefine features");
}
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
+import org.tizen.dynamicanalyzer.nl.ConfigureLabels;
import org.tizen.dynamicanalyzer.resources.ColorResources;
import org.tizen.dynamicanalyzer.resources.FontResources;
import org.tizen.dynamicanalyzer.widgets.helper.ImageResources;
} else {
checkImg = ImageResources.CHECKBOX_UNSELECTED;
}
+ if (item.getText(1).contains(ConfigureLabels.RECORDING)) { // the recording function determined to be always on.
+ checkImg = ImageResources.CHECKBOX_SELECTED_DISABLE;
+ }
gc.drawImage(checkImg, 6, getBounds().y + 1);
}
GridItem item = (GridItem) value;
if (event == IInternalWidget.LeftMouseButtonDown) {
if (overCheck(item, point)) {
- if (item.getText(1).contains("Recording")) { // the recording function determined to be always on.
+ if (item.getText(1).contains(ConfigureLabels.RECORDING)) { // the recording function determined to be always on.
item.setChecked(true);
} else if (item.getChecked() == true) {
item.setChecked(false);
package org.tizen.dynamicanalyzer.ui.toolbar.configuration;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
-import org.tizen.dynamicanalyzer.common.DesignConstants;
import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;
import org.tizen.dynamicanalyzer.nl.ConfigureLabels;
import org.tizen.dynamicanalyzer.resources.ColorResources;
import org.tizen.dynamicanalyzer.resources.FontResources;
-import org.tizen.dynamicanalyzer.resources.ImageResources;
import org.tizen.dynamicanalyzer.ui.page.DAPageComposite;
import org.tizen.dynamicanalyzer.widgets.button.checkbox.DACheckBox;
import org.tizen.dynamicanalyzer.widgets.button.checkbox.DACheckboxSelectionListener;
-import org.tizen.dynamicanalyzer.widgets.button.radio.DARadioButton;
-import org.tizen.dynamicanalyzer.widgets.button.radio.DARadioGroup;
-import org.tizen.dynamicanalyzer.widgets.button.radio.DARadioSelectionListener;
public class ConfigurationDialogSettingPage extends DAPageComposite {
public static final String ID = ConfigurationDialogSettingPage.class
.getName();
- private final Image whiteImage = ImageResources.CONFIGURATION_WHITE_IMAGE;
- private final Image blackImage = ImageResources.CONFIGURATION_BLACK_IMAGE;
-
- // private DACheckBox whiteRadioButton = null;
- // private DACheckBox blackRadioButton = null;
- private DACheckBox showInitialRadioButton = null;
- private DACheckBox autoStopRadioButton = null;
-
- private DARadioButton whiteRaidoButton = null;
- private DARadioButton blackRadioButton = null;
+ private DACheckBox showInitialCheckBox = null;
+ private DACheckBox autoStopCheckBox = null;
public ConfigurationDialogSettingPage(Composite parent, int style) {
this.setLayout(new FormLayout());
this.setBackground(ColorResources.CONFIGURATION_TABLE_COVER_BACKGROUND_COLOR);
- // Appearance
- Label tableTitle = new Label(this, SWT.TRANSPARENT);
- tableTitle.setText(ConfigureLabels.SETTING_TABLE_TITLE);
- tableTitle
- .setBackground(ColorResources.CONFIGURATION_TABLE_COVER_BACKGROUND_COLOR);
- tableTitle.setForeground(ColorResources.DEFAULT_FONT_COLOR);
- tableTitle.setFont(FontResources.CONFIGURATION_TABLE_TITLE_FONT);
-
- FormData data = new FormData();
- data.top = new FormAttachment(0, 10);
- data.left = new FormAttachment(0, 8);
- tableTitle.setLayoutData(data);
-
- // white image
- Label white = new Label(this, SWT.TRANSPARENT);
- white.setBackground(ColorResources.WINDOW_BG_COLOR);
- white.setImage(whiteImage);
- data = new FormData();
- data.top = new FormAttachment(0, 45);
- data.left = new FormAttachment(0, 60);
- data.width = 204;
- data.height = 150;
- white.setLayoutData(data);
-
- // black image
- Label black = new Label(this, SWT.TRANSPARENT);
- black.setBackground(ColorResources.WINDOW_BG_COLOR);
- black.setImage(blackImage);
- data = new FormData();
- data.top = new FormAttachment(0, 45);
- data.left = new FormAttachment(0, 325);
- data.width = 204;
- data.height = 150;
- black.setLayoutData(data);
-
- DARadioGroup radioGroup = new DARadioGroup();
- whiteRaidoButton = new DARadioButton(this, SWT.NONE);
- data = new FormData();
- data.top = new FormAttachment(0, 200);
- data.left = new FormAttachment(0, 148);
- data.height = 20;
- data.width = DesignConstants.DA_BUTTON_WIDTH + 10;
- whiteRaidoButton.setLayoutData(data);
- whiteRaidoButton.setForeground(ColorResources.BLACK);
- whiteRaidoButton.setBackground(ColorResources.DIALOG_BG_UPPER);
- whiteRaidoButton.setText(ConfigureLabels.SETTING_WHITE);
- whiteRaidoButton.addSelectionListener(whiteRadioButtonListener);
- radioGroup.addChild(whiteRaidoButton);
-
- blackRadioButton = new DARadioButton(this, SWT.NONE);
- data = new FormData();
- data.top = new FormAttachment(0, 200);
- data.left = new FormAttachment(0, 418);
- data.height = 20;
- data.width = DesignConstants.DA_BUTTON_WIDTH;
- blackRadioButton.setLayoutData(data);
- blackRadioButton.setForeground(ColorResources.BLACK);
- blackRadioButton.setBackground(ColorResources.DIALOG_BG_UPPER);
- blackRadioButton.setText(ConfigureLabels.SETTING_BLACK);
- blackRadioButton.addSelectionListener(blackRadioButtonListener);
- radioGroup.addChild(blackRadioButton);
- blackRadioButton.setEnabled(false);
-
// Configuration Setting
Label settingLabel = new Label(this, SWT.TRANSPARENT);
settingLabel.setText(ConfigureLabels.SETTING_CONFIGURATION_TITLE);
.setBackground(ColorResources.CONFIGURATION_TABLE_COVER_BACKGROUND_COLOR);
settingLabel.setForeground(ColorResources.DEFAULT_FONT_COLOR);
settingLabel.setFont(FontResources.CONFIGURATION_TABLE_TITLE_FONT);
- data = new FormData();
- data.top = new FormAttachment(0, 230);
- data.left = new FormAttachment(0, 5);
+ FormData data = new FormData();
+ data.top = new FormAttachment(0, 10);
+ data.left = new FormAttachment(0, 8);
settingLabel.setLayoutData(data);
// SHOW_INITIAL_FEATURE_SETTING
- showInitialRadioButton = new DACheckBox(this, SWT.NONE);
+ showInitialCheckBox = new DACheckBox(this, SWT.NONE);
data = new FormData();
- data.top = new FormAttachment(0, 250);
+ data.top = new FormAttachment(settingLabel, 15);
data.left = new FormAttachment(0, 22);
data.height = 20;
data.width = 20;
- showInitialRadioButton.setLayoutData(data);
- showInitialRadioButton.setForeground(ColorResources.BLACK);
- showInitialRadioButton.setBackground(ColorResources.DIALOG_BG_UPPER);
- showInitialRadioButton.setText(ConfigureLabels.SHOW_INITIAL);
- showInitialRadioButton
- .addSelectionListener(showInitiaRadioButtonListener);
- showInitialRadioButton.setChecked(ConfigurationDialogValues
- .getInstance().isShowInitia());
+ showInitialCheckBox.setLayoutData(data);
+ showInitialCheckBox.setForeground(ColorResources.BLACK);
+ showInitialCheckBox.setBackground(ColorResources.DIALOG_BG_UPPER);
+ showInitialCheckBox.setText(ConfigureLabels.SHOW_INITIAL);
+ showInitialCheckBox.addSelectionListener(showInitiaRadioButtonListener);
+ showInitialCheckBox.setChecked(ConfigurationDialogValues.getInstance()
+ .isShowInitia());
Label showInitalLabel = new Label(this, SWT.TRANSPARENT);
showInitalLabel.setText(ConfigureLabels.SHOW_INITIAL);
showInitalLabel.setForeground(ColorResources.BLACK);
showInitalLabel.setFont(FontResources.CONFIGURATION_TABLE_TITLE_FONT);
data = new FormData();
- data.top = new FormAttachment(0, 252);
+ data.top = new FormAttachment(settingLabel, 17);
data.left = new FormAttachment(0, 42);
showInitalLabel.setLayoutData(data);
// SHOW_INITIAL_FEATURE_SETTING
- autoStopRadioButton = new DACheckBox(this, SWT.NONE);
+ autoStopCheckBox = new DACheckBox(this, SWT.NONE);
data = new FormData();
- data.top = new FormAttachment(0, 272);
+ data.top = new FormAttachment(settingLabel, 42);
data.left = new FormAttachment(0, 22);
- data.height = 20;
+ data.height = 20; // 20
data.width = 20;
- autoStopRadioButton.setLayoutData(data);
- autoStopRadioButton.setForeground(ColorResources.BLACK);
- autoStopRadioButton.setBackground(ColorResources.DIALOG_BG_UPPER);
- autoStopRadioButton.setText(ConfigureLabels.AUTO_STOP);
- autoStopRadioButton.addSelectionListener(autoStopRadioButtonListener);
- autoStopRadioButton.setChecked(ConfigurationDialogValues.getInstance()
+ autoStopCheckBox.setLayoutData(data);
+ autoStopCheckBox.setForeground(ColorResources.BLACK);
+ autoStopCheckBox.setBackground(ColorResources.DIALOG_BG_UPPER);
+ autoStopCheckBox.setText(ConfigureLabels.AUTO_STOP);
+ autoStopCheckBox.addSelectionListener(autoStopRadioButtonListener);
+ autoStopCheckBox.setChecked(ConfigurationDialogValues.getInstance()
.isAutoStop());
Label autoStopLabel = new Label(this, SWT.TRANSPARENT);
autoStopLabel.setForeground(ColorResources.BLACK);
autoStopLabel.setFont(FontResources.CONFIGURATION_TABLE_TITLE_FONT);
data = new FormData();
- data.top = new FormAttachment(0, 274);
+ data.top = new FormAttachment(settingLabel, 44);
data.left = new FormAttachment(0, 42);
autoStopLabel.setLayoutData(data);
}
- private DARadioSelectionListener whiteRadioButtonListener = new DARadioSelectionListener() {
- @Override
- public void handleSelectionEvent(DARadioButton radio) {
- whiteRaidoButton.setEnabled(true);
-
- }
- };
-
- private DARadioSelectionListener blackRadioButtonListener = new DARadioSelectionListener() {
-
- @Override
- public void handleSelectionEvent(DARadioButton radio) {
- blackRadioButton.setEnabled(false);
-
- }
- };
-
private DACheckboxSelectionListener showInitiaRadioButtonListener = new DACheckboxSelectionListener() {
@Override
public void handleSelectionEvent(DACheckBox checkbox) {
ConfigurationDialogValues.getInstance().setShowInitia(
!ConfigurationDialogValues.getInstance().isShowInitia());
- showInitialRadioButton.setChecked(ConfigurationDialogValues
+ showInitialCheckBox.setChecked(ConfigurationDialogValues
.getInstance().isShowInitia());
}
};
public void handleSelectionEvent(DACheckBox checkbox) {
ConfigurationDialogValues.getInstance().setAutoStop(
!ConfigurationDialogValues.getInstance().isAutoStop());
- autoStopRadioButton.setChecked(ConfigurationDialogValues
- .getInstance().isAutoStop());
+ autoStopCheckBox.setChecked(ConfigurationDialogValues.getInstance()
+ .isAutoStop());
}
};
}
\ No newline at end of file
private int bRecordingCall = AnalyzerConstants.OPT_RECORD;
// Configuration
- private boolean whiteTheme = true;
- private boolean blackTheme = false;
-
private boolean showInitia = false;
private boolean autoStop = false;
featuresName = new String[] { ConfigureLabels.FUNCTIONPROFILING,
ConfigureLabels.ALLOCATION, ConfigureLabels.FILE,
ConfigureLabels.THREAD, ConfigureLabels.USERINTERFACE,
- ConfigureLabels.SNAPSHOT, ConfigureLabels.EVENT,
- ConfigureLabels.RECORDING };
+ ConfigureLabels.SNAPSHOT, ConfigureLabels.EVENT };
mConfig = ConfigureManager.getInstance();
}
return instance;
return getSnapshotCall();
} else if (featueName.equals(ConfigureLabels.EVENT)) {
return getEventCall();
- } else if (featueName.equals(ConfigureLabels.RECORDING)) {
- return isbRecordingCall();
} else {
System.out.println("failed undefine features");
}
value = AnalyzerConstants.OPT_EVENT;
}
setEventCall(value);
- } else if (featueName.equals(ConfigureLabels.RECORDING)) {
- if (status) {
- value = AnalyzerConstants.OPT_RECORD;
- }
- setbRecordingCall(value);
} else {
System.out.println("failed undefine features");
}
for (String featueName : ConfigurationDialogValues.getInstance()
.getFeature()) {
if (featueName.equals(ConfigureLabels.FUNCTIONPROFILING)) {
- if (isChangeFeatuesValues(getFunctionProfilingCall(), featueName)) {
+ if (isChangeFeatuesValues(getFunctionProfilingCall(),
+ featueName)) {
System.out.println("change valuse FUNCTIONPROFILING");
}
} else if (featueName.equals(ConfigureLabels.ALLOCATION)) {
}
// Configuration
- public boolean isWhiteTheme() {
- return whiteTheme;
- }
-
- public void setWhiteTheme(boolean whiteTheme) {
- this.whiteTheme = whiteTheme;
- }
-
- public boolean isBlackTheme() {
- return blackTheme;
- }
-
- public void setBlackTheme(boolean blackTheme) {
- this.blackTheme = blackTheme;
- }
-
public boolean isShowInitia() {
return showInitia;
}
window = new Shell(parent, SWT.APPLICATION_MODAL | SWT.DIALOG_TRIM);
window.setSize(608, 460);
window.setLayout(new FormLayout());
- window.setText(AnalyzerLabels.CONFIGURATION);
+ window.setText(AnalyzerLabels.WELCOME);
// banner
Label banner = new Label(window, SWT.TRANSPARENT);
}
shell.setLayout(new FormLayout());
shell.setSize(400, 410);
- shell.setText(AnalyzerLabels.OPEN_TRACE);
+ shell.setText(AnalyzerLabels.OPEN_TRACE_TITLE);
shell.addDisposeListener(new DisposeListener() {
private boolean setDetailsInfo(String path) {
boolean isSuccess = true;
- List<String> pInfo = SqlManager.getInstance().getDetailsInfo(path);
- if (null == pInfo || pInfo.isEmpty()) {
- isSuccess = false;
- }
- createTime = pInfo.get(AnalyzerConstants.PROJECT_CREATE_TIME_INDEX);
- device = pInfo.get(AnalyzerConstants.PROJECT_DEVICE_INDEX);
- application = pInfo.get(AnalyzerConstants.PROJECT_APPNAME_INDEX);
- elapsedTime = pInfo.get(AnalyzerConstants.PROJECT_LAST_TIME_INDEX);
+ List<String> pInfo = SqlManager.getInstance().getDetailsInfo(path);
+ if (null == pInfo || pInfo.isEmpty() || pInfo.size() < 9) {
+ return false;
+ }
+ createTime = pInfo.get(AnalyzerConstants.PROJECT_CREATE_TIME_INDEX);
+ device = pInfo.get(AnalyzerConstants.PROJECT_DEVICE_INDEX);
+ application = pInfo.get(AnalyzerConstants.PROJECT_APPNAME_INDEX);
+ elapsedTime = pInfo.get(AnalyzerConstants.PROJECT_LAST_TIME_INDEX);
return isSuccess;
}
}
public static void stopOpenTraceInputReader() {
if (null != openTraceInputThread && openTraceInputThread.isAlive()) {
try {
- openTraceInputThread.join();
+ openTraceInputThread.join(AnalyzerManager.THREAD_JOIN_WAIT_TIME);
} catch (InterruptedException e) {
e.printStackTrace();
}
if (null != updateLogThread && updateLogThread.isAlive()) {
try {
sendNotify();
- updateLogThread.join();
+ updateLogThread.join(AnalyzerManager.THREAD_JOIN_WAIT_TIME);
System.out.println("ui data manager joined!");
} catch (InterruptedException e) {
e.printStackTrace();
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Composite;
import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;
+import org.tizen.dynamicanalyzer.shortcut.ShortCutManager;
import org.tizen.dynamicanalyzer.ui.info.callstack.CallstackView;
import org.tizen.dynamicanalyzer.ui.info.snapshot.SnapshotView;
import org.tizen.dynamicanalyzer.ui.page.DAPageComposite;
public UIPage(Composite parent, int style) {
super(parent, style);
name = AnalyzerLabels.COOLBAR_AREA_UI;
- this.setData(DAPageComposite.KEY_TOOLTIP, AnalyzerLabels.COOLBAR_AREA_UI_TOOLTIP);
+ this.setData(DAPageComposite.KEY_TOOLTIP, ShortCutManager.COOLBAR_AREA_UI_TOOLTIP);
this.setLayout(new FillLayout());
baseForm = new SashForm(this, SWT.VERTICAL);
baseForm.setLayout(new FillLayout());
return;
}
- UIControlListData controlData = new UIControlListData(input);
-
- controlData.setSequence(input
- .get(LogCenterConstants.SEQUENCE_NUMBER_INDEX));
-
- controlData.setTime(input.get(LogCenterConstants.TIME_INDEX));
-
- controlData.setAPIName(stClassName);
-
- controlData.setInitializeTime(CommonConstants.DASH);
- controlData.setTerminateTime(CommonConstants.DASH);
-
- controlData
- .setParentName(input
- .get(LogCenterConstants.USER_INTERFACE_CONTROL_LIST_PARENT_NAME_INDEX));
- controlData
- .setParentClassName(input
- .get(LogCenterConstants.USER_INTERFACE_CONTROL_LIST_PARENT_CLASS_NAME_INDEX));
- controlData
- .setParentPointer(input
- .get(LogCenterConstants.USER_INTERFACE_CONTROL_LIST_PARENT_POINTER_INDEX));
-
- controlData
- .setChildName(input
- .get(LogCenterConstants.USER_INTERFACE_CONTROL_LIST_CHILD_NAME_INDEX));
-
- StringBuilder childClassNameDemangling = new StringBuilder(
- input.get(LogCenterConstants.USER_INTERFACE_CONTROL_LIST_CHILD_CLASS_NAME_INDEX));
-
- childClassNameDemangling.insert(0, "_Z");//$NON-NLS-1$
- String childClassName = SymbolManager
- .demanglingFunctionName(childClassNameDemangling.toString());
-
- controlData.setChildClassName(childClassName);
- controlData
- .setChildPointer(input
- .get(LogCenterConstants.USER_INTERFACE_CONTROL_LIST_CHILD_POINTER_INDEX));
-
- controlData
- .setControlType(input
- .get(LogCenterConstants.USER_INTERFACE_CONTROL_LIST_CHILD_NAME_INDEX));
-
- controlData.setCalssKeyName(getClassName(input));
-
- addSortData(controlData);
+ addSortData(makeUIControlListData(input));
setUIControlListTimeData();
preSeq = input.get(LogCenterConstants.SEQUENCE_NUMBER_INDEX);
}
}
+ private UIControlListData makeUIControlListData(List<String> input) {
+ UIControlListData controlData = new UIControlListData(input);
+
+ controlData.setSequence(input
+ .get(LogCenterConstants.SEQUENCE_NUMBER_INDEX));
+
+ controlData.setTime(input.get(LogCenterConstants.TIME_INDEX));
+
+ controlData.setAPIName(getClassName(
+ input.get(LogCenterConstants.APINAME_INDEX)).trim());
+
+ controlData.setInitializeTime(CommonConstants.DASH);
+ controlData.setTerminateTime(CommonConstants.DASH);
+
+ controlData
+ .setParentName(input
+ .get(LogCenterConstants.USER_INTERFACE_CONTROL_LIST_PARENT_NAME_INDEX));
+ controlData
+ .setParentClassName(input
+ .get(LogCenterConstants.USER_INTERFACE_CONTROL_LIST_PARENT_CLASS_NAME_INDEX));
+ controlData
+ .setParentPointer(input
+ .get(LogCenterConstants.USER_INTERFACE_CONTROL_LIST_PARENT_POINTER_INDEX));
+
+ controlData
+ .setChildName(input
+ .get(LogCenterConstants.USER_INTERFACE_CONTROL_LIST_CHILD_NAME_INDEX));
+
+ StringBuilder childClassNameDemangling = new StringBuilder(
+ input.get(LogCenterConstants.USER_INTERFACE_CONTROL_LIST_CHILD_CLASS_NAME_INDEX));
+
+ childClassNameDemangling.insert(0, "_Z");//$NON-NLS-1$
+ String childClassName = SymbolManager
+ .demanglingFunctionName(childClassNameDemangling.toString());
+
+ controlData.setChildClassName(childClassName);
+ controlData
+ .setChildPointer(input
+ .get(LogCenterConstants.USER_INTERFACE_CONTROL_LIST_CHILD_POINTER_INDEX));
+
+ controlData
+ .setControlType(input
+ .get(LogCenterConstants.USER_INTERFACE_CONTROL_LIST_CHILD_NAME_INDEX));
+
+ controlData.setCalssKeyName(getClassName(input));
+ return controlData;
+ }
+
private boolean isExistData(String parentClassNam, String childClassName) {
if (getRemoveCallControlList() == null) {
return false;
}
}
- private String getDemanglingName(String uiClassName){
+ private String getDemanglingName(String uiClassName) {
String demangleName = CommonConstants.EMPTY;
StringBuilder childClassNameDemangling = new StringBuilder(uiClassName);
- if (childClassNameDemangling.indexOf("_Z") != 0){//$NON-NLS-1$
+ if (childClassNameDemangling.indexOf("_Z") != 0) {//$NON-NLS-1$
childClassNameDemangling.insert(0, "_Z");//$NON-NLS-1$
demangleName = SymbolManager
.demanglingFunctionName(childClassNameDemangling.toString());
int size = controlList.size();
int nNodeDepth = 0;
for (int i = 0; i < size; i++) {
- // System.out.println("sort "+i+" "+controlList.get(i).getData());
+// System.out.println("sort " + i + " " + controlList.get(i).getData());
TreeInput currentNode = makeInput(controlList.get(i));
if (isRootNode(controlList, i)) {
output.add(currentNode);
public boolean isRootNode(List<UIControlListData> controlList, int index) {
boolean isRootNode = true;
+ if (!controlList.get(index).getChildName().equals("Frame")//$NON-NLS-1$
+ && !controlList.get(index).getChildName().equals("Form")) {//$NON-NLS-1$
+ return false;
+ }
for (int i = 0; i < index; i++) {
if (controlList.get(i).getChildPointer()
.equals(controlList.get(index).getParentPointer())) {
+
isRootNode = false;
break;
}
import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
import org.tizen.dynamicanalyzer.common.AnalyzerPaths;
import org.tizen.dynamicanalyzer.common.CommonConstants;
-import org.tizen.dynamicanalyzer.communicator.DACommunicator;
import org.tizen.dynamicanalyzer.ui.summary.profiling.FunctionUsageProfiler;
import org.tizen.dynamicanalyzer.ui.summary.profiling.ProfileDataMaker;
import org.tizen.dynamicanalyzer.ui.summary.profiling.ProfilingData;
final String UI_API_TRUE = "true";//$NON-NLS-1$
final String UI_API_FALSE = "false";//$NON-NLS-1$
static int nUserProfilingDataCount = 0;
- final int tizenReleaseCount = 2;
public boolean addProfilingData(ProfilingData input) {
return returnData;
}
- private String tieznSouecePath() {
- String sourcePath = null;
- for (int i = 0; i < tizenReleaseCount; i++) {
- if (DACommunicator.isTargetEmulator()) {
- if (i == 0) {
- sourcePath = AnalyzerPaths.TIZEN_2_1_EMULATOR_SOUECE_PATH;
- } else {
- sourcePath = AnalyzerPaths.TIZEN_2_0_EMULATOR_SOUECE_PATH;
- }
- } else {
- if (i == 0) {
- sourcePath = AnalyzerPaths.TIZEN_2_1_DEVICE_SOUECE_PATH;
- } else {
- sourcePath = AnalyzerPaths.TIZEN_2_0_DEVICE_SOUECE_PATH;
- }
- }
- File configFolder = new File(sourcePath);
- if (configFolder.isDirectory()) {
- return sourcePath;
- }
- }
- return null;
- }
-
private void getUIApiListFile() {
if (InitUIApiList == false) {
InitUIApiList = true;
return;
}
- String sourcePath = tieznSouecePath();
- if (null == sourcePath) {
+ String sourcePath = AnalyzerPaths.TIZEN_HEADER_SOUECE_PATH;
+ File sourceFolder = new File(sourcePath);
+ if (!sourceFolder.exists() && !sourceFolder.isDirectory()) {
+ System.out.println("Not Found the tizen_header_file folder : "
+ + sourcePath);
return;
}
String[] splitUiApiOptionList = uiApiOptionList
.split(AnalyzerConstants.DATA_PARSING_TOKEN);
- File file = new File(sourcePath);
- File[] files = file.listFiles();
+ File[] files = sourceFolder.listFiles();
String filename = null;
int filelength = files.length;
for (int i = 0; i < filelength; i++) {
private Shell parent = null;
private Shell shell = null;
private DACustomButton okButton = null;
- // private DACustomButton cancelButton = null;
private String message = null;
private boolean returnType = false;
private String titleText = AnalyzerLabels.DA_WARNING;
}
};
- // private DACustomButtonClickEventListener cancelButtonListener = new
- // DACustomButtonClickEventListener() {
- //
- // @Override
- // public void handleClickEvent(DACustomButton button) {
- // returnType = false;
- // shell.dispose();
- // }
- // };
-
public DADialog(Shell parent, int style) {
this.parent = parent;
}
labelData = new FormData();
labelData.left = new FormAttachment(0, 95);
labelData.right = new FormAttachment(100, 0);
- labelData.top = new FormAttachment(0, 25);
+ labelData.top = new FormAttachment(0, 15);
labelData.height = 40;
strMessage.setLayoutData(labelData);
okData.height = DesignConstants.DA_BUTTON_HEIGHT;
okButton.setLayoutData(okData);
- // cancelButton = new DAButton(buttonComp, SWT.NONE);
- // cancelButton.addClickListener(cancelButtonListener);
- // cancelButton.setText(AnalyzerLabels.CANCEL); //$NON-NLS-1$
- // cancelButton.setFont(FontResources.DIALOG_BUTTON_FONT);
- // okData = new FormData();
- // okData.top = new FormAttachment(0, 12);
- // okData.right = new FormAttachment(okButton, -10);
- // okData.width = 100;
- // okData.height = 34;
- // cancelButton.setLayoutData(okData);
-
shell.open();
Display display = PlatformUI.createDisplay();
while (!shell.isDisposed()) {
- if (!display.readAndDispatch())
+ if (!display.readAndDispatch()) {
display.sleep();
+ }
}
shell.dispose();
exceptionHandler.handleException(e);
}
}
- if (!display.isDisposed())
+ if (!display.isDisposed()) {
display.update();
+ }
}
private static class DefaultExceptionHandler implements IExceptionHandler {
+/*
+ * Dynamic Analyzer
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Jooyoul Lee <jy.exe.lee@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ *
+ * 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.widgets;
import java.util.ArrayList;
public class TabButtonRenderer implements IDACustomButtonRenderer {
public int computeFontSize(Rectangle rect) {
- if (rect.height > 20)
+ if (rect.height > 20) {
return 10;
- else
+ } else {
return 8;
+ }
}
protected void drawImageButton(GC gc, Rectangle rect, int state,
import org.tizen.dynamicanalyzer.resources.FontResources;
import org.tizen.dynamicanalyzer.widgets.combo.DACustomComboPopupRenderer;
-
public class TitleComboPopupRenderer extends DACustomComboPopupRenderer {
@Override
public void draw(GC gc, Canvas canvas, int state, List<Rectangle> rects,
int selection, List<String> items) {
int size = rects.size();
+ int itemSize = items.size();
+ if (size != itemSize) {
+ System.out
+ .println("invalid parameter in popup renderer : Rect size "
+ + size + "item size :" + itemSize);
+ return;
+ }
+
for (int i = 0; i < size; i++) {
Rectangle r = rects.get(i);
if (selection == i) {
gc.drawLine(r.x, r.y + r.height - 1, r.x + r.width, r.y
+ r.height - 1);
}
+
gc.setForeground(ColorResources.DEVICE_APPLICATION_DROPDOWN_TEXT);
gc.setFont(FontResources.DROPDOWN);
- // Point p = gc.textExtent(items.get(i), SWT.DRAW_MNEMONIC);
- // gc.drawString(items.get(i), 5, (r.height - p.y) / 2 + i *
- // r.height,
- // true);
gc.drawString(items.get(i), 5, 6 + i * r.height, true);
Rectangle rect = canvas.getClientArea();
package org.tizen.dynamicanalyzer.ui.widgets;
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;
public class TitleComboRenderer extends DACustomComboRenderer {
@Override
- public void draw(GC gc, Canvas canvas, String text, int state) {
+ public void draw(GC gc, Canvas canvas, String text, int textAlign,
+ Font font, int state) {
Rectangle rect = canvas.getClientArea();
setColors(state, gc);
gc.fillGradientRectangle(rect.x, rect.y, rect.width, rect.height, true);
if (null == text) {
text = CommonConstants.EMPTY;
}
- gc.setFont(FontResources.COMBO);
+ if (null == font) {
+ gc.setFont(FontResources.COMBO);
+ } else {
+ gc.setFont(font);
+ }
+
Point p = gc.textExtent(text, SWT.DRAW_MNEMONIC);
gc.setForeground(ColorResources.DEVICE_APPLICATION_ENABLE);
- gc.drawString(text, 5, (rect.height - p.y) / 2, true);
-
+ int textX = 0;
+ if (textAlign == DACustomCombo.TEXT_ALIGN_LEFT) {
+ textX = 5;
+ } else if (textAlign == DACustomCombo.TEXT_ALIGN_RIGHT) {
+ textX = rect.width - p.x;
+ } else {
+ textX = (rect.width / 2) - (p.x / 2);
+ }
+ gc.drawString(text, textX, (rect.height - p.y) / 2, true);
setColors(state, gc);
gc.fillGradientRectangle(rect.x + rect.width - 20, rect.y, 19,
rect.height - 1, true);
@Override
public void drawImage(GC gc, Canvas canvas, Image image, String text,
- int state) {
+ int textAlign, Font font, int state) {
Rectangle rect = canvas.getClientArea();
gc.drawImage(image, rect.x, rect.y);
- gc.setFont(FontResources.COMBO);
+ if (null == font) {
+ gc.setFont(FontResources.COMBO);
+ } else {
+ gc.setFont(font);
+ }
gc.setForeground(ColorResources.DEVICE_APPLICATION_ENABLE);
Point p = gc.textExtent(text, SWT.DRAW_MNEMONIC);
- gc.drawString(text, 5, (rect.height - p.y) / 2, true);
- Rectangle clipping = new Rectangle(rect.x + rect.width - 19, rect.y,
- 19, rect.height);
+ int textX = 0;
+ if (textAlign == DACustomCombo.TEXT_ALIGN_LEFT) {
+ textX = 5;
+ } else if (textAlign == DACustomCombo.TEXT_ALIGN_RIGHT) {
+ textX = rect.width - p.x;
+ } else {
+ textX = (rect.width / 2) - (p.x / 2);
+ }
+ gc.drawString(text, textX, (rect.height - p.y) / 2, true);
+ Rectangle clipping = new Rectangle(rect.x + rect.width - 17, rect.y, 17,
+ rect.height);
gc.setClipping(clipping);
gc.drawImage(image, rect.x, rect.y);
}
import org.eclipse.nebula.widgets.grid.GridItem;
import org.eclipse.swt.widgets.Composite;
+import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
import org.tizen.dynamicanalyzer.model.TableInput;
int tableStyle) {
super(parent, compStyle, tableStyle);
setRangePopup();
+
+ setComparator(new DefaultTableComparator());
+ comparator.setType(AnalyzerConstants.SORT_TYPE_NUM);
+ comparator.setColumn(0);
}
@Override
protected Point mousePoint = new Point(0, 0);
- protected RangeDataManager rangeDataManager = RangeDataManager.getInstance();
+ protected RangeDataManager rangeDataManager = RangeDataManager
+ .getInstance();
public DATableComposite(Composite parent, int style) {
this(parent, SWT.NONE, style);
gridItem.setBackground(rangeColor);
}
- if(gridData != null) {
+ if (gridData != null) {
String seqNum = gridData.getSelectionKey();
for (int ii = 0; ii < selSeqs.size(); ii++) {
if (seqNum.equals(selSeqs.get(ii))) {
public void setSortTypes(int[] types) {
sortTypes = types;
+ if (null != comparator) {
+ this.comparator.setType(sortTypes[0]);
+ }
}
public void setSourceColumns(int[] columns) {
public void paint(GC gc, Object value) {
Grid table = null;
- if (value instanceof Grid)
+ if (value instanceof Grid) {
table = (Grid) value;
+ }
GridItem item = null;
if (value instanceof GridItem) {
} else if (parent instanceof GridItem) {
gridItem = new GridItem((GridItem) parent, SWT.NONE);
} else {
- System.out.println("it is bug!! need debug - DATreeComposite makeTreeItem");//$NON-NLS-1$
+ System.out
+ .println("it is bug!! need debug - DATreeComposite makeTreeItem");//$NON-NLS-1$
}
// data
DATableDataFormat gridData = (DATableDataFormat) input.getData();
selSeqs.remove(ii);
}
}
-
+
if (null != focusSeq && gridData.getSelectionKey().equals(focusSeq)) {
focusIndex = gridItemCount;
}
@Override
protected List<TableInput> makeTableInput() {
+ makeTreeInput();
return null;
}
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
+import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
} catch (TransformerConfigurationException e) {
e.printStackTrace();
} catch (TransformerFactoryConfigurationError e) {
- System.out.println(e.getMessage());
+ e.printStackTrace();
} catch (TransformerException e) {
e.printStackTrace();
} catch (IOException e) {
public XmlData setEvent(String line, long time) {
XmlData eventData = new XmlData();
- String[] eventDatas = line.trim().split(TOKEN);
+ String[] eventDatas = line.trim().split(AnalyzerConstants.DATA_PARSING_TOKEN);
if (eventDatas.length < 7) {
return null;
--- /dev/null
+package org.tizen.dynamicanalyzer.uirecorder;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.tizen.dynamicanalyzer.logparser.LogParser;
+
+public class RecordingQueue {
+ private List<String> data = null;
+
+ public RecordingQueue() {
+ data = new ArrayList<String>();
+ }
+
+ public synchronized String getFirst() {
+ while (isEmpty()) {
+ if (LogParser.isLogParsingComplete()) {
+ return null;
+ }
+ try {
+ wait();
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ String output = data.get(0);
+ data.remove(0);
+ notifyAll();
+ return output;
+ }
+
+ public synchronized void putLog(String input) {
+ while (isFull()) {
+ try {
+ wait();
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ break;
+ }
+ }
+ data.add(input);
+ notifyAll();
+ }
+
+ public boolean isEmpty() {
+ if (null == data) {
+ data = new ArrayList<String>();
+ }
+ return data.isEmpty();
+ }
+
+ private boolean isFull() {
+ if (size() > 10000) {
+ return true;
+ }
+ return false;
+ }
+
+ public int size() {
+ return data.size();
+ }
+
+ public void clear() {
+ data.clear();
+ }
+}
package org.tizen.dynamicanalyzer.uirecorder;
-import java.io.BufferedOutputStream;
-import java.io.PrintStream;
-import java.sql.Time;
import java.util.ArrayList;
+import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
import org.tizen.dynamicanalyzer.common.AnalyzerManager;
import org.tizen.dynamicanalyzer.common.CommonConstants;
-import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
+import org.tizen.dynamicanalyzer.common.ErrorCode;
+import org.tizen.dynamicanalyzer.communicator.DACommunicator;
public class UIRecorderPlayThread extends Thread {
- String[] commands;
- String command;
- PrintStream pout;
- Time startTime;
- Process process = null;
- Time stopTime;
+ private final String FILTER_STRING = "ls:";//$NON-NLS-1$
+ private long readyTime = 100000;
+
long pauseTime;
private static UIRecorderPlayThread instance = null;
- private String xmlFileName;
+ private String xmlFileName = null;
boolean end = false;
- String fileName;
-
- public UIRecorderPlayThread(Process process) {
- this.process = process;
- this.xmlFileName = null;
- }
-
public static UIRecorderPlayThread getInstance() {
return instance;
}
oldData.event_type = CommonConstants.ZERO;
oldData.event_value = CommonConstants.ZERO;
ArrayList<XmlData> playDatas = xml.getPlayDatas(xmlFileName);
- BufferedOutputStream out;
-
- startTime = new Time(System.currentTimeMillis());
- out = new BufferedOutputStream(process.getOutputStream());
-
- pout = new PrintStream(out, true);
+ try {
+ System.out.println("Replay event ready for app start!!");
+ Thread.sleep(readyTime);
+ } catch (InterruptedException e) {
+ System.out.println("Replay start!!");
+ }
for (XmlData data : playDatas) {
- if (AnalyzerManager.isExit()) {
- AnalyzerUtil.tryClose(pout);
+ if (AnalyzerManager.isExit() || !AnalyzerManager.isRunning()) {
return;
}
try {
nowTime = Long.parseLong(data.time);
sleep(nowTime - preTime);
- } catch (NumberFormatException e1) {
- e1.printStackTrace();
- } catch (InterruptedException e1) {
- e1.printStackTrace();
+ } catch (NumberFormatException e) {
+ e.printStackTrace();
+ } catch (InterruptedException e) {
+ System.out.println("UI recorder play thread exit by interrupt");
+ break;
}
- pout.println(new String(
- data.eventType
- + " " + data.event_type + " " + data.event_code + " " + data.event_value + " ")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ String recordEvent = new String(data.eventType
+ + AnalyzerConstants.DATA_PARSING_TOKEN + data.event_type
+ + AnalyzerConstants.DATA_PARSING_TOKEN + data.event_code
+ + AnalyzerConstants.DATA_PARSING_TOKEN + data.event_value);
+ String replayEvent = AnalyzerConstants.MSG_REPLAY + "|"
+ + recordEvent.length() + "|" + recordEvent;
+
+ if (!replayEvent.contains(FILTER_STRING)) {
+ String result = DACommunicator
+ .handleControlMessage(replayEvent);
+ if (null != result) {
+ System.out.println("replay message ack :" + result);
+ String[] splitResult = result
+ .split(CommonConstants.CMD_SPLIT_READ);
+ if (!AnalyzerConstants.MSG_OK
+ .equals(splitResult[ErrorCode.ERROR_MSG_INDEX])) {
+// System.out.println("replay : " + replayEvent
+// + " send failed!!");
+
+ try {
+ int errno = Integer
+ .parseInt(splitResult[ErrorCode.ERROR_NUMBER_INDEX]);
+ System.out.println(ErrorCode.getError(errno)
+ .getMessage());
+ } catch (NumberFormatException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ }
oldData = data;
preTime = nowTime;
}
}
- public void end() {
- if (process != null) {
- process.destroy();
- process = null;
- }
- AnalyzerUtil.tryClose(pout);
- }
}
package org.tizen.dynamicanalyzer.uirecorder;
-import java.io.BufferedInputStream;
-import java.io.IOException;
-import java.sql.Time;
import java.util.ArrayList;
-import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
import org.tizen.dynamicanalyzer.common.AnalyzerManager;
import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea;
-import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
public class UIRecorderRecordThread extends Thread {
- String[] command;
- BufferedInputStream in;
- Time startTime;
- Time stopTime;
ArrayList<XmlData> recordDatas;
+ private static RecordingQueue recordQueue = null;
boolean end = false;
- Process process = null;
-
- public UIRecorderRecordThread(Process process) {
- this.process = process;
- }
public void run() {
recordDatas = new ArrayList<XmlData>();
RecorderXml xml = new RecorderXml();
ToolbarArea coolbarArea = ToolbarArea.getInstance();
- startTime = new Time(System.currentTimeMillis());
-
- in = new BufferedInputStream(process.getInputStream());
+ RecordingQueue rq = getRecordingQueue();
+ while (!AnalyzerManager.isExit()) {
+ String record = rq.getFirst();
+ if (null == record) {
+ break;
+ }
- byte[] buf = new byte[1024];
- String[] lines;
- String strBuffer = new String();
- int byteReads = 0;
- try {
- while ((byteReads = in.read(buf)) > 0) {
- strBuffer += new String(buf, 0, byteReads);
- if (strBuffer.length() - 1 != strBuffer.lastIndexOf("\n")) { //$NON-NLS-1$
- continue;
- }
- lines = strBuffer.split("\n"); //$NON-NLS-1$
- for (int i = 0; i < lines.length; i++) {
- if (lines[i].isEmpty()
- || lines[i]
- .contains(AnalyzerConstants.TOOL_RECORDER_NAME)) {
- continue;
- }
+// System.out.println("record data : " + record);
- recordData = xml.setEvent(lines[i],
- coolbarArea.getTime() / 1000);
- if (null != recordData) {
- recordDatas.add(recordData);
- if (recordData.event_type.equals("0") && recordData.event_code.equals("0") && recordData.event_value.equals("0")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- recordDatas = new ArrayList<XmlData>();
- }
- }
+ recordData = xml.setEvent(record, coolbarArea.getTime() / 1000);
+ if (null != recordData) {
+ recordDatas.add(recordData);
+ if (recordData.event_type.equals("0") && recordData.event_code.equals("0") && recordData.event_value.equals("0")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ recordDatas = new ArrayList<XmlData>();
}
- strBuffer = new String();
}
- } catch (IOException e) {
- e.printStackTrace();
}
xml.createXml(AnalyzerManager.getProject().getSavePath());
+ System.out.println("create xml file...");
end = true;
}
- public void end() {
- if (process != null) {
- process.destroy();
- process = null;
- }
- AnalyzerUtil.tryClose(in);
- }
-
public boolean isEnd() {
return end;
}
+
+ public static RecordingQueue getRecordingQueue() {
+ if (null == recordQueue) {
+ recordQueue = new RecordingQueue();
+ }
+ return recordQueue;
+ }
}
package org.tizen.dynamicanalyzer.uirecorder;
-import org.tizen.dynamicanalyzer.common.AnalyzerShellCommands;
-import org.tizen.dynamicanalyzer.communicator.DACommunicator;
+import org.tizen.dynamicanalyzer.common.AnalyzerManager;
public class UIRecorderTool {
private static UIRecorderTool instance;
- public static String RECORD_MODE = " record"; //$NON-NLS-1$
- public static String PLAY_MODE = " play"; //$NON-NLS-1$
- public static String PLAY_STATE = "play"; //$NON-NLS-1$
- public static String RECORD_STATE = "record"; //$NON-NLS-1$
- public static String STOP_STATE = "stop"; //$NON-NLS-1$
private UIRecorderRecordThread recordThread;
private UIRecorderPlayThread playThread;
private Boolean isReplay = false;
private String xmlFileStr = null;
- private String state = STOP_STATE;
-
- private UIRecorderTool() {
- xmlFileStr = null;
- state = STOP_STATE;
- }
public static UIRecorderTool getInstance() {
if (instance == null) {
}
public void startRecorder() {
- Process runProcess = null;
if (isReplay) {
/* recored */
- runProcess = execute(RECORD_MODE);
- if (runProcess != null) {
- recordThread = new UIRecorderRecordThread(runProcess);
- recordThread.start();
- }
+ recordThread = new UIRecorderRecordThread();
+ recordThread.start();
/* play */
- runProcess = execute(PLAY_MODE);
- if (runProcess != null) {
- playThread = new UIRecorderPlayThread(runProcess);
- playThread.setXmlFile(xmlFileStr);
- playThread.start();
- }
+ playThread = new UIRecorderPlayThread();
+ playThread.setXmlFile(xmlFileStr);
+ playThread.start();
isReplay = false;
} else {
/* play */
- runProcess = execute(RECORD_MODE);
- if (runProcess != null) {
- recordThread = new UIRecorderRecordThread(runProcess);
- recordThread.start();
- }
+ recordThread = new UIRecorderRecordThread();
+ recordThread.start();
}
}
public void stop() {
- if (recordThread != null) {
- recordThread.end();
+ if (recordThread != null && recordThread.isAlive()) {
+ try {
+ sendNotify();
+ System.out.println("record thread join wait!");
+ recordThread.join(AnalyzerManager.THREAD_JOIN_WAIT_TIME);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ System.out.println("record thread join interrupted!");
+ }
recordThread = null;
}
- if (playThread != null) {
- playThread.end();
+ if (playThread != null && playThread.isAlive()) {
+ try {
+ playThread.interrupt();
+ System.out.println("replay thread join wait!");
+ playThread.join(AnalyzerManager.THREAD_JOIN_WAIT_TIME);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ System.out.println("play thread join interrupted!");
+ }
playThread = null;
}
}
- public void setState(String state) {
- this.state = state;
- }
-
- public String getState() {
- return state;
- }
-
- public Process execute(String mode) {
-
- if (null == DACommunicator.getSelectedDevice()) {
- return null;
+ public void sendNotify() {
+ RecordingQueue rq = UIRecorderRecordThread.getRecordingQueue();
+ synchronized (rq) {
+ rq.notifyAll();
}
+ }
- return DACommunicator
- .execCommand(AnalyzerShellCommands.DACOMMAND_RUN_EVENT + mode);
+ public UIRecorderPlayThread getPlayThead() {
+ return playThread;
}
}
import org.eclipse.ui.handlers.IHandlerService;
import org.eclipse.ui.part.ViewPart;
import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
+import org.tizen.dynamicanalyzer.common.AnalyzerManager;
import org.tizen.dynamicanalyzer.common.CommonConstants;
import org.tizen.dynamicanalyzer.handlers.RealtimePerspectiveHandler;
import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
import org.tizen.dynamicanalyzer.services.RecordStateSourceProvider;
import org.tizen.dynamicanalyzer.ui.info.callstack.CallStackData;
-import org.tizen.dynamicanalyzer.ui.info.callstack.CallStackManager;
import org.tizen.dynamicanalyzer.ui.info.callstack.CallStackUnit;
import org.tizen.dynamicanalyzer.ui.page.BaseView;
import org.tizen.dynamicanalyzer.ui.page.DAPageComposite;
}
}
- HashMap<Integer, CallStackData> cdMap = CallStackManager.getInstance()
- .getCallStackDataBySeqMap();
- HashMap<Long, CallStackUnit> addrMap = CallStackManager.getInstance()
- .getCallStackApiByAddrMap();
+ HashMap<Integer, CallStackData> cdMap = AnalyzerManager
+ .getCallstackManager().getCallStackDataBySeqMap();
+ HashMap<Long, CallStackUnit> addrMap = AnalyzerManager
+ .getCallstackManager().getCallStackApiByAddrMap();
if (null == cdMap || null == addrMap) {
return AnalyzerConstants.USER_CALL_CHECK_ERROR;
}
String funcName = addrMap.get(addrs.get(0)).getFunctionName();
- if (CallStackManager.getInstance().checkUserCall(funcName)) {
+ if (AnalyzerManager.getCallstackManager().checkUserCall(funcName)) {
return AnalyzerConstants.USER_CALL;
}
return AnalyzerConstants.INTERNAL_CALL;
value += "." + remStr.substring(0, 1); //$NON-NLS-1$
}
}
- value += " " + getMeasure(count); //$NON-NLS-1$
+ value += " " + getByteMeasure(count); //$NON-NLS-1$
break;
}
}
String value = ""; //$NON-NLS-1$
while (true) {
- if (quotient >= 1024) {
- reminder = (int) (quotient % 1024);
- quotient = quotient / 1024;
+ if (quotient >= 1000) {
+ reminder = (int) (quotient % 1000);
+ quotient = quotient / 1000;
count++;
continue;
} else {
return toBpsFormat((long) nByte, startTime, endTime);
}
- private static String getMeasure(int count) {
+ private static String getByteMeasure(int count) {
if (count == 4) {
- return "TB"; //$NON-NLS-1$
+ return "TiB"; //$NON-NLS-1$
} else if (count == 3) {
- return "GB"; //$NON-NLS-1$
+ return "GiB"; //$NON-NLS-1$
} else if (count == 2) {
- return "MB"; //$NON-NLS-1$
+ return "MiB"; //$NON-NLS-1$
} else if (count == 1) {
- return "KB"; //$NON-NLS-1$
+ return "KiB"; //$NON-NLS-1$
} else {
return "Byte"; //$NON-NLS-1$
}
count++;
continue;
} else {
- value = getMeasure(count); //$NON-NLS-1$
+ value = getByteMeasure(count); //$NON-NLS-1$
break;
}
}