[TITLE] add console (profile stop available)
authorwonhyoung2.park <wonhyoung2.park@samsung.com>
Mon, 5 Dec 2011 06:16:48 +0000 (15:16 +0900)
committerwonhyoung2.park <wonhyoung2.park@samsung.com>
Mon, 5 Dec 2011 06:16:48 +0000 (15:16 +0900)
[Type]
[Module] Profiler
[Priority]
[CQ#]
[Redmine#]
[Problem]
[Cause]
[Solution]
[TestCase]

14 files changed:
org.eclipse.linuxtools.oprofile.core/src/com/samsung/tizen/oprofile/core/CommandManager.java [moved from org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/CommandManager.java with 92% similarity]
org.eclipse.linuxtools.oprofile.core/src/com/samsung/tizen/oprofile/core/processor/checkevent/CheckEventsProcessor.java
org.eclipse.linuxtools.oprofile.core/src/com/samsung/tizen/oprofile/core/processor/checkkernel/CheckKernelProcessor.java
org.eclipse.linuxtools.oprofile.core/src/com/samsung/tizen/oprofile/core/processor/eventinfo/EventListProcessor.java
org.eclipse.linuxtools.oprofile.core/src/com/samsung/tizen/oprofile/core/processor/eventinfo/OpInfoProcessor.java
org.eclipse.linuxtools.oprofile.core/src/com/samsung/tizen/oprofile/core/processor/modeldata/ModelDataProcessor.java
org.eclipse.linuxtools.oprofile.core/src/com/samsung/tizen/oprofile/core/processor/sessions/SessionsProcessor.java
org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/linux/LinuxOpcontrolProvider.java
org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/linux/OpxmlRunner.java
org.eclipse.linuxtools.oprofile.launch.exe/src/com/samsung/tizen/oprofile/launch/TizenOprofileLaunchDelegate.java
org.eclipse.linuxtools.valgrind.launch.exe/src/org/eclipse/linuxtools/valgrind/launch/CommandManager.java
org.eclipse.linuxtools.valgrind.launch.exe/src/org/eclipse/linuxtools/valgrind/launch/TizenValgrindLaunchDelegate.java
org.eclipse.linuxtools.valgrind.massif/src/org/eclipse/linuxtools/valgrind/massif/MassifLaunchDelegate.java
org.eclipse.linuxtools.valgrind.memcheck/src/org/eclipse/linuxtools/valgrind/memcheck/MemcheckLaunchDelegate.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;
index d248dbc..2bbf934 100644 (file)
@@ -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 {
 
index 0b8e78d..7cd0f4e 100644 (file)
@@ -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 {
index ff657a1..40e6349 100644 (file)
@@ -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 {
index ec563d9..db18a27 100644 (file)
 
 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;
 
index 8896f2c..9471f82 100644 (file)
@@ -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;
 
index a52c956..1abacf2 100644 (file)
@@ -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;
 
 
index eed9777..4eb891c 100644 (file)
@@ -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;
 
index a796d0c..2c4fcdb 100644 (file)
@@ -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;
 
 /**
index 55ff7b7..fc10564 100644 (file)
 
 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
index 4577e6b..ab59459 100644 (file)
@@ -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();
index 3b1deb6..117ac11 100644 (file)
 
 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<String> opts = new ArrayList<String>();
index ccf4e52..cfce43f 100644 (file)
@@ -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();
 
index 4796c9b..5a53e13 100644 (file)
@@ -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()){