import org.eclipse.swt.widgets.Display;
import com.samsung.linuxplatform.oprofile.core.provider.OpcontrolDataProvider;
+import com.samsung.freshide.connection.machine.DeviceMachine;
+import com.samsung.freshide.connection.machine.IMachine;
import com.samsung.freshide.connection.session.ISession;
import com.samsung.freshide.connection.session.SessionManager;
import com.samsung.freshide.connection.device.DeviceManager;
public static ISession getSession() throws InterruptedException{
ISession session = null;
try {
- session = SessionManager.getSession("OPROFILER_CONTROL", DeviceManager.getSelectedDevice(), new NullProgressMonitor());
+ DeviceMachine selected = DeviceManager.getSelectedDevice();
+ if(selected.getMachineType().equals(IMachine.VIRTUAL_DEVICE))
+ session = SessionManager.getSession("OPROFILER_CONTROL_VIRTUAL", selected, new NullProgressMonitor());
+ else
+ session = SessionManager.getSession("OPROFILER_CONTROL_REAL", selected, new NullProgressMonitor());
} catch (Exception e) {
}
import com.samsung.linuxplatform.oprofile.core.OprofileComm;
import com.samsung.linuxplatform.oprofile.core.OprofileCommonConstants;
+import com.samsung.freshide.connection.device.DeviceManager;
import com.samsung.freshide.connection.session.ISession;
/**
// result = session.run(str);
session.run(str, null);
} catch (Exception e) {
- throw new OpcontrolException(OprofileCorePlugin.createErrorStatus("opcontrolRun", e)); //$NON-NLS-1$
+ throw new OpcontrolException(OprofileCorePlugin.createErrorStatus("opcontrolRun (" +
+ DeviceManager.getSelectedDevice().getMachineType() + ")", e)); //$NON-NLS-1$
}
//-----------------------------------
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
+import com.samsung.freshide.connection.device.DeviceManager;
import com.samsung.freshide.common.properties.InstallPathConfig;
+import com.samsung.freshide.connection.machine.IMachine;
import com.samsung.freshide.connection.session.ISession;
import com.samsung.freshide.launch.SLPLaunchDelegate;
import com.samsung.freshide.launch.SLPLaunchMessages;
try {
setEnvironments(config, session);
- // find oprofile
- String oprofileCmd = "/usr/bin/oprofile";
- String cmd = "ls " + oprofileCmd + CMD_RESULT_CHECK ;
- String resultRsp = session.run(cmd, null);
- if(!resultRsp.contains("0"))
- {
- transferProfilingToolPackage(monitor, session);
- installProfilingToolPackage(monitor, session);
-// newCoreException(SLPLaunchMessages.CANNOT_LAUNCH, new Exception("No oprofile in this target (/usr/bin/oprofile). "));
- }
+ // check oprofile tool
+ checkProfilingTool(monitor, session);
String remoteExePath = getRemoteExePath(config);
- cmd = "cd " + remoteExePath + CMD_RESULT_CHECK;
- resultRsp = session.run(cmd, null);
+ String cmd = "cd " + remoteExePath + CMD_RESULT_CHECK;
+ String resultRsp = session.run(cmd, null);
if(!resultRsp.contains("0"))
newCoreException(SLPLaunchMessages.CANNOT_LAUNCH, new Exception("Cannot change to run-directory : " + ". (Return Code: " + resultRsp + ")"));
lmgr.addLaunchListener(new LaunchTerminationWatcher(launch));
}
+
+ public static void checkProfilingTool(IProgressMonitor monitor, ISession session) throws Exception {
+ // find oprofile
+ String oprofileCmd = "/usr/bin/opcontrol";
+ String cmd = "ls " + oprofileCmd + CMD_RESULT_CHECK ;
+ String resultRsp = session.run(cmd, null);
+ if(!resultRsp.contains("0"))
+ {
+ if(DeviceManager.getSelectedDevice().getMachineType().equals(IMachine.VIRTUAL_DEVICE))
+ {
+ throw new Exception(SLPLaunchMessages.CANNOT_LAUNCH, new Exception("No oprofile in this target (/usr/bin/opcontrol)."));
+ }
+ else
+ {
+ transferProfilingToolPackage(monitor, session);
+ installProfilingToolPackage(monitor, session);
+ }
+ }
+ }
+
/**
* Transfer oprofile package to the target
*
* @exception CoreException
* if unable to transfer a package
*/
- public void transferProfilingToolPackage(IProgressMonitor monitor, ISession session) throws CoreException {
+ public static void transferProfilingToolPackage(IProgressMonitor monitor, ISession session) throws Exception {
try {
monitor.beginTask(Messages.getString("ProfileLaunch.TRANSFER_PROFILING_TOOL"), 1);
String toolPkgPath = sdkInstallPath + "/SDK/profiling-tool/" + PACKAGE_FILENAME_ARM;
File toolPkg = new File(toolPkgPath);
if(toolPkg == null || !toolPkg.exists())
- newCoreException(Messages.getString("ProfileLaunch.FAIL_TO_TRANSFER"), null);
+ throw new Exception(Messages.getString("ProfileLaunch.FAIL_TO_TRANSFER"),
+ new Exception("Tool package path (" + toolPkgPath + ") is not available."));
String destDirectoryPath = TEMPORARY_PKG_PATH;
String command = MAKE_DIRECTORY_CMD + destDirectoryPath + CMD_RESULT_CHECK;
String result = session.run(command, null);
if(!result.contains("0"))
- newCoreException(Messages.getString("ProfileLaunch.FAIL_TO_TRANSFER"), null);
+ throw new Exception(Messages.getString("ProfileLaunch.FAIL_TO_TRANSFER"),
+ new Exception("Destination path (" + destDirectoryPath + ") in not exist."));
}
String srcFilePath = toolPkg.getAbsoluteFile().getCanonicalPath();
- String destFilePath = destDirectoryPath + packageFile.getAbsoluteFile().getName();
+ String destFilePath = destDirectoryPath + toolPkg.getAbsoluteFile().getName();
boolean isSuccess = session.transferFile(srcFilePath, destFilePath);
if (isSuccess == false)
- newCoreException(Messages.getString("ProfileLaunch.FAIL_TO_TRANSFER"), null);
- } catch (CoreException e) {
- throw e;
+ throw new Exception(Messages.getString("ProfileLaunch.FAIL_TO_TRANSFER"),
+ new Exception("source path (" + srcFilePath + "), dest path (" + destFilePath +")"));
} catch (Exception e) {
- newCoreException(Messages.getString("ProfileLaunch.FAIL_TO_TRANSFER"), e);
+ throw e;
} finally {
monitor.done();
}
* @exception CoreException
* if unable to install a package
*/
- public void installProfilingToolPackage(IProgressMonitor monitor, ISession session) throws CoreException {
+ public static void installProfilingToolPackage(IProgressMonitor monitor, ISession session) throws Exception {
try {
monitor.beginTask(Messages.getString("ProfileLaunch.INSTALL_PROFILING_TOOL"), 2);
String command = CHANGE_DIRECTORY_CMD + packageDirectory + CMD_RESULT_CHECK;
String result = session.run(command, null);
if(!result.contains("0"))
- newCoreException(Messages.getString("ProfileLaunch.FAIL_TO_INSTALL"), null);
+ throw new Exception(Messages.getString("ProfileLaunch.FAIL_TO_INSTALL"), new Exception("command is " + command));
// remove old application
command = PKG_TOOL_CMD + PKG_TOOL_REMOVE_OPTION + PACKAGE_NAME + CMD_RESULT_CHECK ;
result = session.run(command, null);
if(!result.contains("0"))
- newCoreException(Messages.getString("ProfileLaunch.FAIL_TO_INSTALL"), null);
+ throw new Exception(Messages.getString("ProfileLaunch.FAIL_TO_INSTALL"), new Exception("command is " + command));
monitor.worked(1);
// install new application
command = PKG_TOOL_CMD + PKG_TOOL_INSTALL_OPTION + PACKAGE_FILENAME_ARM + CMD_RESULT_CHECK;
result = session.run(command, null);
if(!result.contains("0"))
- newCoreException(Messages.getString("ProfileLaunch.FAIL_TO_INSTALL"), null);
+ throw new Exception(Messages.getString("ProfileLaunch.FAIL_TO_INSTALL"), new Exception("command is " + command));
monitor.worked(1);
- } catch (CoreException e) {
- throw e;
} catch (Exception e) {
- newCoreException(Messages.getString("ProfileLaunch.FAIL_TO_INSTALL"), e);
+ throw e;
} finally {
monitor.done();
}
import java.util.ArrayList;
import java.util.Arrays;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.debug.ui.AbstractLaunchConfigurationTab;
import org.eclipse.debug.ui.ILaunchConfigurationDialog;
import org.eclipse.linuxtools.oprofile.launch.configuration.OprofileEventConfigTab;
import org.eclipse.linuxtools.profiling.launch.ProfileLaunchConfigurationTabGroup;
+import com.samsung.freshide.connection.session.ISession;
import com.samsung.freshide.launch.ui.SLPMainTab;
import com.samsung.freshide.launch.ui.SLPEnvironmentTab;
import com.samsung.freshide.launch.ui.SLPArgumentsTab;
+import com.samsung.linuxplatform.oprofile.core.OprofileComm;
+import com.samsung.linuxplatform.oprofile.launch.SLPOprofileLaunchDelegate;
+
import org.eclipse.debug.ui.sourcelookup.SourceLookupTab;
public class NormalOprofileLaunchConfigurationTabGroup extends ProfileLaunchConfigurationTabGroup {
-
+
public void createTabs(ILaunchConfigurationDialog dialog, String mode) {
ArrayList<AbstractLaunchConfigurationTab> tabs = new ArrayList<AbstractLaunchConfigurationTab>();
tabs.add(new SLPMainTab());
public AbstractLaunchConfigurationTab[] getProfileTabs() {
//jinu modified at 20090602
//return new AbstractLaunchConfigurationTab[] { new OprofileSetupTab(), new OprofileEventConfigTab() };
+
+ // added by greatim at 20110613
+ try{
+ ISession session = OprofileComm.getSession();
+ IProgressMonitor monitor = new NullProgressMonitor();
+
+ SLPOprofileLaunchDelegate.checkProfilingTool(monitor, session);
+ } catch(Exception e) {
+
+ }
+
return new AbstractLaunchConfigurationTab[] { new OprofileEventConfigTab() };
}
+
}
public class OProfileTargetConnectionListener implements IDeviceListener{
@Override
- public void StatusChanged(int Event) {
-
- }
-
- @Override
public void ConnectionChanged() {
try {
if(DeviceManager.hasSelectedDevice() == false ||
import org.eclipse.linuxtools.valgrind.ui.ValgrindUIPlugin;
import org.eclipse.linuxtools.valgrind.core.ValgrindCommand;
import org.eclipse.linuxtools.valgrind.core.utils.LaunchConfigurationConstants;
+
+import com.samsung.freshide.connection.device.DeviceManager;
+import com.samsung.freshide.connection.machine.IMachine;
import com.samsung.freshide.connection.session.ISession;
import com.samsung.freshide.launch.SLPLaunchDelegate;
import com.samsung.freshide.launch.SLPLaunchMessages;
String resultRsp = session.run(cmd, null);
if(!resultRsp.contains("0"))
{
- transferProfilingToolPackage(monitor, session);
- installProfilingToolPackage(monitor, session);
-// newCoreException(SLPLaunchMessages.CANNOT_LAUNCH, new Exception("No valgrind in this target (/usr/bin/valgrind). "));
+ if(DeviceManager.getSelectedDevice().getMachineType().equals(IMachine.VIRTUAL_DEVICE))
+ {
+ newCoreException(SLPLaunchMessages.CANNOT_LAUNCH, new Exception("No valgrind in this target (/usr/bin/valgrind). "));
+ }
+ else
+ {
+ transferProfilingToolPackage(monitor, session);
+ installProfilingToolPackage(monitor, session);
+ }
}
String remoteExePath = getRemoteExePath(config);
String toolPkgPath = sdkInstallPath + "/SDK/profiling-tool/" + PACKAGE_FILENAME_ARM;
File toolPkg = new File(toolPkgPath);
if(toolPkg == null || !toolPkg.exists())
- newCoreException(Messages.getString("ProfileLaunch.FAIL_TO_TRANSFER"), null);
+ newCoreException(Messages.getString("ProfileLaunch.FAIL_TO_TRANSFER"),
+ new Exception("Tool package path (" + toolPkgPath + ") is not available."));
String destDirectoryPath = TEMPORARY_PKG_PATH;
String command = MAKE_DIRECTORY_CMD + destDirectoryPath + CMD_RESULT_CHECK;
String result = session.run(command, null);
if(!result.contains("0"))
- newCoreException(Messages.getString("ProfileLaunch.FAIL_TO_TRANSFER"), null);
+ newCoreException(Messages.getString("ProfileLaunch.FAIL_TO_TRANSFER"),
+ new Exception("Destination path (" + destDirectoryPath + ") in not exist."));
}
String srcFilePath = toolPkg.getAbsoluteFile().getCanonicalPath();
- String destFilePath = destDirectoryPath + packageFile.getAbsoluteFile().getName();
-
+ String destFilePath = destDirectoryPath + toolPkg.getAbsoluteFile().getName();
+
boolean isSuccess = session.transferFile(srcFilePath, destFilePath);
-
+
if (isSuccess == false)
- newCoreException(Messages.getString("ProfileLaunch.FAIL_TO_TRANSFER"), null);
+ newCoreException(Messages.getString("ProfileLaunch.FAIL_TO_TRANSFER"),
+ new Exception("source path (" + srcFilePath + "), dest path (" + destFilePath +")"));
} catch (CoreException e) {
throw e;
} catch (Exception e) {
String command = CHANGE_DIRECTORY_CMD + packageDirectory + CMD_RESULT_CHECK;
String result = session.run(command, null);
if(!result.contains("0"))
- newCoreException(Messages.getString("ProfileLaunch.FAIL_TO_INSTALL"), null);
+ newCoreException(Messages.getString("ProfileLaunch.FAIL_TO_INSTALL"),
+ new Exception("command is " + command));
// remove old application
command = PKG_TOOL_CMD + PKG_TOOL_REMOVE_OPTION + PACKAGE_NAME + CMD_RESULT_CHECK ;
result = session.run(command, null);
if(!result.contains("0"))
- newCoreException(Messages.getString("ProfileLaunch.FAIL_TO_INSTALL"), null);
+ newCoreException(Messages.getString("ProfileLaunch.FAIL_TO_INSTALL"),
+ new Exception("command is " + command));
monitor.worked(1);
// install new application
command = PKG_TOOL_CMD + PKG_TOOL_INSTALL_OPTION + PACKAGE_FILENAME_ARM + CMD_RESULT_CHECK;
result = session.run(command, null);
if(!result.contains("0"))
- newCoreException(Messages.getString("ProfileLaunch.FAIL_TO_INSTALL"), null);
+ newCoreException(Messages.getString("ProfileLaunch.FAIL_TO_INSTALL"),
+ new Exception("command is " + command));
monitor.worked(1);
} catch (CoreException e) {
throw e;