aboutsummaryrefslogtreecommitdiffstats
path: root/traceview/src
diff options
context:
space:
mode:
Diffstat (limited to 'traceview/src')
-rw-r--r--traceview/src/com/android/traceview/MethodData.java24
-rw-r--r--traceview/src/com/android/traceview/ProfileView.java21
2 files changed, 31 insertions, 14 deletions
diff --git a/traceview/src/com/android/traceview/MethodData.java b/traceview/src/com/android/traceview/MethodData.java
index 0bc9853..d54b72b 100644
--- a/traceview/src/com/android/traceview/MethodData.java
+++ b/traceview/src/com/android/traceview/MethodData.java
@@ -46,10 +46,10 @@ public class MethodData {
private Image mFadedImage;
private HashMap<Integer, ProfileData> mParents;
private HashMap<Integer, ProfileData> mChildren;
-
+
// The parents of this method when this method was in a recursive call
private HashMap<Integer, ProfileData> mRecursiveParents;
-
+
// The children of this method when this method was in a recursive call
private HashMap<Integer, ProfileData> mRecursiveChildren;
@@ -150,7 +150,7 @@ public class MethodData {
mParents);
}
}
-
+
private HashMap<Integer, ProfileData> updateInclusive(long time,
MethodData contextMethod, MethodData elementMethod,
boolean elementIsParent, HashMap<Integer, ProfileData> map) {
@@ -178,15 +178,15 @@ public class MethodData {
ProfileData[] sortedChildren;
ProfileData[] sortedRecursiveParents;
ProfileData[] sortedRecursiveChildren;
-
+
sortedParents = sortProfileData(mParents);
sortedChildren = sortProfileData(mChildren);
sortedRecursiveParents = sortProfileData(mRecursiveParents);
sortedRecursiveChildren = sortProfileData(mRecursiveChildren);
-
+
// Add "self" time to the top of the sorted children
sortedChildren = addSelf(sortedChildren);
-
+
// Create the ProfileNode objects that we need
ArrayList<ProfileNode> nodes = new ArrayList<ProfileNode>();
ProfileNode profileNode;
@@ -212,7 +212,7 @@ public class MethodData {
}
mProfileNodes = nodes.toArray(new ProfileNode[nodes.size()]);
}
-
+
// Create and return a ProfileData[] array that is a sorted copy
// of the given HashMap values.
private ProfileData[] sortProfileData(HashMap<Integer, ProfileData> map) {
@@ -222,12 +222,12 @@ public class MethodData {
// Convert the hash values to an array of ProfileData
Collection<ProfileData> values = map.values();
ProfileData[] sorted = values.toArray(new ProfileData[values.size()]);
-
+
// Sort the array by elapsed inclusive time
Arrays.sort(sorted, mByElapsedInclusive);
return sorted;
}
-
+
private ProfileData[] addSelf(ProfileData[] children) {
ProfileData[] pdata;
if (children == null) {
@@ -283,12 +283,16 @@ public class MethodData {
return mProfileName;
}
+ public String getSignature() {
+ return mSignature;
+ }
+
public void computeProfileName() {
if (mRank == -1) {
mProfileName = mName;
return;
}
-
+
StringBuilder sb = new StringBuilder();
sb.append(mRank);
sb.append(" "); //$NON-NLS-1$
diff --git a/traceview/src/com/android/traceview/ProfileView.java b/traceview/src/com/android/traceview/ProfileView.java
index 71dedfd..506efca 100644
--- a/traceview/src/com/android/traceview/ProfileView.java
+++ b/traceview/src/com/android/traceview/ProfileView.java
@@ -16,10 +16,6 @@
package com.android.traceview;
-import java.util.ArrayList;
-import java.util.Observable;
-import java.util.Observer;
-
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredSelection;
@@ -48,6 +44,10 @@ import org.eclipse.swt.widgets.Tree;
import org.eclipse.swt.widgets.TreeColumn;
import org.eclipse.swt.widgets.TreeItem;
+import java.util.ArrayList;
+import java.util.Observable;
+import java.util.Observer;
+
public class ProfileView extends Composite implements Observer {
private TreeViewer mTreeViewer;
@@ -57,6 +57,11 @@ public class ProfileView extends Composite implements Observer {
private Color mColorNoMatch;
private Color mColorMatch;
private MethodData mCurrentHighlightedMethod;
+ private MethodHandler mMethodHandler;
+
+ public interface MethodHandler {
+ void handleMethod(MethodData method);
+ }
public ProfileView(Composite parent, TraceReader reader,
SelectionController selectController) {
@@ -224,10 +229,18 @@ public class ProfileView extends Composite implements Observer {
ArrayList<Selection> selections = new ArrayList<Selection>();
selections.add(Selection.highlight("MethodData", md));
mSelectionController.change(selections, "ProfileView");
+
+ if (mMethodHandler != null && (event.stateMask & SWT.MOD1) != 0) {
+ mMethodHandler.handleMethod(md);
+ }
}
});
}
+ public void setMethodHandler(MethodHandler handler) {
+ mMethodHandler = handler;
+ }
+
private void findName(String query) {
MethodData md = mProfileProvider.findMatchingName(query);
selectMethod(md);