Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 315505

Summary: [remote] Support remote targets with OProfile
Product: z_Archived Reporter: Andrew Overholt <overholt>
Component: LinuxToolsAssignee: OProfile Inbox <linux.oprofile-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: dan, jjohnstn, kksebasti, linhongc, obusatto, rafaelmt, rfaraujo, wainersm
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:
Bug Depends on: 377120, 378494, 381248    
Bug Blocks:    
Attachments:
Description Flags
Patch to add support for remote targets with Oprofile
none
Patch to add support for remote targets with Oprofile
none
Patch to add support for remote targets with Oprofile
none
Patch to add support for remote targets with Oprofile obusatto: iplog+

Description Andrew Overholt CLA 2010-06-02 17:40:19 EDT
There is interest in supporting data collection from remote targets and doing local analysis.  I'm not exactly sure how this would work, but at a minimum it would be nice to have local launching and visualization of results for OProfile run on a remote target.
Comment 1 Andrew Overholt CLA 2011-06-23 17:04:52 EDT
*** Bug 349100 has been marked as a duplicate of this bug. ***
Comment 2 Rafael Medeiros Teixeira CLA 2012-05-21 18:46:06 EDT
Created attachment 215994 [details]
Patch to add support for remote targets with Oprofile

This patch depends on bugs 378494 and 377120.

It basically adds the "Profile With Oprofile (remote)" Profile Configuration tab, plus some modifications to make Oprofile work remotely. It requires all file accesses and binary executions to use Proxy (Bug 378494).

Since the remote projects can reside in machines with different architectures, the OprofileEventConfigTab class had to be heavily modified to allow refreshing the list of events according to the current project.

I have added an Extension Point in org.eclipse.linuxtools.oprofile.core to allow other plugins to supply OpcontrolProviders to different remote location's schemas. The patch contains a Remote Tools provider.

The workflow for remote profiling is basically the same as the local one. The only extra work is to choose the Resource Manager that will be used, and start it before profiling. I intend to remove this tab and automatically choose the same resource manager as the project's in a near future.
Comment 3 Roland Grunberg CLA 2012-05-22 13:38:24 EDT
This breaks OProfile due to RemoteProxyManager.java:56 (getRemoteManager()). The extention point "RemoteProxyManager" in org.eclipse.linuxtools.profiling.launch has no configuration elements, and so this method returns null. This causes the static initializer to fail and so the OProfile class is never loaded.
Comment 4 Roland Grunberg CLA 2012-05-31 14:11:08 EDT
Rafael has found that Comment 3 is only a symptom and in fact the host parameter of the URI is null for local file resources, so a check for that case, and using the appropriate FileProxy will solve this.
Comment 5 Rafael Medeiros Teixeira CLA 2012-05-31 15:16:03 EDT
Thanks for reviewing this patch Roland. The problem was actually in the patch for Bug 378494. I've worked on this issue and submitted a new version of the patch.
Comment 6 Roland Grunberg CLA 2012-06-01 13:41:14 EDT
I'm seeing these error when attempting to create an OProfile Remote Configuration :

The first one can be fixed by including org.eclipse.debug.ui.sourcelookup in the Import-Package of the remote launch plugin.

!SUBENTRY 1 org.eclipse.equinox.registry 4 1 2012-06-01 13:32:40.493
!MESSAGE Plug-in org.eclipse.linuxtools.oprofile.remote.launch was unable to load class org.eclipse.debug.ui.sourcelookup.SourceLookupTab.
!STACK 0
java.lang.ClassNotFoundException: org.eclipse.debug.ui.sourcelookup.SourceLookupTab
	at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:513)
	at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:429)
	at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:417)
	at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
	at org.eclipse.osgi.internal.loader.BundleLoader.loadClass(BundleLoader.java:345)
	at org.eclipse.osgi.framework.internal.core.BundleHost.loadClass(BundleHost.java:229)
	at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadClass(AbstractBundle.java:1207)
	at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.createExecutableExtension(RegistryStrategyOSGI.java:174)
	at org.eclipse.core.internal.registry.ExtensionRegistry.createExecutableExtension(ExtensionRegistry.java:905)
	at org.eclipse.core.internal.registry.ConfigurationElement.createExecutableExtension(ConfigurationElement.java:243)
	at org.eclipse.core.internal.registry.ConfigurationElementHandle.createExecutableExtension(ConfigurationElementHandle.java:55)
	at org.eclipse.debug.internal.ui.LaunchConfigurationTabExtension.getTab(LaunchConfigurationTabExtension.java:64)
	at org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationTabGroupWrapper$TabCollector.next(LaunchConfigurationTabGroupWrapper.java:91)
	at org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationTabGroupWrapper.getTabs(LaunchConfigurationTabGroupWrapper.java:172)
	at org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationTabGroupViewer$9.run(LaunchConfigurationTabGroupViewer.java:865)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
	at org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationTabGroupViewer.createGroup(LaunchConfigurationTabGroupViewer.java:873)
	at org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationTabGroupViewer.showInstanceTabsFor(LaunchConfigurationTabGroupViewer.java:779)
	at org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationTabGroupViewer.displayInstanceTabs(LaunchConfigurationTabGroupViewer.java:735)
	at org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationTabGroupViewer$8.run(LaunchConfigurationTabGroupViewer.java:623)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
	at org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationTabGroupViewer.inputChanged(LaunchConfigurationTabGroupViewer.java:640)
	at org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationTabGroupViewer.setInput0(LaunchConfigurationTabGroupViewer.java:602)
	at org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationTabGroupViewer.setInput(LaunchConfigurationTabGroupViewer.java:578)
	at org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationsDialog.handleLaunchConfigurationSelectionChanged(LaunchConfigurationsDialog.java:941)
	at org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationsDialog$3.selectionChanged(LaunchConfigurationsDialog.java:560)
	at org.eclipse.jface.viewers.StructuredViewer$3.run(StructuredViewer.java:888)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:49)
	at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:175)
	at org.eclipse.jface.viewers.StructuredViewer.firePostSelectionChanged(StructuredViewer.java:886)
	at org.eclipse.jface.viewers.StructuredViewer.handlePostSelect(StructuredViewer.java:1226)
	at org.eclipse.jface.viewers.StructuredViewer$5.widgetSelected(StructuredViewer.java:1251)
	at org.eclipse.jface.util.OpenStrategy.firePostSelectionEvent(OpenStrategy.java:262)
	at org.eclipse.jface.util.OpenStrategy.access$5(OpenStrategy.java:256)
	at org.eclipse.jface.util.OpenStrategy$3.run(OpenStrategy.java:433)
	at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:135)
	at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3563)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3212)
	at org.eclipse.jface.window.Window.runEventLoop(Window.java:825)
	at org.eclipse.jface.window.Window.open(Window.java:801)
	at org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationsDialog.open(LaunchConfigurationsDialog.java:1132)
	at org.eclipse.debug.ui.DebugUITools$2.run(DebugUITools.java:579)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
	at org.eclipse.debug.ui.DebugUITools.openLaunchConfigurationDialogOnGroup(DebugUITools.java:587)
	at org.eclipse.debug.ui.DebugUITools.openLaunchConfigurationDialogOnGroup(DebugUITools.java:521)
	at org.eclipse.debug.ui.actions.OpenLaunchDialogAction.run(OpenLaunchDialogAction.java:81)
	at org.eclipse.jface.action.Action.runWithEvent(Action.java:498)
	at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:584)
	at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:501)
	at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:411)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1258)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1282)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1267)
	at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1061)
	at org.eclipse.jface.action.ActionContributionItem$9.handleEvent(ActionContributionItem.java:1284)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1258)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3588)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3209)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2696)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2660)
	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2494)
	at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:674)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:667)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:123)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:616)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1386)


!ENTRY org.eclipse.jface 4 2 2012-06-01 13:32:40.817
!MESSAGE Problems occurred when invoking code from plug-in: "org.eclipse.jface".
!STACK 0
java.lang.ArrayIndexOutOfBoundsException: 0
	at org.eclipse.linuxtools.internal.oprofile.launch.configuration.OprofileEventConfigTab.getTabFolderComposite(OprofileEventConfigTab.java:165)
	at org.eclipse.linuxtools.internal.oprofile.launch.configuration.OprofileEventConfigTab.createCounterTabs(OprofileEventConfigTab.java:146)
	at org.eclipse.linuxtools.internal.oprofile.launch.configuration.OprofileEventConfigTab.createControl(OprofileEventConfigTab.java:123)
	at org.eclipse.linuxtools.internal.oprofile.launch.configuration.OprofileEventConfigTab.initializeFrom(OprofileEventConfigTab.java:214)
	at org.eclipse.linuxtools.internal.oprofile.remote.launch.configuration.OprofileRemoteEventConfigTab.initializeFrom(OprofileRemoteEventConfigTab.java:53)
	at org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationTabGroupWrapper.initializeFrom(LaunchConfigurationTabGroupWrapper.java:201)
	at org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationTabGroupViewer.displayInstanceTabs(LaunchConfigurationTabGroupViewer.java:751)
	at org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationTabGroupViewer$8.run(LaunchConfigurationTabGroupViewer.java:623)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
	at org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationTabGroupViewer.inputChanged(LaunchConfigurationTabGroupViewer.java:640)
	at org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationTabGroupViewer.setInput0(LaunchConfigurationTabGroupViewer.java:602)
	at org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationTabGroupViewer.setInput(LaunchConfigurationTabGroupViewer.java:578)
	at org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationsDialog.handleLaunchConfigurationSelectionChanged(LaunchConfigurationsDialog.java:941)
	at org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationsDialog$3.selectionChanged(LaunchConfigurationsDialog.java:560)
	at org.eclipse.jface.viewers.StructuredViewer$3.run(StructuredViewer.java:888)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:49)
	at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:175)
	at org.eclipse.jface.viewers.StructuredViewer.firePostSelectionChanged(StructuredViewer.java:886)
	at org.eclipse.jface.viewers.StructuredViewer.handlePostSelect(StructuredViewer.java:1226)
	at org.eclipse.jface.viewers.StructuredViewer$5.widgetSelected(StructuredViewer.java:1251)
	at org.eclipse.jface.util.OpenStrategy.firePostSelectionEvent(OpenStrategy.java:262)
	at org.eclipse.jface.util.OpenStrategy.access$5(OpenStrategy.java:256)
	at org.eclipse.jface.util.OpenStrategy$3.run(OpenStrategy.java:433)
	at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:135)
	at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3563)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3212)
	at org.eclipse.jface.window.Window.runEventLoop(Window.java:825)
	at org.eclipse.jface.window.Window.open(Window.java:801)
	at org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationsDialog.open(LaunchConfigurationsDialog.java:1132)
	at org.eclipse.debug.ui.DebugUITools$2.run(DebugUITools.java:579)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
	at org.eclipse.debug.ui.DebugUITools.openLaunchConfigurationDialogOnGroup(DebugUITools.java:587)
	at org.eclipse.debug.ui.DebugUITools.openLaunchConfigurationDialogOnGroup(DebugUITools.java:521)
	at org.eclipse.debug.ui.actions.OpenLaunchDialogAction.run(OpenLaunchDialogAction.java:81)
	at org.eclipse.jface.action.Action.runWithEvent(Action.java:498)
	at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:584)
	at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:501)
	at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:411)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1258)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1282)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1267)
	at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1061)
	at org.eclipse.jface.action.ActionContributionItem$9.handleEvent(ActionContributionItem.java:1284)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1258)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3588)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3209)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2696)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2660)
	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2494)
	at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:674)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:667)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:123)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:616)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1386)
Comment 7 Rafael Medeiros Teixeira CLA 2012-06-05 09:48:52 EDT
I've managed to reproduce this error. It happens because I've wrongly assumed that local projects will always be able to run opcontrol (actually it depends if user ran install.sh or not). I'm working on a fix and will submit a new patch as soon as possible.
Comment 8 Rafael Medeiros Teixeira CLA 2012-06-08 15:47:12 EDT
Created attachment 217099 [details]
Patch to add support for remote targets with Oprofile

This patch contains a fix for the problem described in comment 6, plus some modifications to avoid PTP dependency. For this, I've used the RemoteProxyCMainTab, so this patch depends on Bug 381248, Bug 378494 and Bug 377120.

With the move for RemoteProxyCMainTab, there's no need to create or start a resource manager anymore. The user in the remote machine must have NOPASSWD permission for opcontrol in the sudoers file, and the requiretty parameter must be disabled.
Comment 9 Rafael Medeiros Teixeira CLA 2012-06-21 09:31:20 EDT
This patch is EPL. I wrote 100% of it myself.  I had permission from my employer (IBM Corp.) to do so.
Comment 10 Rafael Medeiros Teixeira CLA 2012-06-21 17:29:33 EDT
Created attachment 217722 [details]
Patch to add support for remote targets with Oprofile

Previous version wasn't applying cleanly anymore. Fixed trailing whitespace warnings.
Comment 11 Otavio Pontes CLA 2012-06-22 15:52:39 EDT
(In reply to comment #10)
> Created attachment 217722 [details]
> Patch to add support for remote targets with Oprofile
> 
> Previous version wasn't applying cleanly anymore. Fixed trailing whitespace
> warnings.

I tested this version here and it worked fine. It is getting the events from the remote machine and it is running fine. And this is not breaking the local version.
Roland, can you test that? Do you have any other concern about this patch?
Comment 12 Roland Grunberg CLA 2012-06-22 16:42:01 EDT
I haven't tested this yet, but will do so. I've noticed that some of the remote implementations for plugins (valgrind, perf) execute locally, and I think this may be an issue with how the IProject is passed to RuntimeProcessFactory. If it's the local project, it'll always return a local launcher.
Comment 13 Roland Grunberg CLA 2012-06-26 12:42:05 EDT
I've been able to confirm that the functionality itself works. Please address the following issues :

- API issues (add the appropriate annotations for new methods eg. @since 1.1 in the javadoc)
- Please fix unused imports (Mainly in core, ui, launch, remote.launch components )
- The declared exception OpcontrolException is not actually thrown by the constructor LinuxOpcontrolProvider()	LinuxOpcontrolProvider.java	/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/internal/oprofile/core/linux	line 103	Java Problem
- Description	Resource	Path	Location	Type
The method run() of type new Thread(){} should be tagged with @Override since it actually overrides a superclass method	LinuxOpcontrolProvider.java	/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/internal/oprofile/core/linux	line 463	Java Problem

- Description	Resource	Path	Location	Type
"schema/org.eclipse.linuxtools.oprofile.core.OpcontrolProvider.exsd" does not reference a schema file.	plugin.xml	/org.eclipse.linuxtools.oprofile.core	line 4	Plug-in Problem

This will probably work, but the schema really should be defined because it forces people to write a bit about what it does and how to use it. In addition it provides some basic error checking to ensure proper usage.

- hasPermissions() in LinuxOpcontrolProvider and RemoteLinuxOpcontrolProvider look almost identical. Does the remote version need to override the base implementation ? There's other methods that behave similarly to their base (eg. createOpcontrolProcess). Could they use just the base implementation, or have it modified slightly to accommodate remote launching ?\

- When a session is saved, it is saved to the local system (see saveSession in LinuxOpcontrolProvider), but the deletion attempts to act on the remote system (see OProfileViewDeleteSessionAction). I think the sessions should probably get saved/deleted locally. Overall, the session element will be gone from the Tree Viewer, but there will be a file on the local system that should have been deleted.
Comment 14 Rafael Medeiros Teixeira CLA 2012-06-27 16:19:53 EDT
Created attachment 217969 [details]
Patch to add support for remote targets with Oprofile
Comment 15 Rafael Medeiros Teixeira CLA 2012-06-27 16:26:17 EDT
(In reply to comment #13)
> I've been able to confirm that the functionality itself works. Please address
> the following issues :
> 
> - API issues (add the appropriate annotations for new methods eg. @since 1.1 in
> the javadoc)
> - Please fix unused imports (Mainly in core, ui, launch, remote.launch
> components )
> - The declared exception OpcontrolException is not actually thrown by the
> constructor LinuxOpcontrolProvider()    LinuxOpcontrolProvider.java   
> /org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/internal/oprofile/core/linux
>    line 103    Java Problem
> - Description    Resource    Path    Location    Type
> The method run() of type new Thread(){} should be tagged with @Override since
> it actually overrides a superclass method    LinuxOpcontrolProvider.java   
> /org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/internal/oprofile/core/linux
>    line 463    Java Problem
> 
> - Description    Resource    Path    Location    Type
> "schema/org.eclipse.linuxtools.oprofile.core.OpcontrolProvider.exsd" does not
> reference a schema file.    plugin.xml    /org.eclipse.linuxtools.oprofile.core
>    line 4    Plug-in Problem
> 
> This will probably work, but the schema really should be defined because it
> forces people to write a bit about what it does and how to use it. In addition
> it provides some basic error checking to ensure proper usage.
> 
> - hasPermissions() in LinuxOpcontrolProvider and RemoteLinuxOpcontrolProvider
> look almost identical. Does the remote version need to override the base
> implementation ? There's other methods that behave similarly to their base (eg.
> createOpcontrolProcess). Could they use just the base implementation, or have
> it modified slightly to accommodate remote launching ?\

The local methods are slightly different in order to maintain support for the "installed" oprofile. Local hasPermissions, for instance, shouldn't check for permissions if Linux Tools Path property is set to default, since in this case it should look for the opcontrol link created by the install.sh script. The remote hasPermissions, however, should look for permissions for /usr/bin/opcontrol in that case.

> 
> - When a session is saved, it is saved to the local system (see saveSession in
> LinuxOpcontrolProvider), but the deletion attempts to act on the remote system
> (see OProfileViewDeleteSessionAction). I think the sessions should probably get
> saved/deleted locally. Overall, the session element will be gone from the Tree
> Viewer, but there will be a file on the local system that should have been
> deleted.

All the other issues were fixed.
Comment 16 Roland Grunberg CLA 2012-06-28 16:43:28 EDT
This looks good to me. Refering to Comment 9, I think this can be pushed now.
Comment 17 Otavio Pontes CLA 2012-06-28 16:50:54 EDT
committed in commit number: f3508856a3aee69b119dcdae382e3552853aa9f8