From c8d15b9f7258f64d36faa7f3fc3cea46488e7616 Mon Sep 17 00:00:00 2001 From: jaeyong lee Date: Thu, 11 Aug 2016 10:58:21 +0900 Subject: [PATCH] [SRADA-1005] Some improvement at Thread page * remove toggle swtich due to we'll merge Thread feature & Sync Feature into one, Thread Analysis * align PID/TID in a line * insert marker line into 'mutex' sub-chart * create marker by double-clicking on Thread API list table Change-Id: I08068d3eace4e8cc2b15c789e0ab62ab4adba65d --- .../dynamicanalyzer/nl/ThreadPageLabels.properties | 4 +- .../ui/thread/ThreadAPIListTable.java | 81 +++++++++++++ .../ui/thread/chart/SyncChartBoard.java | 4 + .../ui/thread/chart/ThreadChartView.java | 125 +++------------------ 4 files changed, 105 insertions(+), 109 deletions(-) diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/ThreadPageLabels.properties b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/ThreadPageLabels.properties index 70d6d22..1ac3aeb 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/ThreadPageLabels.properties +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/ThreadPageLabels.properties @@ -42,8 +42,8 @@ THREAD_CHART_NAME_PREFIX=\n( THREAD_CHART_NAME_POSTFIX=) THREAD_CHART_NAME_PID=PID : THREAD_CHART_NAME_TID=TID : -THREAD_CHART_NAME_COMMA=,\n -THREAD_CHART_NAME_OBJ=object name :\n +THREAD_CHART_NAME_COMMA=, +THREAD_CHART_NAME_OBJ=object name : THREAD_SYNC_CHART_SERIES_STATE=STATE diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/thread/ThreadAPIListTable.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/thread/ThreadAPIListTable.java index 3065f79..b2e4057 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/thread/ThreadAPIListTable.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/thread/ThreadAPIListTable.java @@ -34,8 +34,11 @@ import java.util.Collections; import java.util.Comparator; import java.util.List; +import org.eclipse.nebula.widgets.grid.Grid; import org.eclipse.nebula.widgets.grid.GridColumn; import org.eclipse.nebula.widgets.grid.GridItem; +import org.eclipse.swt.events.MouseEvent; +import org.eclipse.swt.events.MouseListener; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.events.SelectionListener; import org.eclipse.swt.widgets.Composite; @@ -49,6 +52,17 @@ import org.tizen.dynamicanalyzer.model.FilterProperty; import org.tizen.dynamicanalyzer.model.TableInput; import org.tizen.dynamicanalyzer.swap.model.data.ProbeCommonData; import org.tizen.dynamicanalyzer.swap.model.data.SyncData; +import org.tizen.dynamicanalyzer.ui.file.FileChartView; +import org.tizen.dynamicanalyzer.ui.file.FilePage; +import org.tizen.dynamicanalyzer.ui.memory.MemoryChartView; +import org.tizen.dynamicanalyzer.ui.memory.MemoryPage; +import org.tizen.dynamicanalyzer.ui.network.NetworkChartView; +import org.tizen.dynamicanalyzer.ui.network.NetworkPage; +import org.tizen.dynamicanalyzer.ui.opengl.GLPage; +import org.tizen.dynamicanalyzer.ui.opengl.chart.GLChartView; +import org.tizen.dynamicanalyzer.ui.page.BaseView; +import org.tizen.dynamicanalyzer.ui.range.RangeDataManager; +import org.tizen.dynamicanalyzer.ui.thread.chart.ThreadChartView; import org.tizen.dynamicanalyzer.ui.thread.data.ThreadDataManager; import org.tizen.dynamicanalyzer.ui.thread.db.SyncAPIDBTable; import org.tizen.dynamicanalyzer.ui.thread.db.ThreadAPIDBTable; @@ -56,9 +70,15 @@ import org.tizen.dynamicanalyzer.ui.thread.type.ThreadPageData; import org.tizen.dynamicanalyzer.ui.thread.type.ThreadPageSyncData; import org.tizen.dynamicanalyzer.ui.thread.type.ThreadPageSyncDataEvent; import org.tizen.dynamicanalyzer.ui.thread.type.ThreadPageThreadData; +import org.tizen.dynamicanalyzer.ui.timeline.TimelinePage; +import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineChartView; +import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants; +import org.tizen.dynamicanalyzer.ui.toolbar.Toolbar; import org.tizen.dynamicanalyzer.ui.widgets.table.DAApiListTableComposite; import org.tizen.dynamicanalyzer.ui.widgets.table.DATableDataFormat; import org.tizen.dynamicanalyzer.util.Logger; +import org.tizen.dynamicanalyzer.util.WorkbenchUtil; +import org.tizen.dynamicanalyzer.utils.AnalyzerUtil; import org.tizen.dynamicanalyzer.utils.Formatter; public class ThreadAPIListTable extends DAApiListTableComposite { @@ -107,6 +127,67 @@ public class ThreadAPIListTable extends DAApiListTableComposite { // do nothing } }); + + table.addMouseListener(new MouseListener() { + + @Override + public void mouseUp(MouseEvent e) { + // TODO Auto-generated method stub + + } + + @Override + public void mouseDown(MouseEvent e) { + // TODO Auto-generated method stub + + } + + @Override + public void mouseDoubleClick(MouseEvent e) { + GridItem[] ti = ((Grid) e.widget).getSelection(); + if (null == ti || ti.length == 0) { + return; + } + List markerData = ((DATableDataFormat) ti[0].getData()).getData(); + long markerTime = Long.parseLong((String)markerData.get(1)); + addMarker(markerTime); + } + }); + } + + private void addMarker(long markerTime) { + double startMarkerTime = markerTime / (TimelineConstants.MEGA_DOUBLE); + + TimelineChartView TLchartView = (TimelineChartView) AnalyzerUtil.getView(TimelinePage.pageID, TimelineChartView.class.getName()); + NetworkChartView NETchartView = (NetworkChartView) AnalyzerUtil.getView(NetworkPage.pageID, NetworkChartView.class.getName()); + ThreadChartView THRchartView = (ThreadChartView) AnalyzerUtil.getView(ThreadPage.pageID, ThreadChartView.class.getName()); + FileChartView FLchartView = (FileChartView) AnalyzerUtil.getView(FilePage.pageID, FileChartView.class.getName()); + GLChartView GLchartview = (GLChartView) AnalyzerUtil.getView(GLPage.pageID, GLChartView.class.getName()); + MemoryChartView MMchartView = (MemoryChartView) AnalyzerUtil.getView(MemoryPage.pageID, MemoryChartView.class.getName()); + + //1. add marker to rangedatamanager + RangeDataManager.getInstance().addMarkerTime(markerTime); + + //2. add marker to toolbar + Toolbar.INSTANCE.addMarkerTime(startMarkerTime); + + if(TLchartView != null) + TLchartView.updateView(); + if(NETchartView != null) + NETchartView.updateView(); + if(THRchartView != null) + THRchartView.updateView(); + if(FLchartView != null) + FLchartView.updateView(); + if(GLchartview != null) + GLchartview.updateView(); + if(MMchartView != null) + MMchartView.updateView(); + + AnalyzerUtil.getMainTab().getTopComposite().updateView(); + /// draw marker clearly + BaseView baseView = (BaseView) WorkbenchUtil.getViewPart(BaseView.ID); + baseView.getTopComposite().updateView(); } @Override diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/thread/chart/SyncChartBoard.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/thread/chart/SyncChartBoard.java index 5198bd1..ec3b426 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/thread/chart/SyncChartBoard.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/thread/chart/SyncChartBoard.java @@ -412,4 +412,8 @@ public class SyncChartBoard extends DAChartBoard { } return returnList; } + + public List getSyncChartList() { + return syncChartItemList; + } } diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/thread/chart/ThreadChartView.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/thread/chart/ThreadChartView.java index f1f8a75..9ec6776 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/thread/chart/ThreadChartView.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/thread/chart/ThreadChartView.java @@ -96,9 +96,6 @@ public class ThreadChartView extends DAViewComposite { private DAToolBarCustomCombo threadProcessCombo; private DAToolBarCustomCombo syncProcessCombo; - - private DACustomButton threadDimensionSwitchButton; - private DACustomButton syncDimensionSwitchButton; public ThreadChartView(Composite parent, int style) { super(parent, style, false); @@ -131,110 +128,13 @@ public class ThreadChartView extends DAViewComposite { FormData data = new FormData(); data.top = new FormAttachment(0, 0); data.left = new FormAttachment(0, 0); - data.width = 167; + data.width = 192; data.height = 25; threadProcessCombo.setLayoutData(data); syncProcessCombo = makeDACustomCombo(syncChartBoard.getTitleComp()); syncProcessCombo.setLayoutData(data); - threadDimensionSwitchButton = new DACustomButton(threadChartBoard.getTitleComp(), - ImageResources.DIMENSION_IC_NOR, - ImageResources.DIMENSION_IC_NOR, - ImageResources.DIMENSION_IC_NOR, - ImageResources.DIMENSION_IC_NOR - ); - - syncDimensionSwitchButton = new DACustomButton(syncChartBoard.getTitleComp(), - ImageResources.DIMENSION_IC_SEL, - ImageResources.DIMENSION_IC_SEL, - ImageResources.DIMENSION_IC_SEL, - ImageResources.DIMENSION_IC_SEL - ); - - threadDimensionSwitchButton.setForeground(ColorResources.GRAY_170); - threadDimensionSwitchButton.setBackground(ColorResources.WHITE); - syncDimensionSwitchButton.setForeground(ColorResources.GRAY_170); - syncDimensionSwitchButton.setBackground(ColorResources.WHITE); - - threadDimensionSwitchButton.setRenderer(new DACustomButtonRenderer() { - @Override - public void draw(GC gc, Canvas canvas, int state, - DACustomButtonAttribute attr) { - Rectangle rect = canvas.getClientArea(); - - if (attr.getDrawType() == DACustomButton.TYPE_IMAGE) { - drawImageButton(gc, rect, state, attr); - } else if (attr.getDrawType() == DACustomButton.TYPE_COLOR - || attr.getDrawType() == DACustomButton.TYPE_GRADATION) { - drawButton(gc, rect, state, attr); - } - drawButtonImage(gc, rect, attr, state); - drawIcon(gc, rect, attr); - gc.drawLine(0, 0, 25, 0); - gc.drawLine(0, 24, 25, 24); - gc.drawLine(24, 0, 24, 24); - } - }); - - syncDimensionSwitchButton.setRenderer(new DACustomButtonRenderer() { - @Override - public void draw(GC gc, Canvas canvas, int state, - DACustomButtonAttribute attr) { - Rectangle rect = canvas.getClientArea(); - - if (attr.getDrawType() == DACustomButton.TYPE_IMAGE) { - drawImageButton(gc, rect, state, attr); - } else if (attr.getDrawType() == DACustomButton.TYPE_COLOR - || attr.getDrawType() == DACustomButton.TYPE_GRADATION) { - drawButton(gc, rect, state, attr); - } - drawButtonImage(gc, rect, attr, state); - drawIcon(gc, rect, attr); - gc.drawLine(0, 0, 25, 0); - gc.drawLine(0, 24, 25, 24); - gc.drawLine(24, 0, 24, 24); - } - }); - - threadDimensionSwitchButton.addClickListener(new DACustomButtonClickEventListener() { - @Override - public void handleEvent(Event event) { - changeBoardThreadToSync(); - } - - @Override - public void handleClickEvent(DACustomButton button) { - - } - }); - - syncDimensionSwitchButton.addClickListener(new DACustomButtonClickEventListener() { - @Override - public void handleEvent(Event event) { - changeBoardSyncToThread(); - } - - @Override - public void handleClickEvent(DACustomButton button) { - - } - }); - - data = new FormData(); - data.top = new FormAttachment(0, 0); - data.left = new FormAttachment(threadProcessCombo, 0); - data.width = 25; - data.height = 25; - threadDimensionSwitchButton.setLayoutData(data); - - data = new FormData(); - data.top = new FormAttachment(0, 0); - data.left = new FormAttachment(syncProcessCombo, 0); - data.width = 25; - data.height = 25; - syncDimensionSwitchButton.setLayoutData(data); - initProcessCombo(threadProcessCombo); initProcessCombo(syncProcessCombo); updateScale(); @@ -282,7 +182,7 @@ public class ThreadChartView extends DAViewComposite { ImageResources.DROP_ARROW_DOWN_SEL, ImageResources.DROP_ARROW_DOWN_HOVER, ImageResources.DROP_ARROW_DOWN_DIM); - returnCombo.setComboImagePoint(new Point(135, 9)); + returnCombo.setComboImagePoint(new Point(160, 9)); returnCombo.setComboButtonColor(ColorResources.WHITE, ColorResources.WHITE, ColorResources.WHITE, @@ -603,16 +503,27 @@ public class ThreadChartView extends DAViewComposite { public void updateMarker() { List markerTimeList = Toolbar.INSTANCE.getMarkerTimeList(); - List chartList = threadChartBoard.getThreadChartItemList(); - for(ThreadChart chart : chartList) { - chart.getChart().getPlot().clearMarkerTime(); + + List threadChartList = threadChartBoard.getThreadChartItemList(); + for(ThreadChart threadChart : threadChartList) { + threadChart.getChart().getPlot().clearMarkerTime(); } for(double time : markerTimeList) { - for(ThreadChart chart : chartList) { - chart.getChart().getPlot().addMarkerTime(time); + for(ThreadChart threadChart : threadChartList) { + threadChart.getChart().getPlot().addMarkerTime(time); } threadChartBoard.getTimeline().addMarker(time); } + + List syncChartList = threadChartBoard.getSyncChartList(); + for(SyncChart syncChart : syncChartList) { + syncChart.getChart().getPlot().clearMarkerTime(); + } + for(double time : markerTimeList) { + for(SyncChart syncChart : syncChartList) { + syncChart.getChart().getPlot().addMarkerTime(time); + } + } } @Override -- 2.7.4