summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorRodrigo Fraxino Araujo2013-11-27 03:25:34 (EST)
committer Roland Grunberg2013-11-27 13:45:10 (EST)
commit3463459b844bbbae9f68e9017b28f7f400ea8653 (patch)
treee7db1ade7779248ab605da1134e923f75fa5efd3
parente81238005e1ad56b22f41aaf9342d678e69417cf (diff)
downloadorg.eclipse.linuxtools-3463459b844bbbae9f68e9017b28f7f400ea8653.zip
org.eclipse.linuxtools-3463459b844bbbae9f68e9017b28f7f400ea8653.tar.gz
org.eclipse.linuxtools-3463459b844bbbae9f68e9017b28f7f400ea8653.tar.bz2
perf: fix for remote and sync perf after version updaterefs/changes/44/18944/9
Change-Id: I1500f859e98e6894188c29efa80e52dff3f3952d Reviewed-on: https://git.eclipse.org/r/18944 Reviewed-by: Roland Grunberg <rgrunber@redhat.com> IP-Clean: Roland Grunberg <rgrunber@redhat.com> Tested-by: Roland Grunberg <rgrunber@redhat.com>
-rw-r--r--perf/org.eclipse.linuxtools.perf.swtbot.tests/src/org/eclipse/linuxtools/internal/perf/swtbot/tests/AbstractSWTBotTest.java2
-rw-r--r--perf/org.eclipse.linuxtools.perf.tests/src/org/eclipse/linuxtools/internal/perf/tests/LaunchTest.java4
-rw-r--r--perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/PerfCore.java69
-rw-r--r--perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/launch/PerfLaunchConfigDelegate.java4
-rw-r--r--perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/remote/launch/PerfLaunchConfigDelegate.java17
-rw-r--r--perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/remote/launch/PerfOptionsTab.java19
6 files changed, 25 insertions, 90 deletions
diff --git a/perf/org.eclipse.linuxtools.perf.swtbot.tests/src/org/eclipse/linuxtools/internal/perf/swtbot/tests/AbstractSWTBotTest.java b/perf/org.eclipse.linuxtools.perf.swtbot.tests/src/org/eclipse/linuxtools/internal/perf/swtbot/tests/AbstractSWTBotTest.java
index 912082a..3e5101c 100644
--- a/perf/org.eclipse.linuxtools.perf.swtbot.tests/src/org/eclipse/linuxtools/internal/perf/swtbot/tests/AbstractSWTBotTest.java
+++ b/perf/org.eclipse.linuxtools.perf.swtbot.tests/src/org/eclipse/linuxtools/internal/perf/swtbot/tests/AbstractSWTBotTest.java
@@ -127,7 +127,7 @@ public abstract class AbstractSWTBotTest extends AbstractTest {
bot.button("Apply").click();
- if (PerfCore.checkPerfInPath()) {
+ if (PerfCore.checkPerfInPath(null)) {
bot.button("Profile").click();
} else {
diff --git a/perf/org.eclipse.linuxtools.perf.tests/src/org/eclipse/linuxtools/internal/perf/tests/LaunchTest.java b/perf/org.eclipse.linuxtools.perf.tests/src/org/eclipse/linuxtools/internal/perf/tests/LaunchTest.java
index 2fd4669..59d9304 100644
--- a/perf/org.eclipse.linuxtools.perf.tests/src/org/eclipse/linuxtools/internal/perf/tests/LaunchTest.java
+++ b/perf/org.eclipse.linuxtools.perf.tests/src/org/eclipse/linuxtools/internal/perf/tests/LaunchTest.java
@@ -72,14 +72,14 @@ public class LaunchTest extends AbstractTest {
@Test
public void testDefaultRun() throws CoreException {
- if (PerfCore.checkPerfInPath()) {
+ if (PerfCore.checkPerfInPath(null)) {
delegate.launch(wc, ILaunchManager.PROFILE_MODE, launch, null);
}
}
@Test
public void testClockEventRun() throws CoreException {
- if (PerfCore.checkPerfInPath()) {
+ if (PerfCore.checkPerfInPath(null)) {
ArrayList<String> list = new ArrayList<String>();
list.addAll(Arrays.asList(new String[] { "cpu-clock", "task-clock",
"cycles" }));
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 f2cae0e..18c032b 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) {
diff --git a/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/launch/PerfLaunchConfigDelegate.java b/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/launch/PerfLaunchConfigDelegate.java
index 3ad9c07..308ff9e 100644
--- a/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/launch/PerfLaunchConfigDelegate.java
+++ b/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/launch/PerfLaunchConfigDelegate.java
@@ -62,7 +62,7 @@ public class PerfLaunchConfigDelegate extends ProfileLaunchConfigurationDelegate
public void launch(ILaunchConfiguration config, String mode,
ILaunch launch, IProgressMonitor monitor) throws CoreException {
// check if Perf exists in $PATH
- if (! PerfCore.checkPerfInPath()) {
+ if (! PerfCore.checkPerfInPath(null)) {
IStatus status = new Status(IStatus.ERROR, PerfPlugin.PLUGIN_ID,
Messages.PerfLaunchConfigDelegate_perf_not_found);
throw new CoreException(status);
@@ -90,7 +90,7 @@ public class PerfLaunchConfigDelegate extends ProfileLaunchConfigurationDelegate
ArrayList<String> command = new ArrayList<String>();
// Get the base commandline string (with flags/options based on config)
- Version perfVersion = PerfCore.getPerfVersion(config, null, workingDir);
+ Version perfVersion = PerfCore.getPerfVersion(config);
command.addAll(Arrays.asList(PerfCore.getRecordString(config, perfVersion)));
// Add the path to the executable
command.add(exePath.toOSString());
diff --git a/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/remote/launch/PerfLaunchConfigDelegate.java b/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/remote/launch/PerfLaunchConfigDelegate.java
index 1400bc6..b843723 100644
--- a/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/remote/launch/PerfLaunchConfigDelegate.java
+++ b/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/remote/launch/PerfLaunchConfigDelegate.java
@@ -87,7 +87,7 @@ public class PerfLaunchConfigDelegate extends ProfileLaunchConfigurationDelegate
this.configUtils = new ConfigUtils(config);
project = ConfigUtils.getProject(configUtils.getProjectName());
// check if Perf exists in $PATH
- if (! PerfCore.checkRemotePerfInPath(project))
+ if (! PerfCore.checkPerfInPath(project))
{
IStatus status = new Status(IStatus.ERROR, PerfPlugin.PLUGIN_ID, "Error: Perf was not found on PATH"); //$NON-NLS-1$
throw new CoreException(status);
@@ -135,7 +135,7 @@ public class PerfLaunchConfigDelegate extends ProfileLaunchConfigurationDelegate
//Build the commandline string to run perf recording the given project
String arguments[] = getProgramArgumentsArray( config ); //Program args from launch config.
ArrayList<String> command = new ArrayList<String>( 4 + arguments.length );
- Version perfVersion = PerfCore.getPerfVersion(config, null, workingDirPath);
+ Version perfVersion = PerfCore.getPerfVersion(config);
command.addAll(Arrays.asList(PerfCore.getRecordString(config, perfVersion))); //Get the base commandline string (with flags/options based on config)
command.add( remoteBinFile.toOSString() ); // Add the path to the executable
command.set(0, perfPathString);
@@ -212,12 +212,11 @@ public class PerfLaunchConfigDelegate extends ProfileLaunchConfigurationDelegate
print.println("Analysing recorded perf.data, please wait..."); //$NON-NLS-1$
//Possibly should pass this (the console reference) on to PerfCore.Report if theres anything we ever want to spit out to user.
}
- PerfCore.Report(config, getEnvironment(config), Path.fromOSString(configWorkingDir + IPath.SEPARATOR), monitor, null, print);
+ PerfCore.Report(config, getEnvironment(config), Path.fromOSString(configWorkingDir), monitor, null, print);
- IPath perfData = PerfPlugin.getDefault().getPerfProfileData();
URI perfDataURI = null;
IRemoteFileProxy proxy = null;
- perfDataURI = new URI(perfData.toPortableString());
+ perfDataURI = new URI(RemoteProxyManager.getInstance().getRemoteProjectLocation(project) + PerfPlugin.PERF_DEFAULT_DATA);
proxy = RemoteProxyManager.getInstance().getFileProxy(perfDataURI);
IFileStore perfDataFileStore = proxy.getResource(perfDataURI.getPath());
IFileInfo info = perfDataFileStore.fetchInfo();
@@ -227,7 +226,7 @@ public class PerfLaunchConfigDelegate extends ProfileLaunchConfigurationDelegate
PerfCore.RefreshView(renderProcessLabel(exeURI.getPath()));
if (config.getAttribute(PerfPlugin.ATTR_ShowSourceDisassembly,
PerfPlugin.ATTR_ShowSourceDisassembly_default)) {
- showSourceDisassembly(Path.fromOSString(configWorkingDir));
+ showSourceDisassembly(Path.fromPortableString(workingDirURI.toString() + IPath.SEPARATOR));
}
}
@@ -241,10 +240,6 @@ public class PerfLaunchConfigDelegate extends ProfileLaunchConfigurationDelegate
e.printStackTrace();
abort(e.getLocalizedMessage(), null, ICDTLaunchConfigurationConstants.ERR_INTERNAL_ERROR);
}
- // } catch (InterruptedException e) {
- // // TODO Auto-generated catch block
- // e.printStackTrace();
- // }
}
/**
@@ -252,7 +247,7 @@ public class PerfLaunchConfigDelegate extends ProfileLaunchConfigurationDelegate
* @param workingDir working directory.
*/
private void showSourceDisassembly(IPath workingDir) {
- String title = renderProcessLabel(workingDir.toOSString() + "perf.data"); //$NON-NLS-1$
+ String title = renderProcessLabel(workingDir.toPortableString() + PerfPlugin.PERF_DEFAULT_DATA);
SourceDisassemblyData sdData = new SourceDisassemblyData(title, workingDir, project);
sdData.parse();
PerfPlugin.getDefault().setSourceDisassemblyData(sdData);
diff --git a/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/remote/launch/PerfOptionsTab.java b/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/remote/launch/PerfOptionsTab.java
index 5d11e31..c9c6ef9 100644
--- a/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/remote/launch/PerfOptionsTab.java
+++ b/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/remote/launch/PerfOptionsTab.java
@@ -14,14 +14,7 @@
*******************************************************************************/
package org.eclipse.linuxtools.internal.perf.remote.launch;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.linuxtools.internal.perf.PerfCore;
-import org.eclipse.linuxtools.internal.perf.PerfPlugin;
-import org.eclipse.linuxtools.profiling.launch.ConfigUtils;
public class PerfOptionsTab extends org.eclipse.linuxtools.internal.perf.launch.PerfOptionsTab {
@@ -29,18 +22,6 @@ public class PerfOptionsTab extends org.eclipse.linuxtools.internal.perf.launch.
@Override
public void initializeFrom(ILaunchConfiguration config) {
- ConfigUtils configUtils = new ConfigUtils(config);
- IProject project = null;
-
- try {
- project = ConfigUtils.getProject(configUtils.getProjectName());
- } catch (CoreException e1) {
- e1.printStackTrace();
- }
- if (!PerfCore.checkRemotePerfInPath(project)) {
- IStatus status = new Status(IStatus.ERROR, PerfPlugin.PLUGIN_ID, "Error: Perf was not found on PATH"); //$NON-NLS-1$
- ex = new CoreException(status);
- }
super.initializeFrom(config);
}