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 217779 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 copyright header to PMSymbolMatcher class
0001-Added-PMSymbolMatcher.java.patch (text/plain), 5.60 KB, created by
Camilo Bernal
on 2012-06-22 19:44:01 EDT
(
hide
)
Description:
Added copyright header to PMSymbolMatcher class
Filename:
MIME Type:
Creator:
Camilo Bernal
Created:
2012-06-22 19:44:01 EDT
Size:
5.60 KB
patch
obsolete
>From 32342278c89ce92aef89117e1d0f9d53691dcf88 Mon Sep 17 00:00:00 2001 >From: Camilo Bernal <cabernal@redhat.com> >Date: Fri, 22 Jun 2012 19:41:31 -0400 >Subject: [PATCH] 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 | 142 ++++++++++++++++++++ > 1 files changed, 142 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..0763fa3 >--- /dev/null >+++ b/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/model/PMSymbolMatcher.java >@@ -0,0 +1,142 @@ >+/******************************************************************************* >+ * Copyright (c) 2012 Red Hat, Inc. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * Camilo Bernal <cabernal@redhat.com> - Initial Implementation. >+ *******************************************************************************/ >+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
Flags:
jjohnstn
:
iplog+
Actions:
View
|
Diff
Attachments on
bug 371285
:
217768
|
217769
|
217770
|
217771
|
217772
|
217773
|
217774
|
217775
|
217776
| 217779 |
218026
|
218056