diff options
Diffstat (limited to 'perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/PerfCore.java')
-rw-r--r-- | perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/PerfCore.java | 69 |
1 files changed, 14 insertions, 55 deletions
diff --git a/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/PerfCore.java b/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/PerfCore.java index f2cae0e8a0..18c032bc58 100644 --- a/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/PerfCore.java +++ b/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/PerfCore.java @@ -14,15 +14,12 @@ import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintStream; -import java.net.URI; -import java.net.URISyntaxException; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.List; import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants; -import org.eclipse.core.filesystem.IFileStore; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.CoreException; @@ -40,8 +37,6 @@ import org.eclipse.linuxtools.internal.perf.model.PMSymbol; import org.eclipse.linuxtools.internal.perf.model.TreeParent; import org.eclipse.linuxtools.internal.perf.ui.PerfProfileView; import org.eclipse.linuxtools.profiling.launch.ConfigUtils; -import org.eclipse.linuxtools.profiling.launch.IRemoteFileProxy; -import org.eclipse.linuxtools.profiling.launch.RemoteProxyManager; import org.eclipse.linuxtools.tools.launch.core.factory.RuntimeProcessFactory; import org.eclipse.swt.widgets.Display; import org.eclipse.ui.PartInitException; @@ -64,7 +59,7 @@ public class PerfCore { } String str = strBuf.toString(); if (!str.trim().isEmpty() && print != null) { - print.println(blockTitle + ": \n" +str + "\n END OF " + blockTitle); //$NON-NLS-1$ //$NON-NLS-2$ + print.println(blockTitle + ": \n" +str + "\n END OF " + blockTitle); //$NON-NLS-1$ //$NON-NLS-2$ } return str; } @@ -145,11 +140,7 @@ public class PerfCore { HashMap<String,ArrayList<String>> events = new HashMap<String,ArrayList<String>>(); IProject project = getProject(config); - if (project == null) { - if (!PerfCore.checkPerfInPath()) { - return events; - } - } else if (!PerfCore.checkRemotePerfInPath(project)) { + if (!PerfCore.checkPerfInPath(project)) { return events; } @@ -216,38 +207,22 @@ public class PerfCore { } //Gets the current version of perf - public static Version getPerfVersion(ILaunchConfiguration config, String[] environ, IPath workingDir) { + public static Version getPerfVersion(ILaunchConfiguration config) { IProject project = getProject(config); Process p = null; - IRemoteFileProxy proxy = null; - IFileStore workingDirFileStore = null; - if (workingDir == null) { - try { - p = RuntimeProcessFactory.getFactory().exec(new String [] {PerfPlugin.PERF_COMMAND, "--version"}, project); //$NON-NLS-1$ - } catch (IOException e) { - logException(e); - } - } else { - try { - proxy = RemoteProxyManager.getInstance().getFileProxy(new URI(workingDir.toOSString())); - workingDirFileStore = proxy.getResource(workingDir.toOSString()); - p = RuntimeProcessFactory.getFactory().exec(new String [] {PerfPlugin.PERF_COMMAND, "--version"}, environ, workingDirFileStore, project); //$NON-NLS-1$ - } catch (IOException e) { - logException(e); - } catch (CoreException e) { - logException(e); - } catch (URISyntaxException e) { - logException(e); - } + try { + p = RuntimeProcessFactory.getFactory().exec(new String [] {PerfPlugin.PERF_COMMAND, "--version"}, project); //$NON-NLS-1$ + } catch (IOException e) { + logException(e); } - if (p == null) { return null; } BufferedReader input = new BufferedReader(new InputStreamReader(p.getInputStream())); - String perfVersion = spitStream(input, "Perf --version", null); + + String perfVersion = spitStream(input, "Perf --version", null); //$NON-NLS-1$ int index = perfVersion.indexOf('-'); if (index > 0) { perfVersion = perfVersion.substring(0, index); @@ -256,20 +231,9 @@ public class PerfCore { return new Version(perfVersion); } - public static boolean checkPerfInPath() - { - try - { - Process p = Runtime.getRuntime().exec(new String [] {PerfPlugin.PERF_COMMAND, "--version"}); //$NON-NLS-1$ - return (p != null); - } - catch (IOException e) - { - return false; - } - } - public static boolean checkRemotePerfInPath(IProject project) { + public static boolean checkPerfInPath(IProject project) + { try { Process p = RuntimeProcessFactory.getFactory().exec(new String [] {PerfPlugin.PERF_COMMAND, "--version"}, project); //$NON-NLS-1$ @@ -277,7 +241,6 @@ public class PerfCore { } catch (IOException e) { - logException(e); return false; } } @@ -380,9 +343,10 @@ public class PerfCore { //whatever project is being profiled. It is only used for junit tests atm. public static void Report(ILaunchConfiguration config, String[] environ, IPath workingDir, IProgressMonitor monitor, String perfDataLoc, PrintStream print) { IProject project = getProject(config); + TreeParent invisibleRoot = PerfPlugin.getDefault().clearModelRoot(); - Version perfVersion = getPerfVersion(config, environ, workingDir); + Version perfVersion = getPerfVersion(config); boolean OldPerfVersion = false; if (new Version(0, 0, 2).compareTo(perfVersion) > 0) { OldPerfVersion = true; @@ -417,10 +381,8 @@ public class PerfCore { logException(e); } - PerfCore.parseRemoteReport(config, workingDir, monitor, perfDataLoc, print, invisibleRoot, OldPerfVersion, input, error, project); - } /** @@ -565,8 +527,6 @@ public class PerfCore { if (monitor != null && monitor.isCanceled()) { return; } - - currentSym = (PMSymbol)s; String[] annotateCmd; if (workingDir == null) { @@ -585,8 +545,7 @@ public class PerfCore { logException(e); } - PerfCore.parseAnnotation(monitor, input, - workingDir, currentDso, currentSym); + PerfCore.parseAnnotation(monitor, input, workingDir, currentDso, currentSym); } if (currentDso.getFile(PerfPlugin.STRINGS_UnfiledSymbols).getChildren().length == 0) { |