private final int MARGIN = 3;
private final int ARROW_MARGIN = 2;
private final int EVENT_WIDTH = 2;
- private final double EVENT_HEIGHT_MARGIN_RATIO = 0.25;
- private final double LOAD_HEIGHT_MARGIN_RATIO = 0.25;
+ private final double EVENT_HEIGHT_MARGIN_RATIO = 0.20;
+ private final double LOAD_HEIGHT_MARGIN_RATIO = 0.20;
private boolean bInitialized = false;
private List<DACustomChartSeries> seriesList = null;
private DACustomChartPlot plot = null;
drawArrowSeries(gc, series);
break;
case DACustomChartSeries.SERIES_STYLE_STATE:
- // drawStateSeries(gc, series);
+ drawStateSeries(gc, series);
break;
default:
System.out.println("Undefined series style");
gc.drawImage(image, pixcelStartX, SCREENSHOT_TOP_MARGIN);
gc.setLineWidth(SCREENSHOT_BORDER_LINE_WIDTH);
gc.setForeground(ColorResources.SCREENSHOT_CHART_BORDER_LINE);
- gc.drawRectangle(pixcelStartX, SCREENSHOT_TOP_MARGIN, SCREENSHOT_WIDTH, SCREENSHOT_HEIGHT);
+ gc.drawRectangle(pixcelStartX, SCREENSHOT_TOP_MARGIN,
+ SCREENSHOT_WIDTH, SCREENSHOT_HEIGHT);
}
if (currentX > plot.getVisibleEndX()) {
- SCREENSHOT_SELECTED_MOVE_SIZE);
gc.setLineWidth(SCREENSHOT_BORDER_LINE_WIDTH);
gc.setForeground(ColorResources.SCREENSHOT_CHART_BORDER_LINE);
- gc.drawRectangle(pixcelStartX, SCREENSHOT_TOP_MARGIN - SCREENSHOT_SELECTED_MOVE_SIZE, SCREENSHOT_WIDTH, SCREENSHOT_HEIGHT);
+ gc.drawRectangle(pixcelStartX, SCREENSHOT_TOP_MARGIN
+ - SCREENSHOT_SELECTED_MOVE_SIZE, SCREENSHOT_WIDTH,
+ SCREENSHOT_HEIGHT);
}
}
int pixcelStartX = plot.getXPixcelFromX(seriesItem.getX(), r);
Color itemColor = seriesItem.getEventColor();
- int heightMargin = (int) ((r.y + r.height) * EVENT_HEIGHT_MARGIN_RATIO);
+ int barHeight = (int) ((r.y + r.height) * EVENT_HEIGHT_MARGIN_RATIO);
if (null != itemColor) {
gc.setBackground(itemColor);
- gc.fillRectangle(pixcelStartX, r.y + heightMargin, EVENT_WIDTH,
- r.y + r.height - heightMargin - r.height / 2);
- // gc.drawRectangle(pixcelStartX, r.y + heightMargin,
- // EVENT_WIDTH,
- // r.y + r.height - heightMargin - r.height/2);
+ gc.fillRectangle(pixcelStartX, r.y + barHeight, EVENT_WIDTH,
+ barHeight);
gc.setBackground(color);
} else {
- gc.fillRectangle(pixcelStartX, r.y + heightMargin, EVENT_WIDTH,
- r.y + r.height - heightMargin - r.height / 2);
- // gc.drawRectangle(pixcelStartX, r.y + heightMargin,
- // EVENT_WIDTH,
- // r.y + r.height - heightMargin - r.height/2);
+ gc.fillRectangle(pixcelStartX, r.y + barHeight, EVENT_WIDTH,
+ barHeight);
}
if (currentX > plot.getVisibleEndX()) {
break;
seriesItem = seriesItems.get(i);
double currentX = seriesItem.getX();
if (currentX > plot.getVisibleEndX()) {
+ lastIndex = i;
break;
}
lastIndex = i;
int pixcelStartX = plot.getXPixcelFromX(seriesItem.getX(), r);
- int heightMargin = (int) ((r.y + r.height) * EVENT_HEIGHT_MARGIN_RATIO);
- int barHeight = r.y + r.height - heightMargin - r.height / 2;
+ int barHeight = (int) ((r.y + r.height) * EVENT_HEIGHT_MARGIN_RATIO);
+ int barPosY = r.y + r.height - barHeight*2;
- gc.fillRectangle(pixcelStartX, r.y + r.height / 2, EVENT_WIDTH, barHeight);
+ gc.fillRectangle(pixcelStartX, barPosY, EVENT_WIDTH,
+ barHeight);
- if (0 == arrowPosition) {
-
- } else {
+ if (DACustomChartSeriesItem.SERIES_ARROW_NONE != arrowPosition) {
String number = String
.valueOf((int) (seriesItem.getBarWidth()));
Rectangle arrowRect = imageRect;
// arrowRect.y = (r.y + r.height) / 2 - imageRect.height / 2;
- arrowRect.y = r.y + r.height - r.height / 2 + barHeight/2 - imageRect.height
- / 2;
- if (0 > arrowPosition) {
+ arrowRect.y = barPosY + barHeight/2
+ - imageRect.height / 2;
+ if (DACustomChartSeriesItem.SERIES_ARROW_RIGHT == arrowPosition) {
arrowRect.x = pixcelStartX - imageRect.width;
} else {
arrowRect.x = pixcelStartX + EVENT_WIDTH;
}
}
}
+
+ private void drawStateSeries(GC gc, DACustomChartSeries series) {
+ List<DACustomChartSeriesItem> seriesItems = series.getSeriesItemList();
+ if (null == seriesItems) {
+ return;
+ }
+
+ int seriesItemSize = seriesItems.size();
+
+ if (seriesItemSize < 1) {
+ return;
+ }
+
+ DACustomChartSeriesItem seriesItem;
+ Color color = series.getColor();
+ gc.setBackground(color);
+ gc.setAntialias(SWT.ON);
+
+ int index = series.getPrevIndexByXvalue(plot.getVisibleStartX());
+ if (index < 0) {
+ index = 0;
+ }
+ int heightMargin = (int) ((r.y + r.height) * LOAD_HEIGHT_MARGIN_RATIO);
+
+ for (int i = index; i < seriesItemSize; i++) {
+ seriesItem = seriesItems.get(i);
+ double currentX = seriesItem.getX();
+ int pixcelStartX = plot.getXPixcelFromX(seriesItem.getX(), r);
+ color = seriesItem.getEventColor();
+ int state = (int) seriesItem.getY();
+
+ if (null != color) {
+ gc.setBackground(color);
+ }
+ int barWidth = EVENT_WIDTH;
+ switch (state) {
+ case DACustomChartSeriesItem.SERIES_STATE_BAR:
+ gc.fillRectangle(pixcelStartX, r.y + heightMargin, barWidth,
+ r.y + r.height - heightMargin * 2);
+ break;
+ case DACustomChartSeriesItem.SERIES_STATE_CONTINUE:
+ if (i+1 == seriesItemSize) {
+ barWidth = plot.getXPixcelFromX(plot.getValidEndX(), r)
+ - pixcelStartX;
+ } else {
+ barWidth = plot.getXPixcelFromX(seriesItems.get(i+1).getX(), r)
+ - pixcelStartX;
+ if(barWidth < EVENT_WIDTH){
+ barWidth = EVENT_WIDTH;
+ }
+ }
+ gc.fillRectangle(pixcelStartX, r.y + heightMargin, barWidth,
+ r.y + r.height - heightMargin * 2);
+ break;
+ case DACustomChartSeriesItem.SERIES_STATE_CONNECTION:
+ if(i > 0){
+ int prevXPixcel = plot.getXPixcelFromX(seriesItems.get(i-1).getX());
+ if(pixcelStartX - prevXPixcel < barWidth){
+ pixcelStartX = prevXPixcel + EVENT_WIDTH;
+ }
+ }
+ if (i+1 < seriesItemSize) {
+ barWidth = plot.getXPixcelFromX(seriesItems.get(i+1).getX(), r)
+ - pixcelStartX;
+ }
+ gc.fillRectangle(pixcelStartX, r.y + heightMargin, barWidth,
+ r.y + r.height - heightMargin * 2);
+ break;
+ default:
+ break;
+ }
+
+ if (null != color) {
+ gc.setBackground(series.getColor());
+ }
+ if (currentX > plot.getVisibleEndX()) {
+ break;
+ }
+ }
+ }
}
import org.eclipse.swt.graphics.Image;
public class DACustomChartSeriesItem {
+ public static final int SERIES_STATE_BAR = 0;
+ public static final int SERIES_STATE_CONTINUE = 1;
+ public static final int SERIES_STATE_CONNECTION = 2;
+ public static final int SERIES_ARROW_NONE = 0;
+ public static final int SERIES_ARROW_LEFT = -1;
+ public static final int SERIES_ARROW_RIGHT = 1;
private double x = 0;
private double y = 0;
private double barWidth = -1;
public static String THREAD_CHART_NAME_PREFIX;
public static String THREAD_CHART_NAME_POSTFIX;
+ public static String THREAD_CHART_NAME_TID;
+ public static String THREAD_CHART_NAME_OBJ;
public static String THREAD_SYNC_CHART_SERIES_STATE;
THREAD_CHART_NAME_PREFIX=\n(
THREAD_CHART_NAME_POSTFIX=)
+THREAD_CHART_NAME_TID=tid :
+THREAD_CHART_NAME_OBJ=obj :\n
THREAD_SYNC_CHART_SERIES_STATE=STATE
setColor("thread_graph_lock_new_color", new RGB(129, 169, 0)); //$NON-NLS-1$
setColor("thread_graph_lock_wait_color", new RGB(96, 126, 131)); //$NON-NLS-1$
setColor("thread_graph_lock_acquire_color", new RGB(227, 123, 30)); //$NON-NLS-1$
- setColor("thread_graph_lock_release_color", new RGB(0, 148, 170)); //$NON-NLS-1$
+ setColor("thread_graph_lock_release_color", new RGB(255, 255, 255)); //$NON-NLS-1$
}
public Color getColor(String colorName, RGB rgb) {
setColor("thread_graph_lock_new_color", new RGB(129, 169, 0)); //$NON-NLS-1$
setColor("thread_graph_lock_wait_color", new RGB(96, 126, 131)); //$NON-NLS-1$
setColor("thread_graph_lock_acquire_color", new RGB(227, 123, 30)); //$NON-NLS-1$
- setColor("thread_graph_lock_release_color", new RGB(0, 148, 170)); //$NON-NLS-1$
+ setColor("thread_graph_lock_release_color", new RGB(255, 255, 255)); //$NON-NLS-1$
setColor("snapshot_viewer_bg_color", new RGB(255, 255, 255)); //$NON-NLS-1$
}
import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
import org.tizen.dynamicanalyzer.nl.ThreadPageLabels;
+import org.tizen.dynamicanalyzer.resources.ColorResources;
import org.tizen.dynamicanalyzer.widgets.chart.DACustomChartSeries;
import org.tizen.dynamicanalyzer.widgets.chart.DACustomChartSeriesItem;
import org.tizen.dynamicanalyzer.widgets.chartBoard.DACustomChartBoardItem;
}
protected int createChartItem(ThreadPageDataEvent event) {
- DACustomChartSeriesItem seriesItem;
+ DACustomChartSeriesItem seriesItem = null;
ThreadPageSyncDataEvent syncEvent = (ThreadPageSyncDataEvent) event;
if (!(syncEvent instanceof ThreadPageSyncDataEvent)) {
System.out.println("error : createChartItem");
return -1;
}
- seriesItem = new DACustomChartSeriesItem(syncEvent.getTime(), 0);
+ int apiType = syncEvent.getApiType();
+
+ switch (apiType) {
+ case LogCenterConstants.SYNC_API_TYPE_NEW:
+ case LogCenterConstants.SYNC_API_TYPE_NOTIFY:
+ case LogCenterConstants.SYNC_API_TYPE_NOTIFY_ALL:
+ case LogCenterConstants.SYNC_API_TYPE_OTHER:
+ seriesItem = new DACustomChartSeriesItem(syncEvent.getTime(),
+ DACustomChartSeriesItem.SERIES_STATE_BAR,
+ ColorResources.YELLOW);
+ break;
+ case LogCenterConstants.SYNC_API_TYPE_ACQUIRE_WAIT_START:
+ case LogCenterConstants.SYNC_API_TYPE_COND_WAIT_START:
+ seriesItem = new DACustomChartSeriesItem(syncEvent.getTime(),
+ DACustomChartSeriesItem.SERIES_STATE_CONTINUE,
+ ColorResources.THREAD_GRAPH_LOCK_WAIT_COLOR);
+ break;
+ case LogCenterConstants.SYNC_API_TYPE_RELEASE:
+ seriesItem = new DACustomChartSeriesItem(syncEvent.getTime(),
+ DACustomChartSeriesItem.SERIES_STATE_CONNECTION,
+ ColorResources.THREAD_GRAPH_LOCK_RELEASE_COLOR);
+ break;
+ case LogCenterConstants.SYNC_API_TYPE_ACQUIRE_WAIT_END:
+ case LogCenterConstants.SYNC_API_TYPE_COND_WAIT_END:
+ case LogCenterConstants.SYNC_API_TYPE_TRY_ACQUIRE:
+ int errorNum = Integer.parseInt(event.getContents().get(
+ LogCenterConstants.ERROR_INDEX));
+ if (0 != errorNum) {
+ seriesItem = new DACustomChartSeriesItem(syncEvent.getTime(),
+ DACustomChartSeriesItem.SERIES_STATE_BAR,
+ ColorResources.RED);
+ } else {
+ seriesItem = new DACustomChartSeriesItem(syncEvent.getTime(),
+ DACustomChartSeriesItem.SERIES_STATE_CONTINUE,
+ ColorResources.THREAD_GRAPH_LOCK_ACQUIRE_COLOR);
+ }
+ break;
+ default:
+ return -1;
+ }
stateSeries.addSeriesItem(seriesItem);
- return syncEvent.getApiType();
+ return apiType;
}
}
private DACustomChartSeries apiSeries;
public ThreadPageThreadData(String type, int tid) {
- super(type, String.valueOf(tid)
- + ThreadPageLabels.THREAD_CHART_NAME_PREFIX + type
- + ThreadPageLabels.THREAD_CHART_NAME_POSTFIX, tid);
+ super(type, String.valueOf(tid), tid);
}
public void addDataEvent(ThreadPageThreadDataEvent dataEvent) {
int eventApiType = threadEvent.getApiType();
if (eventApiType == LogCenterConstants.THREAD_API_TYPE_INTERNAL_START) {
seriesItem = new DACustomChartSeriesItem(threadEvent.getTime(),
- -1);
+ DACustomChartSeriesItem.SERIES_ARROW_LEFT);
seriesItem.setBarWidth(threadEvent.getCallerTid());
} else if (eventApiType == LogCenterConstants.THREAD_API_TYPE_WAIT_END) {
if (threadEvent.getContents()
.get(LogCenterConstants.APINAME_INDEX)
.equals(ThreadPageLabels.THREAD_API_JOIN)) {
seriesItem = new DACustomChartSeriesItem(
- threadEvent.getTime(), -1);
+ threadEvent.getTime(),
+ DACustomChartSeriesItem.SERIES_ARROW_LEFT);
seriesItem.setBarWidth(threadEvent.getCallerTid());
} else {
seriesItem = new DACustomChartSeriesItem(
- threadEvent.getTime(), 0);
+ threadEvent.getTime(),
+ DACustomChartSeriesItem.SERIES_ARROW_NONE);
}
} else if (eventApiType == LogCenterConstants.THREAD_API_TYPE_INTERNAL_STOP) {
if (-1 != threadEvent.getCallerTid()) {
seriesItem = new DACustomChartSeriesItem(
- threadEvent.getTime(), 1);
+ threadEvent.getTime(),
+ DACustomChartSeriesItem.SERIES_ARROW_RIGHT);
seriesItem.setBarWidth(threadEvent.getCallerTid());
} else {
seriesItem = new DACustomChartSeriesItem(
- threadEvent.getTime(), 0);
+ threadEvent.getTime(),
+ DACustomChartSeriesItem.SERIES_ARROW_NONE);
}
} else {
seriesItem = new DACustomChartSeriesItem(threadEvent.getTime(),
- 0);
+ DACustomChartSeriesItem.SERIES_ARROW_NONE);
}
eventSeries.addSeriesItem(seriesItem);
import org.tizen.dynamicanalyzer.widgets.chart.DACustomChart;
import org.tizen.dynamicanalyzer.widgets.chart.DACustomChartPlot;
import org.tizen.dynamicanalyzer.widgets.chart.DACustomChartSeries;
+import org.tizen.dynamicanalyzer.widgets.chart.DACustomChartSeriesItem;
import org.tizen.dynamicanalyzer.widgets.chartBoard.DACustomChartBoard;
import org.tizen.dynamicanalyzer.widgets.chartBoard.DACustomChartBoardItem;
}
private void createBoardItem(ThreadPageThreadData data) {
+ // DACustomChartBoardItem item = new DACustomChartBoardItem(board,
+ // data.getName());
+
DACustomChartBoardItem item = new DACustomChartBoardItem(board,
- data.getName());
+ data.getType() + ThreadPageLabels.THREAD_CHART_NAME_PREFIX
+ + ThreadPageLabels.THREAD_CHART_NAME_TID
+ + data.getName()
+ + ThreadPageLabels.THREAD_CHART_NAME_POSTFIX);
DACustomChart chart = item.getChart();
setChartSeries(chart);
setChartStyle(chart);
DACustomChartSeries stateSeries = new DACustomChartSeries(
ThreadPageLabels.THREAD_SYNC_CHART_SERIES_STATE,
- DACustomChartSeries.SERIES_STYLE_EVENT, ColorResources.RED);
+ DACustomChartSeries.SERIES_STYLE_STATE, ColorResources.YELLOW);
chart.addSeries(stateSeries);
if (null == parent) {
return false;
}
+ // DACustomChartBoardItem item = new DACustomChartBoardItem(parent,
+ // sync.getName() + ThreadPageLabels.THREAD_CHART_NAME_PREFIX
+ // + sync.getType()
+ // + ThreadPageLabels.THREAD_CHART_NAME_POSTFIX);
DACustomChartBoardItem item = new DACustomChartBoardItem(parent,
- sync.getName() + ThreadPageLabels.THREAD_CHART_NAME_PREFIX
- + sync.getType()
+ sync.getType() + ThreadPageLabels.THREAD_CHART_NAME_PREFIX
+ + ThreadPageLabels.THREAD_CHART_NAME_OBJ
+ + sync.getName()
+ ThreadPageLabels.THREAD_CHART_NAME_POSTFIX);
DACustomChart chart = item.getChart();
initSyncChart(chart);
System.out.println("error : parseLoad - tid parsing");
break;
}
- if (null == findParentData(tid)) {
- continue;
- }
+ // if (null == findParentData(tid)) {
+ // continue;
+ // }
load = (int) (Double.parseDouble(temp[j + 1]) * 2.55);
time = Double.parseDouble(input
.get(LogCenterConstants.DEVICE_TIME_INDEX))
/ TimelineConstants.MEGA;
-
ThreadPageThreadDataEvent event = new ThreadPageThreadDataEvent(
ThreadPageThreadDataEvent.TYPE_LOAD, load, -1, time,
tid, null);
break;
case LogCenterConstants.SYNC_TYPE_PTHREAD_MUTEX:
case LogCenterConstants.SYNC_TYPE_PTHREAD_COND_VARIABLE:
+ event = new ThreadPageSyncDataEvent(name, type, apiType, time,
+ tid, input);
+ pushSyncEvent(event);
break;
case LogCenterConstants.SYNC_TYPE_PTHREAD_RWLOCK:
case LogCenterConstants.SYNC_TYPE_PTHREAD_SPINLOCK:
case LogCenterConstants.SYNC_TYPE_PTHREAD_BARRIER:
+ event = new ThreadPageSyncDataEvent(name, type, apiType, time,
+ tid, input);
+ pushSyncEvent(event);
System.out.println("error : sync parse - type = " + type);
break;
default:
if (null == callEvent.getChartItem()) {
callEvent.setCallerTid(event.getTid());
} else {
- callEvent.getChartItem().setY(1);
+ callEvent
+ .getChartItem()
+ .setY(DACustomChartSeriesItem.SERIES_ARROW_RIGHT);
callEvent.getChartItem().setBarWidth(
event.getTid());
}
if (null == callEvent.getChartItem()) {
callEvent.setCallerTid(event.getTid());
} else {
- callEvent.getChartItem().setY(1);
+ callEvent
+ .getChartItem()
+ .setY(DACustomChartSeriesItem.SERIES_ARROW_RIGHT);
callEvent.getChartItem().setBarWidth(
event.getTid());
}