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 217770 Details for
Bug 371285
Session comparison between runs
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]
Added PMSymbolMatcher class
0002-Added-PMSymbolMatcher.java.patch (text/plain), 5.08 KB, created by
Camilo Bernal
on 2012-06-22 18:34:24 EDT
(
hide
)
Description:
Added PMSymbolMatcher class
Filename:
MIME Type:
Creator:
Camilo Bernal
Created:
2012-06-22 18:34:24 EDT
Size:
5.08 KB
patch
obsolete
>From 8488886e2639a42fe51016f048c846215b78deab Mon Sep 17 00:00:00 2001 >From: Camilo Bernal <cabernal@redhat.com> >Date: Fri, 22 Jun 2012 17:03:39 -0400 >Subject: [PATCH 2/2] Added PMSymbolMatcher.java > >PMSymbolMatcher.java class is used to build the PMSymbols matches from the >given perf data files. For each data file, a launch configuration is >created, which is then used to obtain the perf report TreeParent model, >from where the PMSymbols are gathered and compared to generate the matches. >--- > .../internal/perf/model/PMSymbolMatcher.java | 132 ++++++++++++++++++++ > 1 files changed, 132 insertions(+), 0 deletions(-) > create mode 100644 perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/model/PMSymbolMatcher.java > >diff --git a/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/model/PMSymbolMatcher.java b/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/model/PMSymbolMatcher.java >new file mode 100644 >index 0000000..3f3fad8 >--- /dev/null >+++ b/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/model/PMSymbolMatcher.java >@@ -0,0 +1,132 @@ >+package org.eclipse.linuxtools.internal.perf.model; >+ >+import java.util.ArrayList; >+ >+import org.eclipse.core.resources.IFile; >+import org.eclipse.debug.core.ILaunchConfiguration; >+import org.eclipse.linuxtools.internal.perf.PerfCore; >+import org.eclipse.linuxtools.internal.perf.PerfPlugin; >+import org.eclipse.linuxtools.internal.perf.launch.PerfDefaultLaunchConfig; >+ >+public class PMSymbolMatcher { >+ >+ /** >+ * Get PMSymbol's from report of file >+ * >+ * @param file >+ * the file to be reported >+ * @return array of PMSymbol's >+ */ >+ private static ArrayList<PMSymbol> getSymbols(IFile file) { >+ String projectName = file.getProject().getName(); >+ >+ PerfDefaultLaunchConfig perfConfig = new PerfDefaultLaunchConfig(); >+ ILaunchConfiguration config = perfConfig >+ .createDefaultConfiguration(projectName); >+ >+ PerfCore.Report(config, null, null, null, file.getLocation() >+ .toOSString(), null); >+ >+ // get model from reported perf data file >+ TreeParent invisibleRoot = PerfPlugin.getDefault().getModelRoot(); >+ >+ if (invisibleRoot.getChildren().length == 0) { >+ return null; >+ } >+ >+ ArrayList<PMSymbol> symbols = new ArrayList<PMSymbol>(); >+ >+ // get all PMSymbols >+ for (TreeParent event : invisibleRoot.getChildren()) { >+ for (TreeParent cmd : event.getChildren()) { >+ for (TreeParent dso : cmd.getChildren()) { >+ for (TreeParent dsoFile : dso.getChildren()) { >+ for (TreeParent sym : dsoFile.getChildren()) { >+ symbols.add((PMSymbol) sym); >+ } >+ } >+ } >+ } >+ } >+ return symbols; >+ } >+ >+ /** >+ * Get PMSymbol's matches from the two given PMSymbol arrays >+ * >+ * @param stale >+ * PMSymbol array of older PMSymbol's >+ * @param fresh >+ * PMSymbol array of newer PMSymbol's >+ * @return array of PMSymbolMatch's, each containing a PMSymbol match pair >+ */ >+ private static ArrayList<PMSymbolMatch> buildMatches( >+ ArrayList<PMSymbol> stale, ArrayList<PMSymbol> fresh) { >+ ArrayList<PMSymbolMatch> result = new ArrayList<PMSymbolMatch>(); >+ >+ ArrayList<PMSymbol> staleNoMatch = (ArrayList<PMSymbol>) stale.clone(); >+ >+ // Gather all matches/non-matches of the fresh dsos against the stale. >+ boolean added = false; >+ for (PMSymbol freshElement : fresh) { >+ added = true; >+ for (PMSymbol staleElement : stale) { >+ if (equals(freshElement, staleElement)) { >+ result.add(new PMSymbolMatch(freshElement, staleElement)); >+ staleNoMatch.remove(staleElement); >+ added = false; >+ break; >+ } >+ } >+ // New dso with no match in the stale list >+ if (added) { >+ result.add(new PMSymbolMatch((PMSymbol) freshElement, null)); >+ } >+ } >+ // Gather stale dsos with no match in the fresh list >+ for (PMSymbol staleElement : staleNoMatch) { >+ result.add(new PMSymbolMatch(null, (PMSymbol) staleElement)); >+ } >+ return result; >+ } >+ >+ /** >+ * Build matches given two files >+ * >+ * @param staleData >+ * older data file >+ * @param freshData >+ * newer data file >+ * @return array of PMSymbolMatch's, each containing a PMSymbol match pair >+ */ >+ public static ArrayList<PMSymbolMatch> buildResults(IFile staleData, >+ IFile freshData) { >+ ArrayList<PMSymbol> staleDsos = getSymbols(staleData); >+ ArrayList<PMSymbol> freshDsos = getSymbols(freshData); >+ if (staleDsos == null || freshDsos == null) { >+ return null; >+ } >+ ArrayList<PMSymbolMatch> result = buildMatches(staleDsos, freshDsos); >+ return result; >+ } >+ >+ /** >+ * Check TreeParent's are equal (i.e. have the same ancestors) >+ * >+ * @param t1 >+ * TreeParent element >+ * @param t2 >+ * TreeParent element >+ * @return TreeParent's equality >+ */ >+ public static boolean equals(TreeParent t1, TreeParent t2) { >+ // base case (invisible root) >+ if ("".equals(t1.getName()) && "".equals(t2.getName())) { >+ return true; >+ } else if (t1.equals(t2.getName())) { >+ return equals(t1.getParent(), t2.getParent()); >+ } else { >+ return false; >+ } >+ } >+} >\ No newline at end of file >-- >1.7.7.6 >
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 371285
:
217768
|
217769
|
217770
|
217771
|
217772
|
217773
|
217774
|
217775
|
217776
|
217779
|
218026
|
218056