From: wonhyoung2.park Date: Mon, 5 Dec 2011 06:16:48 +0000 (+0900) Subject: [TITLE] add console (profile stop available) X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=fad01351a78f187c468c4c8b418de6ea77b93e18;p=sdk%2Fide%2Fprofiler-eplugin.git [TITLE] add console (profile stop available) [Type] [Module] Profiler [Priority] [CQ#] [Redmine#] [Problem] [Cause] [Solution] [TestCase] --- diff --git a/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/CommandManager.java b/org.eclipse.linuxtools.oprofile.core/src/com/samsung/tizen/oprofile/core/CommandManager.java similarity index 92% rename from org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/CommandManager.java rename to org.eclipse.linuxtools.oprofile.core/src/com/samsung/tizen/oprofile/core/CommandManager.java index e46502f..e37b884 100644 --- a/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/CommandManager.java +++ b/org.eclipse.linuxtools.oprofile.core/src/com/samsung/tizen/oprofile/core/CommandManager.java @@ -1,12 +1,12 @@ -package org.eclipse.linuxtools.oprofile.core; +package com.samsung.tizen.oprofile.core; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; -import org.eclipse.linuxtools.oprofile.core.CommonReceiver; import com.samsung.tizen.common.connection.ConnectionPlugin; +import com.samsung.tizen.oprofile.core.CommonReceiver; import com.samsung.tizen.sdblib.IDevice; import com.samsung.tizen.sdblib.MultiLineReceiver; import com.samsung.tizen.sdblib.SdbCommandRejectedException; @@ -67,6 +67,20 @@ public class CommandManager { return path; } + public static SdbShellProcess runApplication(String command){ + IDevice device = ConnectionPlugin.getDefault().getCurrentDevice(); + SdbShellProcess sdbShellProc = null; + + command = getRealTargetPath(command); + + try { + sdbShellProc = device.executeShellCommand(command); + } catch (IOException e) { + e.printStackTrace(); + } + return sdbShellProc; + } + public static void runShell(String command) { IDevice device = ConnectionPlugin.getDefault().getCurrentDevice(); SdbShellProcess sdbShellProc = null; diff --git a/org.eclipse.linuxtools.oprofile.core/src/com/samsung/tizen/oprofile/core/processor/checkevent/CheckEventsProcessor.java b/org.eclipse.linuxtools.oprofile.core/src/com/samsung/tizen/oprofile/core/processor/checkevent/CheckEventsProcessor.java index d248dbc..2bbf934 100644 --- a/org.eclipse.linuxtools.oprofile.core/src/com/samsung/tizen/oprofile/core/processor/checkevent/CheckEventsProcessor.java +++ b/org.eclipse.linuxtools.oprofile.core/src/com/samsung/tizen/oprofile/core/processor/checkevent/CheckEventsProcessor.java @@ -20,9 +20,9 @@ package com.samsung.tizen.oprofile.core.processor.checkevent; +import com.samsung.tizen.oprofile.core.CommandManager; import com.samsung.tizen.oprofile.core.OprofileCommonConstants; -import org.eclipse.linuxtools.oprofile.core.CommandManager; public class CheckEventsProcessor { diff --git a/org.eclipse.linuxtools.oprofile.core/src/com/samsung/tizen/oprofile/core/processor/checkkernel/CheckKernelProcessor.java b/org.eclipse.linuxtools.oprofile.core/src/com/samsung/tizen/oprofile/core/processor/checkkernel/CheckKernelProcessor.java index 0b8e78d..7cd0f4e 100644 --- a/org.eclipse.linuxtools.oprofile.core/src/com/samsung/tizen/oprofile/core/processor/checkkernel/CheckKernelProcessor.java +++ b/org.eclipse.linuxtools.oprofile.core/src/com/samsung/tizen/oprofile/core/processor/checkkernel/CheckKernelProcessor.java @@ -20,8 +20,8 @@ package com.samsung.tizen.oprofile.core.processor.checkkernel; -import org.eclipse.linuxtools.oprofile.core.CommandManager; +import com.samsung.tizen.oprofile.core.CommandManager; import com.samsung.tizen.oprofile.core.OprofileCommonConstants; public class CheckKernelProcessor { diff --git a/org.eclipse.linuxtools.oprofile.core/src/com/samsung/tizen/oprofile/core/processor/eventinfo/EventListProcessor.java b/org.eclipse.linuxtools.oprofile.core/src/com/samsung/tizen/oprofile/core/processor/eventinfo/EventListProcessor.java index ff657a1..40e6349 100644 --- a/org.eclipse.linuxtools.oprofile.core/src/com/samsung/tizen/oprofile/core/processor/eventinfo/EventListProcessor.java +++ b/org.eclipse.linuxtools.oprofile.core/src/com/samsung/tizen/oprofile/core/processor/eventinfo/EventListProcessor.java @@ -22,12 +22,12 @@ package com.samsung.tizen.oprofile.core.processor.eventinfo; import java.util.ArrayList; -import org.eclipse.linuxtools.oprofile.core.CommandManager; import org.eclipse.linuxtools.oprofile.core.daemon.OpEvent; import org.eclipse.linuxtools.oprofile.core.daemon.OpInfo; import org.eclipse.linuxtools.oprofile.core.daemon.OpUnitMask; import org.eclipse.linuxtools.oprofile.core.daemon.OpUnitMask.MaskInfo; +import com.samsung.tizen.oprofile.core.CommandManager; import com.samsung.tizen.oprofile.core.OprofileCommonConstants; public class EventListProcessor { diff --git a/org.eclipse.linuxtools.oprofile.core/src/com/samsung/tizen/oprofile/core/processor/eventinfo/OpInfoProcessor.java b/org.eclipse.linuxtools.oprofile.core/src/com/samsung/tizen/oprofile/core/processor/eventinfo/OpInfoProcessor.java index ec563d9..db18a27 100644 --- a/org.eclipse.linuxtools.oprofile.core/src/com/samsung/tizen/oprofile/core/processor/eventinfo/OpInfoProcessor.java +++ b/org.eclipse.linuxtools.oprofile.core/src/com/samsung/tizen/oprofile/core/processor/eventinfo/OpInfoProcessor.java @@ -20,9 +20,10 @@ package com.samsung.tizen.oprofile.core.processor.eventinfo; -import org.eclipse.linuxtools.oprofile.core.CommandManager; import org.eclipse.linuxtools.oprofile.core.daemon.OpInfo; +import com.samsung.tizen.oprofile.core.CommandManager; + public class OpInfoProcessor { private OpInfo info; diff --git a/org.eclipse.linuxtools.oprofile.core/src/com/samsung/tizen/oprofile/core/processor/modeldata/ModelDataProcessor.java b/org.eclipse.linuxtools.oprofile.core/src/com/samsung/tizen/oprofile/core/processor/modeldata/ModelDataProcessor.java index 8896f2c..9471f82 100644 --- a/org.eclipse.linuxtools.oprofile.core/src/com/samsung/tizen/oprofile/core/processor/modeldata/ModelDataProcessor.java +++ b/org.eclipse.linuxtools.oprofile.core/src/com/samsung/tizen/oprofile/core/processor/modeldata/ModelDataProcessor.java @@ -27,11 +27,11 @@ import javax.xml.parsers.ParserConfigurationException; import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; -import org.eclipse.linuxtools.oprofile.core.CommandManager; import org.eclipse.linuxtools.oprofile.core.model.OpModelRoot; import org.xml.sax.InputSource; import org.xml.sax.SAXException; +import com.samsung.tizen.oprofile.core.CommandManager; import com.samsung.tizen.oprofile.core.OprofileCommonConstants; import com.samsung.tizen.oprofile.core.processor.modeldata.handler.OprofileSAXHandler; diff --git a/org.eclipse.linuxtools.oprofile.core/src/com/samsung/tizen/oprofile/core/processor/sessions/SessionsProcessor.java b/org.eclipse.linuxtools.oprofile.core/src/com/samsung/tizen/oprofile/core/processor/sessions/SessionsProcessor.java index a52c956..1abacf2 100644 --- a/org.eclipse.linuxtools.oprofile.core/src/com/samsung/tizen/oprofile/core/processor/sessions/SessionsProcessor.java +++ b/org.eclipse.linuxtools.oprofile.core/src/com/samsung/tizen/oprofile/core/processor/sessions/SessionsProcessor.java @@ -22,11 +22,11 @@ package com.samsung.tizen.oprofile.core.processor.sessions; import java.util.ArrayList; -import org.eclipse.linuxtools.oprofile.core.CommandManager; import org.eclipse.linuxtools.oprofile.core.Oprofile; import org.eclipse.linuxtools.oprofile.core.model.OpModelEvent; import org.eclipse.linuxtools.oprofile.core.model.OpModelSession; +import com.samsung.tizen.oprofile.core.CommandManager; import com.samsung.tizen.oprofile.core.OprofileCommonConstants; diff --git a/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/linux/LinuxOpcontrolProvider.java b/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/linux/LinuxOpcontrolProvider.java index eed9777..4eb891c 100644 --- a/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/linux/LinuxOpcontrolProvider.java +++ b/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/linux/LinuxOpcontrolProvider.java @@ -13,7 +13,6 @@ package org.eclipse.linuxtools.oprofile.core.linux; import java.util.ArrayList; -import org.eclipse.linuxtools.oprofile.core.CommandManager; import org.eclipse.linuxtools.oprofile.core.IOpcontrolProvider; import org.eclipse.linuxtools.oprofile.core.OpcontrolException; import org.eclipse.linuxtools.oprofile.core.Oprofile; @@ -22,6 +21,7 @@ import org.eclipse.linuxtools.oprofile.core.daemon.OprofileDaemonEvent; import org.eclipse.linuxtools.oprofile.core.daemon.OprofileDaemonOptions; import com.samsung.tizen.common.connection.ConnectionPlugin; +import com.samsung.tizen.oprofile.core.CommandManager; import com.samsung.tizen.oprofile.core.OprofileComm; import com.samsung.tizen.oprofile.core.OprofileCommonConstants; diff --git a/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/linux/OpxmlRunner.java b/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/linux/OpxmlRunner.java index a796d0c..2c4fcdb 100644 --- a/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/linux/OpxmlRunner.java +++ b/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/linux/OpxmlRunner.java @@ -16,7 +16,6 @@ import java.io.StringReader; import javax.xml.parsers.SAXParserFactory; -import org.eclipse.linuxtools.oprofile.core.CommandManager; import org.eclipse.linuxtools.oprofile.core.OprofileCorePlugin; import org.eclipse.linuxtools.oprofile.core.OpxmlException; import org.eclipse.linuxtools.oprofile.core.opxml.OprofileSAXHandler; @@ -25,6 +24,7 @@ import org.xml.sax.InputSource; import org.xml.sax.SAXException; import org.xml.sax.XMLReader; +import com.samsung.tizen.oprofile.core.CommandManager; import com.samsung.tizen.oprofile.core.OprofileComm; /** diff --git a/org.eclipse.linuxtools.oprofile.launch.exe/src/com/samsung/tizen/oprofile/launch/TizenOprofileLaunchDelegate.java b/org.eclipse.linuxtools.oprofile.launch.exe/src/com/samsung/tizen/oprofile/launch/TizenOprofileLaunchDelegate.java index 55ff7b7..fc10564 100644 --- a/org.eclipse.linuxtools.oprofile.launch.exe/src/com/samsung/tizen/oprofile/launch/TizenOprofileLaunchDelegate.java +++ b/org.eclipse.linuxtools.oprofile.launch.exe/src/com/samsung/tizen/oprofile/launch/TizenOprofileLaunchDelegate.java @@ -20,7 +20,10 @@ package com.samsung.tizen.oprofile.launch; +import java.io.BufferedReader; import java.io.File; +import java.io.IOException; +import java.io.InputStreamReader; import java.util.ArrayList; import org.eclipse.cdt.debug.core.CDebugUtils; @@ -31,11 +34,11 @@ import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.core.runtime.OperationCanceledException; import org.eclipse.core.runtime.SubProgressMonitor; +import org.eclipse.debug.core.DebugPlugin; import org.eclipse.debug.core.ILaunch; import org.eclipse.debug.core.ILaunchConfiguration; import org.eclipse.debug.core.ILaunchManager; import org.eclipse.debug.core.ILaunchesListener2; -import org.eclipse.linuxtools.oprofile.core.CommandManager; import org.eclipse.linuxtools.oprofile.core.OpcontrolException; import org.eclipse.linuxtools.oprofile.core.Oprofile; import org.eclipse.linuxtools.oprofile.core.OprofileCorePlugin; @@ -53,10 +56,12 @@ import org.eclipse.ui.PlatformUI; import com.samsung.tizen.common.properties.InstallPathConfig; import com.samsung.tizen.nativeapp.launch.TizenLaunchDelegate; import com.samsung.tizen.nativeapp.launch.TizenLaunchMessages; +import com.samsung.tizen.oprofile.core.CommandManager; import com.samsung.tizen.oprofile.launch.DefaultSettingConstants; +import com.samsung.tizen.sdblib.SdbShellProcess; public class TizenOprofileLaunchDelegate extends TizenLaunchDelegate { - + protected static final String MAKE_DIRECTORY_CMD = "mkdir -p "; protected static final String CHANGE_DIRECTORY_CMD = "cd "; @@ -141,8 +146,9 @@ public class TizenOprofileLaunchDelegate extends TizenLaunchDelegate { cmd += " " + arguments; // remoteShellProcess = session.launch(cmd, null); + // CommandManager.runShell(cmd); + runApplication(config, launch, cmd); - CommandManager.runShell(cmd); postProcedure(config, launch, monitor); } catch (CoreException e) { @@ -158,6 +164,29 @@ public class TizenOprofileLaunchDelegate extends TizenLaunchDelegate { } } + private void runApplication(ILaunchConfiguration config, ILaunch launch, + String command) { + SdbShellProcess oprofileProc = CommandManager.runApplication(command); + IPath exeFile = null; + try { + exeFile = CDebugUtils.verifyProgramPath(config); + DebugPlugin.newProcess(launch, oprofileProc, exeFile.toFile() + .getName()); + BufferedReader br = new BufferedReader(new InputStreamReader( + oprofileProc.getInputStream())); + while (null != br.readLine()) { + } + br.close(); + } catch (CoreException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } + private void preProcedure(ILaunchConfiguration config, ILaunch launch, IProgressMonitor monitor, String imagePath) throws CoreException { // FIXME: this assumes that project names are always the directory names diff --git a/org.eclipse.linuxtools.valgrind.launch.exe/src/org/eclipse/linuxtools/valgrind/launch/CommandManager.java b/org.eclipse.linuxtools.valgrind.launch.exe/src/org/eclipse/linuxtools/valgrind/launch/CommandManager.java index 4577e6b..ab59459 100644 --- a/org.eclipse.linuxtools.valgrind.launch.exe/src/org/eclipse/linuxtools/valgrind/launch/CommandManager.java +++ b/org.eclipse.linuxtools.valgrind.launch.exe/src/org/eclipse/linuxtools/valgrind/launch/CommandManager.java @@ -43,6 +43,20 @@ public class CommandManager { } return path; } + + public static SdbShellProcess runApplication(String command){ + IDevice device = ConnectionPlugin.getDefault().getCurrentDevice(); + SdbShellProcess sdbShellProc = null; + + command = getRealTargetPath(command); + + try { + sdbShellProc = device.executeShellCommand(command); + } catch (IOException e) { + e.printStackTrace(); + } + return sdbShellProc; + } public static String runShell(String command) { IDevice device = ConnectionPlugin.getDefault().getCurrentDevice(); diff --git a/org.eclipse.linuxtools.valgrind.launch.exe/src/org/eclipse/linuxtools/valgrind/launch/TizenValgrindLaunchDelegate.java b/org.eclipse.linuxtools.valgrind.launch.exe/src/org/eclipse/linuxtools/valgrind/launch/TizenValgrindLaunchDelegate.java index 3b1deb6..117ac11 100644 --- a/org.eclipse.linuxtools.valgrind.launch.exe/src/org/eclipse/linuxtools/valgrind/launch/TizenValgrindLaunchDelegate.java +++ b/org.eclipse.linuxtools.valgrind.launch.exe/src/org/eclipse/linuxtools/valgrind/launch/TizenValgrindLaunchDelegate.java @@ -20,8 +20,10 @@ package org.eclipse.linuxtools.valgrind.launch; +import java.io.BufferedReader; import java.io.File; import java.io.IOException; +import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Arrays; @@ -35,6 +37,7 @@ import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.core.runtime.OperationCanceledException; import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.SubProgressMonitor; +import org.eclipse.debug.core.DebugPlugin; import org.eclipse.debug.core.ILaunch; import org.eclipse.debug.core.ILaunchConfiguration; import org.eclipse.debug.core.ILaunchManager; @@ -49,9 +52,10 @@ import org.eclipse.ui.PlatformUI; import com.samsung.tizen.common.properties.InstallPathConfig; import com.samsung.tizen.nativeapp.launch.TizenLaunchDelegate; import com.samsung.tizen.nativeapp.launch.TizenLaunchMessages; +import com.samsung.tizen.sdblib.SdbShellProcess; public class TizenValgrindLaunchDelegate extends TizenLaunchDelegate { - + protected static final String MAKE_DIRECTORY_CMD = "mkdir -p "; protected static final String CHANGE_DIRECTORY_CMD = "cd "; @@ -194,7 +198,8 @@ public class TizenValgrindLaunchDelegate extends TizenLaunchDelegate { // is // this? // remoteShellProcess = session.launch(fullcommand, null); - CommandManager.runShell(fullcommand); + // CommandManager.runShell(fullcommand); + runApplication(config, launch, fullcommand); monitor.worked(2); @@ -241,6 +246,28 @@ public class TizenValgrindLaunchDelegate extends TizenLaunchDelegate { } } + private void runApplication(ILaunchConfiguration config, ILaunch launch, + String command) { + SdbShellProcess oprofileProc = CommandManager.runApplication(command); + IPath exeFile = null; + try { + exeFile = CDebugUtils.verifyProgramPath(config); + DebugPlugin.newProcess(launch, oprofileProc, exeFile.toFile() + .getName()); + BufferedReader br = new BufferedReader(new InputStreamReader( + oprofileProc.getInputStream())); + while (null != br.readLine()) { + } + } catch (CoreException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } + private String[] getValgrindArgumentsArray(ILaunchConfiguration config) throws IOException, CoreException { ArrayList opts = new ArrayList(); diff --git a/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/valgrind/massif/MassifLaunchDelegate.java b/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/valgrind/massif/MassifLaunchDelegate.java index ccf4e52..cfce43f 100644 --- a/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/valgrind/massif/MassifLaunchDelegate.java +++ b/org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/valgrind/massif/MassifLaunchDelegate.java @@ -79,7 +79,7 @@ public class MassifLaunchDelegate extends TizenLaunchDelegate implements MassifPlugin.getDefault().setConfig(config); MassifPlugin.getDefault().setSourceLocator(launch.getSourceLocator()); try { - // command.getProcess().waitFor(); + //command.getProcess().waitFor(); // remoteShellProcess.waitFor(); diff --git a/org.eclipse.linuxtools.valgrind.memcheck/src/org/eclipse/linuxtools/valgrind/memcheck/MemcheckLaunchDelegate.java b/org.eclipse.linuxtools.valgrind.memcheck/src/org/eclipse/linuxtools/valgrind/memcheck/MemcheckLaunchDelegate.java index 4796c9b..5a53e13 100644 --- a/org.eclipse.linuxtools.valgrind.memcheck/src/org/eclipse/linuxtools/valgrind/memcheck/MemcheckLaunchDelegate.java +++ b/org.eclipse.linuxtools.valgrind.memcheck/src/org/eclipse/linuxtools/valgrind/memcheck/MemcheckLaunchDelegate.java @@ -59,7 +59,7 @@ public class MemcheckLaunchDelegate extends TizenLaunchDelegate implements IValg //String ValgrindHostdir = ValgrindUIPlugin.getDefault().getStateLocation().append("Valgrind_XML").toOSString(); String ValgrindHostdir = ValgrindUIPlugin.getDefault().getStateLocation().toOSString(); String targetlog=ValgrindLaunchPlugin.RESULT_DIR +"valgrind.xml"; - String hostlog =ValgrindHostdir + /*File.separator +*/ "valgrind_out.xml"; + String hostlog =ValgrindHostdir + File.separator + "valgrind_out.xml"; //--bery sftp dowonload File file = new File(hostlog); if(file.exists()){