From: p.privalov Date: Tue, 2 Aug 2016 08:28:05 +0000 (+0300) Subject: SRADA-966 MemoryCallStackView tab added to MemoryPage. X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=95e22d9687494e8442ef48a06279427a340417f9;p=sdk%2Ftools%2Fdynamic-analyzer.git SRADA-966 MemoryCallStackView tab added to MemoryPage. * Right bottom view of MemoryPage is a DATabComposite now. * It contains CallStackView and MemoryMapView. MemoryCallStackView redesigned. * Implemented MemoryCallStackView.updateView(DAViewData). * CallStackTable.updateCallStackTable(DASelectionData): added clause to work with MemoryAllocationTraceTable's items. * MemoryPage: added parameter allocationtraceViewID, required for DASelectionData specification. * MemoryPage: CallstackView replaced with MemoryCallStackView to specify behavior. * MemoryAllocationTraceTable: selectionListener's method widgetSelected(SelectionEvent) implemented analogous to those of CallTraceTable. * MemoryAllocationTraceTable: in makeTableInput() methods added type information to TableItems. Conflicts: org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/memory/table/MemoryAllocationTraceTable.java Change-Id: Iacf8d141741fbbb50c5b2b417e52f22881964734 --- diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/info/callstack/CallstackTable.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/info/callstack/CallstackTable.java index 04a9726..8cd58f7 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/info/callstack/CallstackTable.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/info/callstack/CallstackTable.java @@ -34,13 +34,11 @@ import org.eclipse.nebula.widgets.grid.GridItem; import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.widgets.Composite; import org.tizen.dynamicanalyzer.common.AnalyzerConstants; import org.tizen.dynamicanalyzer.common.AnalyzerManager; import org.tizen.dynamicanalyzer.common.DASelectionData; import org.tizen.dynamicanalyzer.common.Global; -import org.tizen.dynamicanalyzer.model.FilterProperty; import org.tizen.dynamicanalyzer.model.TableInput; import org.tizen.dynamicanalyzer.project.callstack.RuntimeCallstackManager; import org.tizen.dynamicanalyzer.swap.model.data.LogData; @@ -128,7 +126,11 @@ public class CallstackTable extends DATableComposite { seqNum = (Long) calltraceData.get(FunctionEntryDBTable.COLUMN.SEQUENCE_NUMBER.index); pid = (Integer) calltraceData.get(FunctionEntryDBTable.COLUMN.PID.index); time = (Long) calltraceData.get(FunctionEntryDBTable.COLUMN.START_TIME.index); - } else if (tableData.getType() == AnalyzerConstants.TYPE_TABLE_INTERACTIVE) { + } else if (tableData.getType() == AnalyzerConstants.TYPE_TABLE_MEM_ALLOCATEDTRACE) { + GridItem gridItem = new GridItem(table, SWT.NONE); + gridItem.setText(0, "Stub for callstack"); + return; + }else if (tableData.getType() == AnalyzerConstants.TYPE_TABLE_INTERACTIVE) { return; // TODO } else { // in case table has LogData LogData logData = tableData.getLogData(); diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/memory/MemoryCallStackView.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/memory/MemoryCallStackView.java index a427259..26b20d7 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/memory/MemoryCallStackView.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/memory/MemoryCallStackView.java @@ -27,18 +27,16 @@ package org.tizen.dynamicanalyzer.ui.memory; import org.eclipse.nebula.widgets.grid.GridItem; import org.eclipse.swt.SWT; 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.Control; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; import org.tizen.dynamicanalyzer.common.DASelectionData; -import org.tizen.dynamicanalyzer.constant.CommonConstants; +import org.tizen.dynamicanalyzer.nl.InformationViewLabels; import org.tizen.dynamicanalyzer.nl.MemoryPageLabels; import org.tizen.dynamicanalyzer.resources.ColorResources; -import org.tizen.dynamicanalyzer.resources.FontResources; +import org.tizen.dynamicanalyzer.ui.info.callstack.CallStackInserter; +import org.tizen.dynamicanalyzer.ui.info.callstack.CallstackTable; +import org.tizen.dynamicanalyzer.ui.widgets.table.DATableComposite; +import org.tizen.dynamicanalyzer.ui.widgets.table.TableColumnSizePackListener; import org.tizen.dynamicanalyzer.widgets.da.view.DAViewComposite; import org.tizen.dynamicanalyzer.widgets.da.view.DAViewData; @@ -46,73 +44,62 @@ public class MemoryCallStackView extends DAViewComposite { public static final String ID = MemoryCallStackView.class.getName(); - private Composite contents = null; - private Text detailText = null; - private Label labelMessage = null; - - private void init() { - detailText.setText(CommonConstants.EMPTY); - } + private DATableComposite callstackTableComp = null; + private String[] columnNames = { InformationViewLabels.CALLSTACK_VIEW_FUNCTION, + InformationViewLabels.CALLSTACK_VIEW_ADDRESS, + InformationViewLabels.CALLSTACK_VIEW_BINARY_PATH }; + private int[] columnSizes = { 120, 70, 400 }; + private boolean[] columnVisibility = { true, true, true }; + Composite contents = null; + + // this definition should be here for creation of instance (register db table) + @SuppressWarnings("unused") + private static CallStackInserter inserter = CallStackInserter.getInstance(); public MemoryCallStackView(Composite parent, int style) { super(parent, style, false); this.setLayout(new FillLayout()); - setTitle(MemoryPageLabels.MEMORY_CALLSTACK_VIEW_TITLE); - - Composite detailCom = getContentArea(); - detailCom.setBackground(ColorResources.VIEW_BG_COLOR); - detailCom.setLayout(new FormLayout()); - FormData labelData = new FormData(); - labelData.top = new FormAttachment(0, 0); - labelData.left = new FormAttachment(0, 0); - labelData.right = new FormAttachment(100, 0); - labelData.bottom = new FormAttachment(100, 0); - detailCom.setLayoutData(labelData); - - Composite contents = detailCom; - contents.setBackground(ColorResources.VIEW_BG_COLOR); - contents.setLayout(new FormLayout()); - - detailText = new Text(contents, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL); - detailText.setBackground(ColorResources.VIEW_BG_COLOR); - detailText.setForeground(ColorResources.TABLE_CONTENTS_FONT_COLOR); - detailText.setFont(FontResources.DETAIL_INFO_FONT); - - FormData buttonData = new FormData(); - buttonData.top = new FormAttachment(labelMessage, 0); - buttonData.left = new FormAttachment(0, 0); - buttonData.right = new FormAttachment(100, 0); - buttonData.bottom = new FormAttachment(100, 0); - detailText.setLayoutData(buttonData); + + contents = getContentArea(); + contents.setBackground(ColorResources.WINDOW_BG_COLOR); + contents.setLayout(new FillLayout()); + + callstackTableComp = new CallstackTable(contents, SWT.NONE, SWT.SINGLE | SWT.BORDER + | SWT.H_SCROLL | SWT.V_SCROLL); + callstackTableComp.setTableName("Callstack"); //$NON-NLS-1$ + callstackTableComp.setColumns(columnNames); + callstackTableComp.setColumnSize(columnSizes); + callstackTableComp.setColumnVisibility(columnVisibility); + + contents.addControlListener(new TableColumnSizePackListener(callstackTableComp, columnSizes)); } - + @Override public void updateView() { - } - + @Override public void updateView(DAViewData data) { - if (data instanceof DASelectionData == false) { + if (!(data instanceof DASelectionData)) return; - } + DASelectionData seldata = (DASelectionData) data; + if (seldata.getData() instanceof GridItem[]) { - + ((CallstackTable) callstackTableComp).updateCallstackTable(seldata); } else { - + updateView(); } } - - @Override - public Control getControl() { - return contents; - } @Override public void clear() { - init(); + callstackTableComp.clear(); } + @Override + public Control getControl() { + return callstackTableComp; + } } diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/memory/MemoryPage.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/memory/MemoryPage.java index c0f5e98..f2ab2ff 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/memory/MemoryPage.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/memory/MemoryPage.java @@ -38,7 +38,6 @@ import org.tizen.dynamicanalyzer.nl.AnalyzerLabels; import org.tizen.dynamicanalyzer.resources.ColorResources; import org.tizen.dynamicanalyzer.setting.SettingDataManager; import org.tizen.dynamicanalyzer.shortcut.ShortCutManager; -import org.tizen.dynamicanalyzer.swap.logparser.DataManagerRegistry; import org.tizen.dynamicanalyzer.ui.memory.data.HeapDataManager; import org.tizen.dynamicanalyzer.ui.memory.data.MemoryDataManager; import org.tizen.dynamicanalyzer.ui.page.BaseView; @@ -56,6 +55,8 @@ public class MemoryPage extends DAPageComposite { public static final String chartViewID = MemoryChartView.class.getName(); public static final String detailsViewID = MemoryDetailsTableView.class.getName(); public static final String mapViewID = MemoryMapView.class.getName(); + public static final String allocationtraceViewID = MemoryAllocationTraceTableView.class.getName(); + SashForm baseForm; SashForm topForm; @@ -121,17 +122,18 @@ public class MemoryPage extends DAPageComposite { } addView(memoryTabView); - DATabComposite memoryMapCallStackView = new DATabComposite(bottomRightForm, SWT.NONE, false, true); + DATabComposite memoryRightTabView = new DATabComposite(bottomRightForm, SWT.NONE, false, true); { - memoryMapView = new MemoryMapView(memoryMapCallStackView.getContentComposite(), SWT.NONE); + memoryCallStackView = new MemoryCallStackView(memoryRightTabView.getContentComposite(), SWT.NONE); + memoryRightTabView.addView(memoryCallStackView, false); + addView(memoryCallStackView); + + memoryMapView = new MemoryMapView(memoryRightTabView.getContentComposite(), SWT.NONE); + memoryRightTabView.addView(memoryMapView, false); addView(memoryMapView); - memoryMapCallStackView.addView(memoryMapView, false); - // It make ui hang issue. But this tab must be included. - //memoryCallStackView = new MemoryCallStackView(memoryMapCallStackView.getContentComposite(), SWT.NONE); - //addView(memoryCallStackView); - //memoryMapCallStackView.addView(memoryCallStackView, false); } - addView(memoryMapCallStackView); + addView(memoryRightTabView); + baseForm.setSashWidth(AnalyzerConstants.SASH_WIDTH); bottomForm.setSashWidth(AnalyzerConstants.SASH_WIDTH); diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/memory/table/MemoryAllocationTraceTable.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/memory/table/MemoryAllocationTraceTable.java index a2576d1..f5e3688 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/memory/table/MemoryAllocationTraceTable.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/memory/table/MemoryAllocationTraceTable.java @@ -36,12 +36,14 @@ import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.events.SelectionListener; import org.eclipse.swt.widgets.Composite; import org.tizen.dynamicanalyzer.common.AnalyzerConstants; +import org.tizen.dynamicanalyzer.common.AnalyzerManager; +import org.tizen.dynamicanalyzer.common.DASelectionData; import org.tizen.dynamicanalyzer.common.DAState; import org.tizen.dynamicanalyzer.common.Global; import org.tizen.dynamicanalyzer.model.TableInput; import org.tizen.dynamicanalyzer.nl.MemoryPageLabels; +import org.tizen.dynamicanalyzer.ui.memory.MemoryPage; import org.tizen.dynamicanalyzer.ui.memory.data.HeapDataManager; -import org.tizen.dynamicanalyzer.ui.timeline.calltrace.FunctionEntryDBTable; import org.tizen.dynamicanalyzer.ui.toolbar.Toolbar; import org.tizen.dynamicanalyzer.ui.widgets.table.DATableComposite; import org.tizen.dynamicanalyzer.ui.widgets.table.DATableDataFormat; @@ -96,11 +98,21 @@ public class MemoryAllocationTraceTable extends DATableComposite { @Override public void widgetSelected(SelectionEvent e) { - - GridItem[] items = table.getSelection(); - if (null == items) { + GridItem[] items = ((Grid) e.widget).getSelection(); + if (null == items|| items.length == 0) { return; } + int size = items.length; + List startData = ((DATableDataFormat) items[0].getData()).getData(); + List endData = ((DATableDataFormat) items[size - 1].getData()).getData(); + long startTime = (Long) startData.get(1);//1 is an index of timestamp column in table. + long endTime = (Long) endData.get(1); + Toolbar.INSTANCE.setChartDragStartTime(startTime); + Toolbar.INSTANCE.setChartDragEndTime(endTime); + Toolbar.INSTANCE.setDlogSelection(false); + DASelectionData data = new DASelectionData(MemoryPage.allocationtraceViewID, startTime, + endTime, items, table); + AnalyzerManager.getCurrentPage().updateView(data); } @Override @@ -169,8 +181,8 @@ public class MemoryAllocationTraceTable extends DATableComposite { List iAllocData = allocDataList.get(j); TableInput alloInput = HeapDataManager.getInstance().makeTreeInputForLeakData(iAllocData, index++); - if (alloInput != null){ + ((DATableDataFormat)alloInput.getData()).setType(AnalyzerConstants.TYPE_TABLE_MEM_ALLOCATEDTRACE); output.add(alloInput); } }