Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 60265 Details for
Bug 167995
Enhance Heap Statistics View
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Allocation Details initial impl - Mar 5
org.eclipse.tptp.trace.jvmti.client_200703050000-patch (text/plain), 45.64 KB, created by
Ruslan Scherbakov
on 2007-03-05 10:11:35 EST
(
hide
)
Description:
Allocation Details initial impl - Mar 5
Filename:
MIME Type:
Creator:
Ruslan Scherbakov
Created:
2007-03-05 10:11:35 EST
Size:
45.64 KB
patch
obsolete
>Index: src/org/eclipse/tptp/trace/jvmti/internal/client/context/TIContextProvider.java >=================================================================== >RCS file: /cvsroot/tptp/trace/org.eclipse.tptp.trace.jvmti.client/src/org/eclipse/tptp/trace/jvmti/internal/client/context/TIContextProvider.java,v >retrieving revision 1.1 >diff -u -r1.1 TIContextProvider.java >--- src/org/eclipse/tptp/trace/jvmti/internal/client/context/TIContextProvider.java 27 Feb 2007 18:37:34 -0000 1.1 >+++ src/org/eclipse/tptp/trace/jvmti/internal/client/context/TIContextProvider.java 5 Mar 2007 14:55:11 -0000 >@@ -19,7 +19,6 @@ > import java.util.Map; > > import org.eclipse.hyades.trace.views.internal.context.java.BasicContextProvider; >-import org.eclipse.hyades.ui.provisional.context.IContextAttributes; > import org.eclipse.hyades.ui.provisional.context.IContextLabelFormatProvider; > > public class TIContextProvider extends BasicContextProvider implements TIContextAttributes { >@@ -75,29 +74,29 @@ > result = new AverageAgeLP(); > else if (key.equals(PACKAGE_GENERATIONS) || key.equals(CLASS_GENERATIONS) || key.equals(CALL_SITE_GENERATIONS)) > result = new GenerationsLP(); >- else if (key.equals(IContextAttributes.THREAD_NAME)) >+ else if (key.equals(THREAD_NAME)) > result = new ThreadNameLP(); >- else if (key.equals(IContextAttributes.THREAD_CLASS_NAME)) >+ else if (key.equals(THREAD_CLASS_NAME)) > result = new ThreadClassNameLP(); >- else if (key.equals(IContextAttributes.THREAD_START_TIME)) >+ else if (key.equals(THREAD_START_TIME)) > result = new ThreadStartTimeLP(); >- else if (key.equals(IContextAttributes.THREAD_STOP_TIME)) >+ else if (key.equals(THREAD_STOP_TIME)) > result = new ThreadStopTimeLP(); >- else if (key.equals(IContextAttributes.THREAD_STATE)) >+ else if (key.equals(THREAD_STATE)) > result = new ThreadStateLP(); >- else if (key.equals(IContextAttributes.THREAD_RUNNING_TIME)) >+ else if (key.equals(THREAD_RUNNING_TIME)) > result = new ThreadRunningTimeLP(); >- else if (key.equals(IContextAttributes.THREAD_SLEEPING_TIME)) >+ else if (key.equals(THREAD_SLEEPING_TIME)) > result = new ThreadSleepingTimeLP(); >- else if (key.equals(IContextAttributes.THREAD_WAITING_TIME)) >+ else if (key.equals(THREAD_WAITING_TIME)) > result = new ThreadWaitingTimeLP(); >- else if (key.equals(IContextAttributes.THREAD_BLOCKED_TIME)) >+ else if (key.equals(THREAD_BLOCKED_TIME)) > result = new ThreadBlockedTimeLP(); >- else if (key.equals(IContextAttributes.THREAD_DEADLOCKED_TIME)) >+ else if (key.equals(THREAD_DEADLOCKED_TIME)) > result = new ThreadDeadlockedTimeLP(); >- else if (key.equals(IContextAttributes.THREAD_BLOCK_COUNT)) >+ else if (key.equals(THREAD_BLOCK_COUNT)) > result = new ThreadBlockCountLP(); >- else if (key.equals(IContextAttributes.THREAD_DEADLOCK_COUNT)) >+ else if (key.equals(THREAD_DEADLOCK_COUNT)) > result = new ThreadDeadlockCountLP(); > } else { > result = super.getContextLabelFormatProvider(key); >Index: src/org/eclipse/tptp/trace/jvmti/internal/client/views/MemoryAnalysisPage.java >=================================================================== >RCS file: /cvsroot/tptp/trace/org.eclipse.tptp.trace.jvmti.client/src/org/eclipse/tptp/trace/jvmti/internal/client/views/MemoryAnalysisPage.java,v >retrieving revision 1.2 >diff -u -r1.2 MemoryAnalysisPage.java >--- src/org/eclipse/tptp/trace/jvmti/internal/client/views/MemoryAnalysisPage.java 1 Mar 2007 17:53:15 -0000 1.2 >+++ src/org/eclipse/tptp/trace/jvmti/internal/client/views/MemoryAnalysisPage.java 5 Mar 2007 14:55:11 -0000 >@@ -16,8 +16,10 @@ > > import org.eclipse.emf.ecore.EObject; > import org.eclipse.hyades.models.hierarchy.extensions.SimpleSearchQuery; >+import org.eclipse.hyades.trace.ui.ITraceSelection; > import org.eclipse.hyades.trace.ui.TraceViewer; > import org.eclipse.hyades.trace.ui.TraceViewerPage; >+import org.eclipse.hyades.trace.ui.UIPlugin; > import org.eclipse.hyades.trace.views.internal.StatisticView; > import org.eclipse.swt.SWT; > import org.eclipse.swt.custom.CTabFolder; >@@ -71,6 +73,7 @@ > ; > } > public void widgetSelected(SelectionEvent e) { >+ updateAllocDetails(); > StatisticView view = _views[_tabFolder.getSelectionIndex()]; > view.updateUI(view.getColumnDataList()); > updateButtons(); >@@ -88,12 +91,11 @@ > > tabItem = new CTabItem(_tabFolder, SWT.NONE); > tabItem.setText("Allocation Details"); >- AllocationDetailsView allocView = new AllocationDetailsView(_tabFolder, this, memView); >+ AllocationDetailsView allocView = new AllocationDetailsView(_tabFolder, this); > _views[1] = allocView; > tabItem.setControl(_views[1].getControl()); > > memView._viewDetails = allocView; >- > _tabFolder.setSelection(0); > } > >@@ -159,4 +161,21 @@ > StatisticView view = _views[_tabFolder.getSelectionIndex()]; > return view.isShowPercent(); > } >+ >+ void showAllocDetails() { >+ setViewMode(TAB_ALLOC_DETAILS, 0); >+ updateAllocDetails(); >+ } >+ >+ void updateAllocDetails() { >+ StatisticView view = _views[_tabFolder.getSelectionIndex()]; >+ if (view instanceof AllocationDetailsView) { >+ ITraceSelection model = UIPlugin.getDefault().getSelectionModel(getMOFObject()); >+ if (model.size() > 0) { >+ Object obj = model.getFirstElement(); >+ ((AllocationDetailsView) view).showAllocDetails(obj); >+ } else >+ ((AllocationDetailsView) view).showAllocDetails(null); >+ } >+ } > } >Index: src/org/eclipse/tptp/trace/jvmti/internal/client/views/MemoryAnalysisViewer.java >=================================================================== >RCS file: /cvsroot/tptp/trace/org.eclipse.tptp.trace.jvmti.client/src/org/eclipse/tptp/trace/jvmti/internal/client/views/MemoryAnalysisViewer.java,v >retrieving revision 1.1 >diff -u -r1.1 MemoryAnalysisViewer.java >--- src/org/eclipse/tptp/trace/jvmti/internal/client/views/MemoryAnalysisViewer.java 27 Feb 2007 18:37:33 -0000 1.1 >+++ src/org/eclipse/tptp/trace/jvmti/internal/client/views/MemoryAnalysisViewer.java 5 Mar 2007 14:55:11 -0000 >@@ -25,11 +25,11 @@ > import org.eclipse.hyades.trace.views.internal.view.columnlabels.ContextUpdaterHelper; > import org.eclipse.hyades.trace.views.util.internal.OpenSource; > import org.eclipse.hyades.ui.filters.IFilterScopes; >-import org.eclipse.hyades.ui.provisional.context.IContextAttributes; > import org.eclipse.jface.action.Action; > import org.eclipse.jface.action.IMenuManager; > import org.eclipse.jface.action.IToolBarManager; > import org.eclipse.swt.widgets.Menu; >+import org.eclipse.tptp.trace.jvmti.internal.client.context.TIContextAttributes; > import org.eclipse.tptp.trace.jvmti.internal.client.widgets.Utils; > import org.eclipse.ui.IActionBars; > >@@ -156,8 +156,8 @@ > page.setViewMode(0, BaseMemoryStatisticView.PACKAGE_MODE); > } > }; >- Utils.setActionProperties(_viewPackage, _context, IContextAttributes.SHOW_PACKAGE_LEVEL); >- Utils.setActionProperties(_viewClass, _context, IContextAttributes.SHOW_CLASS_LEVEL); >+ Utils.setActionProperties(_viewPackage, _context, TIContextAttributes.SHOW_PACKAGE_LEVEL); >+ Utils.setActionProperties(_viewClass, _context, TIContextAttributes.SHOW_CLASS_LEVEL); > > String openSourceStr = TraceUIMessages._74; > _openSource = new Action(openSourceStr) { >Index: src/org/eclipse/tptp/trace/jvmti/internal/client/views/BaseMemoryStatisticView.java >=================================================================== >RCS file: /cvsroot/tptp/trace/org.eclipse.tptp.trace.jvmti.client/src/org/eclipse/tptp/trace/jvmti/internal/client/views/BaseMemoryStatisticView.java,v >retrieving revision 1.2 >diff -u -r1.2 BaseMemoryStatisticView.java >--- src/org/eclipse/tptp/trace/jvmti/internal/client/views/BaseMemoryStatisticView.java 1 Mar 2007 17:53:15 -0000 1.2 >+++ src/org/eclipse/tptp/trace/jvmti/internal/client/views/BaseMemoryStatisticView.java 5 Mar 2007 14:55:11 -0000 >@@ -21,7 +21,6 @@ > import org.eclipse.hyades.models.hierarchy.extensions.SimpleSearchQuery; > import org.eclipse.hyades.models.trace.TRCClass; > import org.eclipse.hyades.models.trace.TRCFullTraceObject; >-import org.eclipse.hyades.models.trace.TRCGCEvent; > import org.eclipse.hyades.models.trace.TRCPackage; > import org.eclipse.hyades.models.trace.impl.TRCClassImpl; > import org.eclipse.hyades.models.trace.impl.TRCPackageImpl; >@@ -35,10 +34,13 @@ > import org.eclipse.hyades.trace.views.internal.view.columnlabels.ColumnLabelAdapter; > import org.eclipse.hyades.trace.views.util.internal.ColumnData; > import org.eclipse.hyades.trace.views.util.internal.StatisticTableColumnInfo; >-import org.eclipse.hyades.ui.provisional.context.IContextAttributes; >+import org.eclipse.jface.viewers.StructuredViewer; >+import org.eclipse.jface.viewers.TreeViewer; > import org.eclipse.jface.viewers.Viewer; >+import org.eclipse.swt.events.SelectionEvent; > import org.eclipse.swt.graphics.Image; > import org.eclipse.swt.widgets.Composite; >+import org.eclipse.swt.widgets.Tree; > import org.eclipse.tptp.trace.jvmti.internal.client.context.TIContextAttributes; > import org.eclipse.tptp.trace.jvmti.internal.client.context.TIContextUpdaterHelper; > import org.eclipse.tptp.trace.jvmti.internal.client.views.columnlabels.LiveSizeLabelAdapter; >@@ -48,6 +50,7 @@ > import org.eclipse.tptp.trace.jvmti.internal.client.views.columnlabels.PackageNameLabelAdapter; > import org.eclipse.tptp.trace.jvmti.internal.client.views.columnlabels.TotalInstancesLabelAdapter; > import org.eclipse.tptp.trace.jvmti.internal.client.views.columnlabels.TotalSizeLabelAdapter; >+import org.eclipse.tptp.trace.jvmti.internal.client.widgets.Utils; > > public class BaseMemoryStatisticView extends BaseStatisticView { > >@@ -231,25 +234,25 @@ > } > > protected String getClassModeColumnsTemplate() { >- return >- IContextAttributes.THREAD_CLASS_NAME + ":" + CM_COL_NAME + ":" + String.valueOf(ColumnData.NONDELETABLE | V | ColumnData.NONMOVABLE) + ":left:150," >- + IContextAttributes.PACKAGE_NAME + ":" + CM_COL_PACKAGE_NAME + ":" + String.valueOf(ColumnData.NONDELETABLE | V | ColumnData.NONMOVABLE) + ":left:120," >- + IContextAttributes.CLASS_LIVE_INST + ":" + CM_COL_LIVE_INST + ":" + String.valueOf(V | D) + ":right:80," >- + IContextAttributes.CLASS_ACTIVE_SIZE + ":" + CM_COL_LIVE_SIZE + ":" + String.valueOf(V | D) + ":right:80," >- + IContextAttributes.CLASS_TOTAL_INST + ":" + CM_COL_TOTAL_INST + ":" + String.valueOf(V | D) + ":right:80," >- + IContextAttributes.CLASS_TOTAL_SIZE + ":" + CM_COL_TOTAL_SIZE + ":" + String.valueOf(V | D) + ":right:80," >+ return "" >+ + TIContextAttributes.THREAD_CLASS_NAME + ":" + CM_COL_NAME + ":" + String.valueOf(ColumnData.NONDELETABLE | V | ColumnData.NONMOVABLE) + ":left:150," >+ + TIContextAttributes.PACKAGE_NAME + ":" + CM_COL_PACKAGE_NAME + ":" + String.valueOf(ColumnData.NONDELETABLE | V | ColumnData.NONMOVABLE) + ":left:120," >+ + TIContextAttributes.CLASS_LIVE_INST + ":" + CM_COL_LIVE_INST + ":" + String.valueOf(V | D) + ":right:80," >+ + TIContextAttributes.CLASS_ACTIVE_SIZE + ":" + CM_COL_LIVE_SIZE + ":" + String.valueOf(V | D) + ":right:80," >+ + TIContextAttributes.CLASS_TOTAL_INST + ":" + CM_COL_TOTAL_INST + ":" + String.valueOf(V | D) + ":right:80," >+ + TIContextAttributes.CLASS_TOTAL_SIZE + ":" + CM_COL_TOTAL_SIZE + ":" + String.valueOf(V | D) + ":right:80," > + TIContextAttributes.CLASS_AVG_AGE + ":" + CM_COL_AVG_AGE + ":" + String.valueOf(V) + ":right:80" > //+ TIContextAttributes.CLASS_GENERATIONS + ":" + CM_COL_GENERATIONS + ":" + String.valueOf(V | D) + ":right:80" > ; > } > > protected String getPackageModeColumnsTemplate() { >- return >- IContextAttributes.PACKAGE_NAME + ":" + PM_COL_NAME + ":" + String.valueOf(ColumnData.NONDELETABLE | V | ColumnData.NONMOVABLE) + ":left:120," >- + IContextAttributes.PACKAGE_LIVE_INST + ":" + PM_COL_LIVE_INST + ":" + String.valueOf(V | D) + ":right:80," >- + IContextAttributes.PACKAGE_ACTIVE_SIZE + ":" + PM_COL_LIVE_SIZE + ":" + String.valueOf(V | D) + ":right:80," >- + IContextAttributes.PACKAGE_TOTAL_INST + ":" + PM_COL_TOTAL_INST + ":" + String.valueOf(V | D) + ":right:80," >- + IContextAttributes.PACKAGE_TOTAL_SIZE + ":" + PM_COL_TOTAL_SIZE + ":" + String.valueOf(V | D) + ":right:80," >+ return "" >+ + TIContextAttributes.PACKAGE_NAME + ":" + PM_COL_NAME + ":" + String.valueOf(ColumnData.NONDELETABLE | V | ColumnData.NONMOVABLE) + ":left:120," >+ + TIContextAttributes.PACKAGE_LIVE_INST + ":" + PM_COL_LIVE_INST + ":" + String.valueOf(V | D) + ":right:80," >+ + TIContextAttributes.PACKAGE_ACTIVE_SIZE + ":" + PM_COL_LIVE_SIZE + ":" + String.valueOf(V | D) + ":right:80," >+ + TIContextAttributes.PACKAGE_TOTAL_INST + ":" + PM_COL_TOTAL_INST + ":" + String.valueOf(V | D) + ":right:80," >+ + TIContextAttributes.PACKAGE_TOTAL_SIZE + ":" + PM_COL_TOTAL_SIZE + ":" + String.valueOf(V | D) + ":right:80," > + TIContextAttributes.PACKAGE_AVG_AGE + ":" + PM_COL_AVG_AGE + ":" + String.valueOf(V) + ":right:80" > //+ TIContextAttributes.PACKAGE_GENERATIONS + ":" + PM_COL_GENERATIONS + ":" + String.valueOf(V | D) + ":right:80" > ; >@@ -288,25 +291,6 @@ > return ret; > } > >- int getObjAge(TRCFullTraceObject obj, EList listGC) { >- int age = 0; >- double t0 = obj.getCreateTime(); >- double t1 = obj.getCollectTime(); >- int len = listGC.size(); >- for (int j = 0; j < len; j++) { >- TRCGCEvent gcEvent = (TRCGCEvent) listGC.get(j); >- if (gcEvent.getType().equals("finish")) { >- double time = gcEvent.getTime(); >- if (time <= t0) >- continue; >- if (t1 > 0 && time >= t1) >- break; >- age++; >- } >- } >- return age; >- } >- > void updateAgeInfo(Object arr[]) { > _ageMap.clear(); > for (int i = 0; i < arr.length; i++) { >@@ -320,8 +304,8 @@ > int len = list.size(); > for (int j = 0; j < len; j++) { > Object obj = list.get(j); >- if (obj instanceof TRCFullTraceObject ) { >- int age = getObjAge((TRCFullTraceObject)obj, listGC); >+ if (obj instanceof TRCFullTraceObject) { >+ int age = Utils.getObjAge((TRCFullTraceObject)obj, listGC); > ageInfo.sumAges += age; > ageInfo.objCount++; > } >@@ -335,10 +319,14 @@ > public int sumAges; > public int objCount; > } >- >- protected void select(Object obj) { >- if (null == _viewDetails || _viewDetails.getControl().isDisposed()) >- return; >- _viewDetails.populateData(obj); >+ >+ protected StructuredViewer createTreeViewer(Composite tree) { >+ TreeViewer tv = getTreeViewer((Tree) tree); >+ return tv; >+ } >+ >+ public void widgetDefaultSelected(SelectionEvent event) { >+ if (_page instanceof MemoryAnalysisPage) >+ ((MemoryAnalysisPage)_page).showAllocDetails(); > } > } >Index: src/org/eclipse/tptp/trace/jvmti/internal/client/views/ThreadStatisticView.java >=================================================================== >RCS file: /cvsroot/tptp/trace/org.eclipse.tptp.trace.jvmti.client/src/org/eclipse/tptp/trace/jvmti/internal/client/views/ThreadStatisticView.java,v >retrieving revision 1.5 >diff -u -r1.5 ThreadStatisticView.java >--- src/org/eclipse/tptp/trace/jvmti/internal/client/views/ThreadStatisticView.java 27 Feb 2007 18:37:33 -0000 1.5 >+++ src/org/eclipse/tptp/trace/jvmti/internal/client/views/ThreadStatisticView.java 5 Mar 2007 14:55:11 -0000 >@@ -30,7 +30,6 @@ > import org.eclipse.hyades.trace.views.util.internal.StatisticTableColumnInfo; > import org.eclipse.hyades.trace.views.util.internal.ThreadDetails; > import org.eclipse.hyades.ui.provisional.context.ContextManager; >-import org.eclipse.hyades.ui.provisional.context.IContextAttributes; > import org.eclipse.hyades.ui.provisional.context.IContextLanguage; > import org.eclipse.jface.action.IMenuManager; > import org.eclipse.jface.viewers.IContentProvider; >@@ -56,6 +55,7 @@ > import org.eclipse.swt.widgets.TableColumn; > import org.eclipse.swt.widgets.Tree; > import org.eclipse.swt.widgets.TreeItem; >+import org.eclipse.tptp.trace.jvmti.internal.client.context.TIContextAttributes; > import org.eclipse.tptp.trace.jvmti.internal.client.views.columnlabels.ThreadBlockCountColumnLabel; > import org.eclipse.tptp.trace.jvmti.internal.client.views.columnlabels.ThreadBlockedTimeColumnLabel; > import org.eclipse.tptp.trace.jvmti.internal.client.views.columnlabels.ThreadClassNameColumnLabel; >@@ -280,18 +280,18 @@ > > public String getDefaultColumnsTemplate() { > return "" >- + IContextAttributes.THREAD_NAME + ":" + COL_THREAD_NAME + ":" + String.valueOf(ColumnData.NONDELETABLE | ColumnData.IS_VISIBLE | ColumnData.NONMOVABLE) + ":left:120," >- + IContextAttributes.THREAD_CLASS_NAME + ":" + COL_CLASS_NAME + ":" + String.valueOf(ColumnData.NONDELETABLE | ColumnData.IS_VISIBLE | ColumnData.NONMOVABLE) + ":left:150," >- //+ IContextAttributes.THREAD_START_TIME + ":2:" + String.valueOf(ColumnData.IS_VISIBLE) + ":right:80," >- //+ IContextAttributes.THREAD_STOP_TIME + ":3:" + String.valueOf(ColumnData.IS_VISIBLE) + ":right:80," >- + IContextAttributes.THREAD_STATE + ":" + COL_STATE + ":" + String.valueOf(ColumnData.IS_VISIBLE) + ":right:80," >- + IContextAttributes.THREAD_RUNNING_TIME + ":" + COL_RUN_TIME + ":" + String.valueOf(ColumnData.IS_VISIBLE) + ":right:120," >+ + TIContextAttributes.THREAD_NAME + ":" + COL_THREAD_NAME + ":" + String.valueOf(ColumnData.NONDELETABLE | ColumnData.IS_VISIBLE | ColumnData.NONMOVABLE) + ":left:120," >+ + TIContextAttributes.THREAD_CLASS_NAME + ":" + COL_CLASS_NAME + ":" + String.valueOf(ColumnData.NONDELETABLE | ColumnData.IS_VISIBLE | ColumnData.NONMOVABLE) + ":left:150," >+ //+ TIContextAttributes.THREAD_START_TIME + ":2:" + String.valueOf(ColumnData.IS_VISIBLE) + ":right:80," >+ //+ TIContextAttributes.THREAD_STOP_TIME + ":3:" + String.valueOf(ColumnData.IS_VISIBLE) + ":right:80," >+ + TIContextAttributes.THREAD_STATE + ":" + COL_STATE + ":" + String.valueOf(ColumnData.IS_VISIBLE) + ":right:80," >+ + TIContextAttributes.THREAD_RUNNING_TIME + ":" + COL_RUN_TIME + ":" + String.valueOf(ColumnData.IS_VISIBLE) + ":right:120," > //+ IContextAttributes.THREAD_SLEEPING_TIME + ":6:" + String.valueOf(ColumnData.IS_VISIBLE) + ":right:120," >- + IContextAttributes.THREAD_WAITING_TIME + ":" + COL_WAIT_TIME + ":" + String.valueOf(ColumnData.IS_VISIBLE) + ":right:120," >- + IContextAttributes.THREAD_BLOCKED_TIME + ":" + COL_BLOCK_TIME+ ":" + String.valueOf(ColumnData.IS_VISIBLE) + ":right:120," >- + IContextAttributes.THREAD_BLOCK_COUNT + ":" + COL_BLOCK_COUNT + ":" + String.valueOf(ColumnData.IS_VISIBLE) + ":right:80," >- + IContextAttributes.THREAD_DEADLOCKED_TIME + ":" + COL_DEADLOCK_TIME + ":" + String.valueOf(ColumnData.IS_VISIBLE) + ":right:80," >- + IContextAttributes.THREAD_DEADLOCK_COUNT + ":" + COL_DEADLOCK_COUNT + ":" + String.valueOf(ColumnData.IS_VISIBLE) + ":right:80" >+ + TIContextAttributes.THREAD_WAITING_TIME + ":" + COL_WAIT_TIME + ":" + String.valueOf(ColumnData.IS_VISIBLE) + ":right:120," >+ + TIContextAttributes.THREAD_BLOCKED_TIME + ":" + COL_BLOCK_TIME+ ":" + String.valueOf(ColumnData.IS_VISIBLE) + ":right:120," >+ + TIContextAttributes.THREAD_BLOCK_COUNT + ":" + COL_BLOCK_COUNT + ":" + String.valueOf(ColumnData.IS_VISIBLE) + ":right:80," >+ + TIContextAttributes.THREAD_DEADLOCKED_TIME + ":" + COL_DEADLOCK_TIME + ":" + String.valueOf(ColumnData.IS_VISIBLE) + ":right:80," >+ + TIContextAttributes.THREAD_DEADLOCK_COUNT + ":" + COL_DEADLOCK_COUNT + ":" + String.valueOf(ColumnData.IS_VISIBLE) + ":right:80" > ; > } > >Index: src/org/eclipse/tptp/trace/jvmti/internal/client/views/AllocationDetailsView.java >=================================================================== >RCS file: /cvsroot/tptp/trace/org.eclipse.tptp.trace.jvmti.client/src/org/eclipse/tptp/trace/jvmti/internal/client/views/AllocationDetailsView.java,v >retrieving revision 1.2 >diff -u -r1.2 AllocationDetailsView.java >--- src/org/eclipse/tptp/trace/jvmti/internal/client/views/AllocationDetailsView.java 1 Mar 2007 17:53:15 -0000 1.2 >+++ src/org/eclipse/tptp/trace/jvmti/internal/client/views/AllocationDetailsView.java 5 Mar 2007 14:55:11 -0000 >@@ -14,103 +14,235 @@ > > package org.eclipse.tptp.trace.jvmti.internal.client.views; > >+import java.util.ArrayList; >+import java.util.HashMap; >+import java.util.Map; >+ > import org.eclipse.emf.common.util.EList; >-import org.eclipse.emf.ecore.EObject; > import org.eclipse.hyades.models.trace.TRCClass; >+import org.eclipse.hyades.models.trace.TRCFullTraceObject; >+import org.eclipse.hyades.models.trace.TRCMethod; > import org.eclipse.hyades.models.trace.TRCObjectAllocationAnnotation; >-import org.eclipse.hyades.trace.ui.ITraceSelection; >+import org.eclipse.hyades.models.trace.TRCPackage; > import org.eclipse.hyades.trace.ui.TraceViewerPage; >-import org.eclipse.hyades.trace.ui.UIPlugin; >-import org.eclipse.hyades.trace.ui.ViewSelectionChangedEvent; >-import org.eclipse.hyades.trace.views.internal.view.columnlabels.ContextUpdaterHelper; > import org.eclipse.hyades.trace.views.util.internal.ColumnData; > import org.eclipse.hyades.trace.views.util.internal.StatisticTableColumnInfo; >-import org.eclipse.hyades.ui.provisional.context.ContextManager; >+import org.eclipse.hyades.ui.provisional.context.IContextLabelFormatProvider; >+import org.eclipse.hyades.ui.util.GridUtil; > import org.eclipse.jface.viewers.Viewer; >+import org.eclipse.swt.events.SelectionEvent; >+import org.eclipse.swt.graphics.Color; >+import org.eclipse.swt.graphics.Font; >+import org.eclipse.swt.graphics.FontData; > import org.eclipse.swt.graphics.Image; > import org.eclipse.swt.widgets.Composite; >+import org.eclipse.swt.widgets.Label; >+import org.eclipse.tptp.trace.jvmti.internal.client.AllocationSite; > import org.eclipse.tptp.trace.jvmti.internal.client.context.TIContextAttributes; >+import org.eclipse.tptp.trace.jvmti.internal.client.context.TIContextProvider; >+import org.eclipse.tptp.trace.jvmti.internal.client.widgets.Utils; > > public class AllocationDetailsView extends BaseStatisticView { > >- TRCClass _class; >- BaseMemoryStatisticView _memView; >+ static public final int AD_COL_METHOD_NAME = 0; >+ static public final int AD_COL_LINE_NO = 1; >+ static public final int AD_COL_CLASS_NAME = 2; >+ static public final int AD_COL_PACKAGE_NAME = 3; >+ static public final int AD_COL_LIVE_INST = 4; >+ static public final int AD_COL_LIVE_SIZE = 5; >+ static public final int AD_COL_TOTAL_INST = 6; >+ static public final int AD_COL_TOTAL_SIZE = 7; >+ static public final int AD_COL_AVG_AGE = 8; >+ >+ private Map _allocSites = new HashMap(); >+ private TRCClass _class; >+ private int _nextIndex; >+ private Label _label; > static final Object _emptyArr[] = new Object[0]; >- >- protected AllocationDetailsView(Composite parent, TraceViewerPage page, >- BaseMemoryStatisticView memView) { >+ >+ protected AllocationDetailsView(Composite parent, TraceViewerPage page) { > super(parent, page); >- _memView = memView; > } > > protected String getColumnsPreferencesKey() { >- return "org.eclipse.hyades.trace.views.statistic.allocdetails03"; >+ return "org.eclipse.hyades.trace.views.statistic.allocdetails04"; > } > > protected String getViewTypeStr() { > return "viewoption.allocdetails"; > } >+ >+ protected Composite createControl(Composite parent, ArrayList cols) { >+ Composite comp = super.createControl(parent, cols); >+ _label = _toolkit.createLabel(comp, null); >+ Font font = _label.getFont(); >+ FontData fd = font.getFontData()[0]; >+ font = new Font(null, new FontData(fd.getName(), fd.getHeight() * 3 / 2, fd.getStyle())); >+ _label.setFont(font); >+ _label.setBackground(comp.getBackground()); >+ _label.setForeground(new Color(null, 0, 0, 200)); >+ _label.setLayoutData(GridUtil.createHorizontalFill()); >+ return comp; >+ } > > protected String getDefaultColumnsTemplate() { > return "" >- + TIContextAttributes.METHOD_NAME + ":" + 0 + ":" + String.valueOf(ColumnData.NONDELETABLE | ColumnData.IS_VISIBLE | ColumnData.NONMOVABLE) + ":left:150," >- + TIContextAttributes.METHOD_LINE_NUMBER + ":" + 1 + ":" + String.valueOf(ColumnData.IS_VISIBLE) + ":left:120," >- + TIContextAttributes.CLASS_NAME + ":" + 2 + ":" + String.valueOf(ColumnData.IS_VISIBLE) + ":left:150," >- + TIContextAttributes.PACKAGE_NAME + ":" + 3 + ":" + String.valueOf(ColumnData.IS_VISIBLE) + ":left:120," >- + TIContextAttributes.CLASS_LIVE_INST + ":" + 4 + ":" + String.valueOf(ColumnData.IS_VISIBLE) + ":right:80," >- + TIContextAttributes.CLASS_ACTIVE_SIZE + ":" + 5 + ":" + String.valueOf(ColumnData.IS_VISIBLE) + ":right:80," >- + TIContextAttributes.CLASS_TOTAL_INST + ":" + 6 + ":" + String.valueOf(ColumnData.IS_VISIBLE) + ":right:80," >- + TIContextAttributes.CLASS_TOTAL_SIZE + ":" + 7 + ":" + String.valueOf(ColumnData.IS_VISIBLE) + ":right:80," >- + TIContextAttributes.CLASS_AVG_AGE + ":" + 8 + ":" + String.valueOf(ColumnData.IS_VISIBLE) + ":right:80" >+ + TIContextAttributes.METHOD_NAME + ":" + AD_COL_METHOD_NAME + ":" + String.valueOf(ColumnData.NONDELETABLE | ColumnData.IS_VISIBLE | ColumnData.NONMOVABLE) + ":left:150," >+ + TIContextAttributes.METHOD_LINE_NUMBER + ":" + AD_COL_LINE_NO + ":" + String.valueOf(ColumnData.IS_VISIBLE) + ":right:80," >+ + TIContextAttributes.CLASS_NAME + ":" + AD_COL_CLASS_NAME + ":" + String.valueOf(ColumnData.IS_VISIBLE) + ":left:150," >+ + TIContextAttributes.PACKAGE_NAME + ":" + AD_COL_PACKAGE_NAME + ":" + String.valueOf(ColumnData.IS_VISIBLE) + ":left:120," >+ + TIContextAttributes.CLASS_LIVE_INST + ":" + AD_COL_LIVE_INST + ":" + String.valueOf(ColumnData.IS_VISIBLE) + ":right:80," >+ + TIContextAttributes.CLASS_ACTIVE_SIZE + ":" + AD_COL_LIVE_SIZE + ":" + String.valueOf(ColumnData.IS_VISIBLE) + ":right:80," >+ + TIContextAttributes.CLASS_TOTAL_INST + ":" + AD_COL_TOTAL_INST + ":" + String.valueOf(ColumnData.IS_VISIBLE) + ":right:80," >+ + TIContextAttributes.CLASS_TOTAL_SIZE + ":" + AD_COL_TOTAL_SIZE + ":" + String.valueOf(ColumnData.IS_VISIBLE) + ":right:80," >+ + TIContextAttributes.CLASS_AVG_AGE + ":" + AD_COL_AVG_AGE + ":" + String.valueOf(ColumnData.IS_VISIBLE) + ":right:80" > //+ TIContextAttributes.CLASS_GENERATIONS + ":" + 9 + ":" + String.valueOf(ColumnData.IS_VISIBLE) + ":right:80" > ; > } >- >+ > public String getColumnText(Object element, int columnIndex) { >- StatisticTableColumnInfo info = StatisticTableColumnInfo.getStatisticTableColumnInfo(getTree().getColumn(columnIndex)); >+ StatisticTableColumnInfo info = StatisticTableColumnInfo >+ .getStatisticTableColumnInfo(getTree().getColumn(columnIndex)); > int pos = info.getColumnData().getInitalPos(); > String label = ""; >- if (!(element instanceof TRCObjectAllocationAnnotation)) >+ if (!(element instanceof AllocationSite)) > return label; >+ AllocationSite allocSite = (AllocationSite) element; > switch (pos) { >- case 0: label = "method name"; break; >- case 1: label = "line number"; break; >- case 2: break; >- case 3: break; >- case 4: break; >+ case AD_COL_METHOD_NAME: >+ if (allocSite._method != null) >+ label = allocSite._method.getName(); >+ break; >+ case AD_COL_CLASS_NAME: >+ if (allocSite._method != null && >+ allocSite._method.getDefiningClass() != null) >+ label = allocSite._method.getDefiningClass().getName(); >+ break; >+ case AD_COL_PACKAGE_NAME: >+ if (allocSite._method != null && >+ allocSite._method.getDefiningClass() != null && >+ allocSite._method.getDefiningClass().getPackage() != null) >+ label = allocSite._method.getDefiningClass().getPackage().getName(); >+ break; >+ case AD_COL_LINE_NO: >+ label = "" + allocSite._lineNo; >+ break; >+ case AD_COL_TOTAL_INST: >+ label = "" + allocSite._total; >+ break; >+ case AD_COL_TOTAL_SIZE: >+ label = "" + allocSite._totalSize; >+ break; >+ case AD_COL_LIVE_INST: >+ label = "" + (allocSite._total - allocSite._collected); >+ break; >+ case AD_COL_LIVE_SIZE: >+ label = "" + (allocSite._totalSize - allocSite._collectedSize); >+ break; >+ case AD_COL_AVG_AGE: >+ double age = 0; >+ if (allocSite._total > 0) { >+ age = (double) allocSite._sumAges / allocSite._total; >+ label = "" + age; >+ } >+ IContextLabelFormatProvider formatter = TIContextProvider.instance().getContextLabelFormatProvider(TIContextAttributes.CALL_SITE_AVG_AGE); >+ label = formatter.getDisplayStringFromElement(new Double(age), null, IContextLabelFormatProvider.MODE_COLUMN_CONTENT); >+ break; > } > return label; > } > > public Image getColumnImage(Object element, int columnIndex) { >- return null; >+ StatisticTableColumnInfo info = StatisticTableColumnInfo.getStatisticTableColumnInfo(getTree().getColumn(columnIndex)); >+ int pos = info.getColumnData().getInitalPos(); >+ Image image = null; >+ if (!(element instanceof AllocationSite)) >+ return image; >+ AllocationSite allocSite = (AllocationSite) element; >+ switch (pos) { >+ case AD_COL_METHOD_NAME: >+ if (allocSite._method != null) { >+ IContextLabelFormatProvider formatter = TIContextProvider.instance().getContextLabelFormatProvider(TIContextAttributes.METHOD_NAME); >+ image = formatter.getDisplayImageByElement(allocSite._method.getName(), allocSite._method, IContextLabelFormatProvider.MODE_COLUMN_CONTENT); >+ } >+ break; >+ case AD_COL_CLASS_NAME: >+ if (allocSite._method != null && >+ allocSite._method.getDefiningClass() != null) { >+ TRCClass cls = allocSite._method.getDefiningClass(); >+ IContextLabelFormatProvider formatter = TIContextProvider.instance().getContextLabelFormatProvider(TIContextAttributes.CLASS_NAME); >+ image = formatter.getDisplayImageByElement(cls.getName(), cls, IContextLabelFormatProvider.MODE_COLUMN_CONTENT); >+ } >+ break; >+ case AD_COL_PACKAGE_NAME: >+ if (allocSite._method != null && >+ allocSite._method.getDefiningClass() != null && >+ allocSite._method.getDefiningClass().getPackage() != null) { >+ TRCPackage pkg = allocSite._method.getDefiningClass().getPackage(); >+ IContextLabelFormatProvider formatter = TIContextProvider.instance().getContextLabelFormatProvider(TIContextAttributes.PACKAGE_NAME); >+ image = formatter.getDisplayImageByElement(pkg.getName(), pkg, IContextLabelFormatProvider.MODE_COLUMN_CONTENT); >+ } >+ break; >+ } >+ return image; > } >- >- TRCClass getSelectedClass() { >- return _class; >- /*if (null == _memView || _memView.getControl().isDisposed()) >- return null; >- IStructuredSelection selection = (IStructuredSelection) _memView.getTreeViewer().getSelection(); >- if (null == selection || selection.isEmpty()) >- return null; >- Object element = selection.getFirstElement(); >- if (!(element instanceof TRCClass)) >- return null; >- return (TRCClass) element;*/ >+ >+ public int compareElements(Object e1, Object e2, int pos, boolean isDelta) { >+ int ret = 0; >+ if (!(e1 instanceof AllocationSite && e2 instanceof AllocationSite)) >+ return ret; >+ AllocationSite a1 = (AllocationSite) e1; >+ AllocationSite a2 = (AllocationSite) e2; >+ switch (pos) { >+ case AD_COL_METHOD_NAME: >+ ret = Utils.compare(a1._method != null ? a1._method.getName() : null >+ , a2._method != null ? a2._method.getName() : null); >+ break; >+ case AD_COL_CLASS_NAME: >+ ret = Utils.compare(a1._method != null && >+ a1._method.getDefiningClass() != null ? >+ a1._method.getDefiningClass().getName() : null >+ , a2._method != null && >+ a2._method.getDefiningClass() != null ? >+ a2._method.getDefiningClass().getName() : null); >+ break; >+ case AD_COL_PACKAGE_NAME: >+ ret = Utils.compare(a1._method != null && >+ a1._method.getDefiningClass() != null && >+ a1._method.getDefiningClass().getPackage() != null ? >+ a1._method.getDefiningClass().getPackage().getName() : null >+ , a2._method != null && >+ a2._method.getDefiningClass() != null && >+ a2._method.getDefiningClass().getPackage() != null ? >+ a2._method.getDefiningClass().getPackage().getName() : null); >+ break; >+ case AD_COL_LINE_NO: >+ ret = a1._lineNo - a2._lineNo; >+ break; >+ case AD_COL_TOTAL_INST: >+ ret = a1._total - a2._total; >+ break; >+ case AD_COL_TOTAL_SIZE: >+ ret = a1._totalSize - a2._totalSize; >+ break; >+ case AD_COL_LIVE_INST: >+ ret = (a1._total - a1._collected) - (a2._total - a2._collected); >+ break; >+ case AD_COL_LIVE_SIZE: >+ ret = (a1._totalSize - a1._collectedSize) - (a2._totalSize - a2._collectedSize); >+ break; >+ case AD_COL_AVG_AGE: >+ double age1 = a1._total > 0 ? a1._sumAges / a1._total : 0; >+ double age2 = a2._total > 0 ? a2._sumAges / a2._total : 0; >+ ret = Utils.compare(age1, age2); >+ break; >+ } >+ return ret; > } > > public Object[] getElements(Object inputElement) { >- TRCClass cls = getSelectedClass(); >- if (null == cls) >- return _emptyArr; >- EList list = cls.getAnnotations(); >- if (null == list) >- return _emptyArr; >- return list.toArray(); >- } >- >- public int compare(Viewer viewer, Object e1, Object e2, int pos) { >- return 0; >+ updateData(); >+ return _allocSites.values().toArray(); > } > > public Object[] getChildren(Object parentElement) { >@@ -123,26 +255,78 @@ > > protected StatisticSorter getViewerSorterInstance() { > return new StatisticSorter() { >+ public int compare(Viewer viewer, Object e1, Object e2) { >+ return _sortSequence * compareElements(e1, e2, _pos, _info.isDeltaColumn()); >+ } > }; > } > >- protected void populateData(Object obj) { >- if (obj instanceof TRCClass) { >+ protected void showAllocDetails(Object obj) { >+ if (obj == null || obj instanceof TRCClass) { > _class = (TRCClass) obj; >- refresh(); >+ _nextIndex = 0; >+ _allocSites.clear(); >+ String text = Utils.getPackageClassName(_class); >+ if (text.length() > 0) >+ text = "Allocation details for '" + text + "'"; >+ _label.setText(text); >+ //_label.getParent().layout(); > } >+ refresh(); > } >- >- public void handleViewSelectionChangedEvent(ViewSelectionChangedEvent event) { >- Object source = event.getSource(); >- if (source != this) { >- ITraceSelection model = UIPlugin.getDefault().getSelectionModel(_page.getMOFObject()); >- if (model.size() > 0) { >- Object sel = model.getFirstElement(); >- if (sel != null) { >- populateData(sel); >+ >+ void updateData() { >+ if (null == _class) >+ return; >+ TRCObjectAllocationAnnotation aa = Utils.getAllocationAnnotation(_class); >+ if (null == aa) >+ return; >+ EList listGC = _class.getPackage().getProcess().getGcEvents(); >+ EList lineNumbers = aa.getLineNumbers(); >+ EList methods = aa.getMethods(); >+ EList objects = _class.getObjects(); >+ int lineNoLen = lineNumbers.size(); >+ int methodsLen = methods.size(); >+ int objectsLen = objects.size(); >+ // gather alloc sites by line No >+ for (int i = _nextIndex; i < lineNoLen; i++) { >+ Integer lineNo = (Integer) lineNumbers.get(i); >+ AllocationSite allocSite = (AllocationSite) _allocSites.get(lineNo); >+ if (null == allocSite) { >+ TRCMethod method = null; >+ int line = lineNo.intValue(); >+ // find corresponding method >+ for (int j = 0; j < methodsLen; j++) { >+ TRCMethod method0 = (TRCMethod) methods.get(j); >+ if (line >= method0.getLineNo() && line <= method0.getLineNo() + method0.getLineCount()) { >+ method = method0; >+ break; >+ } >+ } >+ allocSite = new AllocationSite(line, method); >+ _allocSites.put(lineNo, allocSite); >+ } >+ int j = i + i + 1; >+ if (j < objectsLen && objects.get(j) instanceof TRCFullTraceObject) { >+ TRCFullTraceObject trObj = (TRCFullTraceObject) objects.get(j); >+ if (trObj.getCollectTime() > 0) { >+ allocSite._collected++; >+ allocSite._collectedSize += trObj.getSize(); > } >+ allocSite._totalSize += trObj.getSize(); >+ int age = Utils.getObjAge(trObj, listGC); >+ allocSite._sumAges += age; >+ allocSite._total++; > } > } >+ _nextIndex = lineNoLen; >+ } >+ >+ public void widgetDefaultSelected(SelectionEvent event) { >+ if (event.item.getData() instanceof AllocationSite) { >+ AllocationSite allocSite = (AllocationSite) event.item.getData(); >+ String pattern = Utils.composeMethodName(allocSite); >+ Utils.openSource(pattern); >+ } > } > } >Index: src/org/eclipse/tptp/trace/jvmti/internal/client/widgets/ThreadsTipHandler.java >=================================================================== >RCS file: /cvsroot/tptp/trace/org.eclipse.tptp.trace.jvmti.client/src/org/eclipse/tptp/trace/jvmti/internal/client/widgets/ThreadsTipHandler.java,v >retrieving revision 1.2 >diff -u -r1.2 ThreadsTipHandler.java >--- src/org/eclipse/tptp/trace/jvmti/internal/client/widgets/ThreadsTipHandler.java 1 Mar 2007 17:53:15 -0000 1.2 >+++ src/org/eclipse/tptp/trace/jvmti/internal/client/widgets/ThreadsTipHandler.java 5 Mar 2007 14:55:11 -0000 >@@ -9,7 +9,7 @@ > * Intel Corporation - Initial API and implementation > * Vitaly A. Provodin, Intel - Initial API and implementation > * >- * $Id: >+ * $Id: $ > *****************************************************************************/ > package org.eclipse.tptp.trace.jvmti.internal.client.widgets; > >Index: src/org/eclipse/tptp/trace/jvmti/internal/client/widgets/Utils.java >=================================================================== >RCS file: /cvsroot/tptp/trace/org.eclipse.tptp.trace.jvmti.client/src/org/eclipse/tptp/trace/jvmti/internal/client/widgets/Utils.java,v >retrieving revision 1.4 >diff -u -r1.4 Utils.java >--- src/org/eclipse/tptp/trace/jvmti/internal/client/widgets/Utils.java 1 Mar 2007 17:53:15 -0000 1.4 >+++ src/org/eclipse/tptp/trace/jvmti/internal/client/widgets/Utils.java 5 Mar 2007 14:55:11 -0000 >@@ -20,8 +20,11 @@ > import org.eclipse.emf.ecore.EObject; > import org.eclipse.hyades.models.hierarchy.TRCAnnotation; > import org.eclipse.hyades.models.trace.TRCClass; >+import org.eclipse.hyades.models.trace.TRCFullTraceObject; >+import org.eclipse.hyades.models.trace.TRCGCEvent; > import org.eclipse.hyades.models.trace.TRCMethod; > import org.eclipse.hyades.models.trace.TRCMethodInvocation; >+import org.eclipse.hyades.models.trace.TRCObjectAllocationAnnotation; > import org.eclipse.hyades.models.trace.TRCPackage; > import org.eclipse.hyades.models.trace.TRCThread; > import org.eclipse.hyades.models.trace.TRCThreadDeadEvent; >@@ -55,6 +58,7 @@ > import org.eclipse.swt.graphics.Point; > import org.eclipse.swt.graphics.Rectangle; > import org.eclipse.swt.widgets.Display; >+import org.eclipse.tptp.trace.jvmti.internal.client.AllocationSite; > import org.eclipse.tptp.trace.jvmti.internal.client.MethodDetails; > import org.eclipse.tptp.trace.jvmti.internal.client.TITracePlugin; > import org.eclipse.tptp.trace.jvmti.internal.client.views.UIMessages; >@@ -238,45 +242,43 @@ > return size.x; > } > >- static public String composeThreadName(TRCThread thread, boolean inclState) { >- String name = thread.getName(); >- String threadClass = getThreadClassName(thread); >- if (threadClass != null && threadClass.length() > 0) { >- name += " [" + threadClass + "]"; >- } >- if (inclState) { >- EList list = thread.getThreadEvents(); >- if (null != list && list.size() > 0) >- name+= " (" + getEventName2((TRCThreadEvent)list.get(list.size() - 1)) + ")"; >- } >- return name; >- } >- >- static public String getThreadClassName(TRCThread thread) { >- String name = ""; >+ static public TRCClass getThreadClass(TRCThread thread) { > TRCClass cls = null; >- TRCPackage pkg = null; > if (thread.getThreadObject() != null) { > cls = thread.getThreadObject().getIsA(); > } else if (thread.getInitialInvocations().size() > 0) { > cls = ((TRCMethodInvocation) thread.getInitialInvocations().get(0)).getMethod().getDefiningClass(); > } >+ return cls; >+ } >+ >+ static public String getThreadClassName(TRCThread thread) { >+ String name = ""; >+ TRCClass cls = getThreadClass(thread); > if (cls != null) >- pkg = cls.getPackage(); >- if (cls != null && pkg != null) { >- name = "".equals(pkg.getName()) ? cls.getName() : (pkg.getName() + "." + cls.getName()); >+ name = getPackageClassName(cls); >+ return name; >+ } >+ >+ static public String getPackageClassName(TRCClass cls) { >+ String name = ""; >+ if (cls != null) { >+ TRCPackage pkg = cls.getPackage(); >+ if (pkg != null && pkg.getName().length() > 0) >+ name = pkg.getName() + "." + cls.getName(); >+ else >+ name = cls.getName(); > } > return name; > } > >- static public String composeMethodName(TRCMethodInvocation method) { >- TRCMethod m = method.getMethod(); >+ static public String getFullMethodName(TRCMethod m, boolean sig) { > String name = ""; >- name += m.getDefiningClass().getName(); >+ name += getPackageClassName(m.getDefiningClass()); > name += "."; > name += m.getName(); >- name += m.getSignature(); >- name += " [" + m.getCalls() + "]"; >+ if (sig) >+ name += m.getSignature(); > return name; > } > >@@ -314,6 +316,24 @@ > return UIMessages._unknown; > } > >+ static public String composeThreadName(TRCThread thread, boolean inclState) { >+ String name = thread.getName(); >+ String threadClass = getThreadClassName(thread); >+ if (threadClass != null && threadClass.length() > 0) { >+ name += " [" + threadClass + "]"; >+ } >+ if (inclState) { >+ EList list = thread.getThreadEvents(); >+ if (null != list && list.size() > 0) >+ name+= " (" + getEventName2((TRCThreadEvent)list.get(list.size() - 1)) + ")"; >+ } >+ return name; >+ } >+ >+ static public String composeMethodName(TRCMethodInvocation method) { >+ return getFullMethodName(method.getMethod(), true); >+ } >+ > static public String composeEventName(TRCThreadEvent event) { > String name = event.getThread().getName(); > name += " [" + event.getThread().getGroupName() + "] (" + getEventName2(event); >@@ -342,6 +362,15 @@ > return name; > } > >+ static public String composeMethodName(AllocationSite allocSite) { >+ String name = ""; >+ if (allocSite._method != null) >+ name += getFullMethodName(allocSite._method, true); >+ if (allocSite._lineNo >= 0) >+ name += " line:" + allocSite._lineNo; >+ return name; >+ } >+ > static public Image getItemImage(Object obj) { > if (obj instanceof MethodDetails) { > if (((MethodDetails)obj).running) >@@ -540,7 +569,19 @@ > return null; > } > >- public static String fixMethodSignature(String sig) { >+ static public TRCObjectAllocationAnnotation getAllocationAnnotation(TRCClass cls) { >+ TRCObjectAllocationAnnotation aa = null; >+ EList list = cls.getAnnotations(); >+ int len = list.size(); >+ for (int i = 0; i < len; i++) { >+ TRCAnnotation annotation = (TRCAnnotation) list.get(i); >+ if (annotation instanceof TRCObjectAllocationAnnotation) >+ aa = (TRCObjectAllocationAnnotation) annotation; >+ } >+ return aa; >+ } >+ >+ static public String fixMethodSignature(String sig) { > int pos = sig.indexOf('('); > if (pos >= 0) { > String ret = sig.substring(0, pos); >@@ -550,7 +591,7 @@ > return sig; > } > >- public static String restoreMethodSignature(String sig) { >+ static public String restoreMethodSignature(String sig) { > String ret = ""; > int pos = sig.indexOf('('); > if (pos >= 0) { >@@ -608,8 +649,9 @@ > return sig; > } > >- public static boolean openSource(Object element) { >+ static public boolean openSource(Object element) { > if (element instanceof String) { >+ System.out.println("openSource: " + element); > final String pattern = (String) element; > final int javaType = IJavaSearchConstants.METHOD; > BusyIndicator.showWhile(Display.getDefault(), new Runnable() { >@@ -627,4 +669,41 @@ > OpenSource.openSource(element); > return true; > } >+ >+ static public int getObjAge(TRCFullTraceObject obj, EList listGC) { >+ int age = 0; >+ double t0 = obj.getCreateTime(); >+ double t1 = obj.getCollectTime(); >+ int len = listGC.size(); >+ for (int j = 0; j < len; j++) { >+ TRCGCEvent gcEvent = (TRCGCEvent) listGC.get(j); >+ if (gcEvent.getType().equals("finish")) { >+ double time = gcEvent.getTime(); >+ if (time <= t0) >+ continue; >+ if (t1 > 0 && time >= t1) >+ break; >+ age++; >+ } >+ } >+ return age; >+ } >+ >+ public static int compare(double d1, double d2) { >+ if (d1 > d2) >+ return 1; >+ if (d1 < d2) >+ return 1; >+ return 0; >+ } >+ >+ public static int compare(String s1, String s2) { >+ if (s1 != null && s2 != null) >+ return s1.compareToIgnoreCase(s2); >+ if (s1 != null) >+ return 1; >+ if (s2 != null) >+ return -1; >+ return 0; >+ } > } >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/tptp/trace/org.eclipse.tptp.trace.jvmti.client/plugin.xml,v >retrieving revision 1.9 >diff -u -r1.9 plugin.xml >--- plugin.xml 27 Feb 2007 18:37:35 -0000 1.9 >+++ plugin.xml 5 Mar 2007 14:55:11 -0000 >@@ -98,6 +98,13 @@ > name="%JVMTI_ANALYSIS_TYPE_VIEW_THRD_STATES" > type="org.eclipse.tptp.analysisType.jvmti.thread"> > </analyzerExtension> >+ <analyzerExtension >+ class="org.eclipse.tptp.trace.jvmti.internal.client.views.MemoryAnalysisViewer" >+ extension="org.eclipse.tptp.trace.jvmti.client.analyzerExtension2" >+ icon="icons/full/obj16/memleakantype_obj.gif" >+ id="org.eclipse.tptp.trace.jvmti.internal.client.views.MemoryAnalysisViewer" >+ name="%JVMTI_ANALYSIS_TYPE_VIEW_HEAP_ANALYSIS"> >+ </analyzerExtension> > </extension> > > <extension >Index: src/org/eclipse/tptp/trace/jvmti/internal/client/AllocationSite.java >=================================================================== >RCS file: src/org/eclipse/tptp/trace/jvmti/internal/client/AllocationSite.java >diff -N src/org/eclipse/tptp/trace/jvmti/internal/client/AllocationSite.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/tptp/trace/jvmti/internal/client/AllocationSite.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,22 @@ >+package org.eclipse.tptp.trace.jvmti.internal.client; >+ >+import org.eclipse.hyades.models.trace.TRCMethod; >+ >+public class AllocationSite { >+ >+ public int _lineNo; >+ public int _total; >+ public int _sumAges; >+ public int _collected; >+ public int _totalSize; >+ public int _collectedSize; >+ public TRCMethod _method; >+ >+ public AllocationSite() { >+ } >+ >+ public AllocationSite(int lineNo, TRCMethod method) { >+ _method = method; >+ _lineNo = lineNo; >+ } >+}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 167995
:
59470
|
60265
|
61066
|
61814
|
61815