[title] profile bug fix for window
authorwonhyoung2.park <wonhyoung2.park@samsung.com>
Fri, 14 Oct 2011 12:42:40 +0000 (21:42 +0900)
committerwonhyoung2.park <wonhyoung2.park@samsung.com>
Fri, 14 Oct 2011 12:42:40 +0000 (21:42 +0900)
[Type]
[Module] Profiler
[Priority] Major
[CQ#]
[Redmine#] 2757 2760
[Problem]
[Cause]
[Solution]
[TestCase]

org.eclipse.linuxtools.oprofile.core/src/com/samsung/linuxplatform/oprofile/core/processor/checkevent/CheckEventsProcessor.java
org.eclipse.linuxtools.oprofile.core/src/com/samsung/linuxplatform/oprofile/core/processor/checkkernel/CheckKernelProcessor.java
org.eclipse.linuxtools.oprofile.core/src/com/samsung/linuxplatform/oprofile/core/processor/eventinfo/EventListProcessor.java
org.eclipse.linuxtools.oprofile.core/src/com/samsung/linuxplatform/oprofile/core/processor/eventinfo/OpInfoProcessor.java
org.eclipse.linuxtools.oprofile.core/src/com/samsung/linuxplatform/oprofile/core/processor/modeldata/ModelDataProcessor.java
org.eclipse.linuxtools.oprofile.core/src/com/samsung/linuxplatform/oprofile/core/processor/sessions/SessionsProcessor.java
org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/PathParser.java [new file with mode: 0644]
org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/linux/OpxmlRunner.java
org.eclipse.linuxtools.oprofile.launch.exe/src/com/samsung/linuxplatform/oprofile/launch/SLPOprofileLaunchDelegate.java
org.eclipse.linuxtools.valgrind.launch.exe/src/org/eclipse/linuxtools/valgrind/launch/PathParser.java [new file with mode: 0644]
org.eclipse.linuxtools.valgrind.launch.exe/src/org/eclipse/linuxtools/valgrind/launch/SLPValgrindLaunchDelegate.java

index cc15163..2d09683 100644 (file)
@@ -20,6 +20,8 @@
 
 package com.samsung.linuxplatform.oprofile.core.processor.checkevent;
 
+import org.eclipse.linuxtools.oprofile.core.PathParser;
+
 import com.samsung.linuxplatform.oprofile.core.OprofileCommonConstants;
 import com.samsung.slp.common.conn.session.ISession;
 
@@ -45,6 +47,7 @@ public class CheckEventsProcessor{
                
                try {
                        resultStr = session.run(COMMAND_CHECK_EVENT+" "+event+":"+count+":"+unitmask, null);
+                       resultStr = PathParser.pathParsing(resultStr);
                } catch (Exception e) {
                        throw new InterruptedException();
                }
index 9a09e01..a261522 100644 (file)
@@ -20,6 +20,8 @@
 
 package com.samsung.linuxplatform.oprofile.core.processor.checkkernel;
 
+import org.eclipse.linuxtools.oprofile.core.PathParser;
+
 import com.samsung.linuxplatform.oprofile.core.OprofileCommonConstants;
 import com.samsung.slp.common.conn.session.ISession;
 
@@ -44,6 +46,7 @@ public class CheckKernelProcessor{
                
                try {
                        resultStr = session.run(COMMAND_CHECK_KERNEL, null);
+                       resultStr = PathParser.pathParsing(resultStr);
                } catch (Exception e) {
                        throw new InterruptedException();
                }
index 2f882dd..4dd34e3 100644 (file)
@@ -22,6 +22,7 @@ package com.samsung.linuxplatform.oprofile.core.processor.eventinfo;
 
 import java.util.ArrayList;
 
+import org.eclipse.linuxtools.oprofile.core.PathParser;
 import org.eclipse.linuxtools.oprofile.core.daemon.OpEvent;
 import org.eclipse.linuxtools.oprofile.core.daemon.OpInfo;
 import org.eclipse.linuxtools.oprofile.core.daemon.OpUnitMask;
@@ -64,6 +65,7 @@ public class EventListProcessor{
                
                try {
                        resultStr = session.run(COMMAND_EVENT_LIST, null);
+                       resultStr = PathParser.pathParsing(resultStr);
                } catch (Exception e) {
                        throw new InterruptedException();
                }
index 67d6e05..116445a 100644 (file)
@@ -23,6 +23,7 @@ package com.samsung.linuxplatform.oprofile.core.processor.eventinfo;
 import org.eclipse.linuxtools.oprofile.core.daemon.OpInfo;
 
 import com.samsung.slp.common.conn.session.ISession;
+import org.eclipse.linuxtools.oprofile.core.PathParser;
 
 
 public class OpInfoProcessor{
@@ -44,9 +45,7 @@ public class OpInfoProcessor{
                
                try {
                        resultStr = session.run(COMMAND_COUNTER_NO, null);
-                       if(resultStr.startsWith("/opt/home/root # ")){
-                               resultStr = resultStr.substring(17, resultStr.length());
-                       }
+                       resultStr = PathParser.pathParsing(resultStr);
                } catch (Exception e) {
                        throw new InterruptedException();
                }
index 74ce5b8..afb2091 100644 (file)
@@ -27,6 +27,7 @@ import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.parsers.SAXParser;
 import javax.xml.parsers.SAXParserFactory;
 
+import org.eclipse.linuxtools.oprofile.core.PathParser;
 import org.eclipse.linuxtools.oprofile.core.model.OpModelRoot;
 import org.xml.sax.InputSource;
 import org.xml.sax.SAXException;
@@ -61,6 +62,7 @@ public class ModelDataProcessor{
                String resultStr= null;
                try {
                        resultStr = session.run(COMMAND_SESSION_EVENT, null);
+                       resultStr = PathParser.pathParsing(resultStr);
                } catch (Exception e) {
                        throw new InterruptedException();
                }
@@ -73,9 +75,6 @@ public class ModelDataProcessor{
                }
                
                try {
-                       if(resultStr.startsWith("/opt/home/root # ")){
-                               resultStr = resultStr.substring(19,resultStr.length());
-                       }
                        saxParser.parse(new InputSource(new StringReader(resultStr)),handler);
                } catch (Exception e) {
                        e.printStackTrace();
index def03a8..7344899 100644 (file)
@@ -23,6 +23,7 @@ package com.samsung.linuxplatform.oprofile.core.processor.sessions;
 import java.util.ArrayList;
 
 import org.eclipse.linuxtools.oprofile.core.Oprofile;
+import org.eclipse.linuxtools.oprofile.core.PathParser;
 import org.eclipse.linuxtools.oprofile.core.model.OpModelEvent;
 import org.eclipse.linuxtools.oprofile.core.model.OpModelSession;
 
@@ -54,6 +55,7 @@ public class SessionsProcessor{
                
                try {
                        resultStr = session.run(COMMAND_SESSION_EVENT, null);
+                       resultStr = PathParser.pathParsing(resultStr);
                } catch (Exception e) {
                        throw new InterruptedException();
                }
diff --git a/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/PathParser.java b/org.eclipse.linuxtools.oprofile.core/src/org/eclipse/linuxtools/oprofile/core/PathParser.java
new file mode 100644 (file)
index 0000000..f769bd9
--- /dev/null
@@ -0,0 +1,13 @@
+package org.eclipse.linuxtools.oprofile.core;
+
+public class PathParser {
+       static public String pathParsing(String str){
+               if(str.startsWith("/opt/home/root # ")){
+                       str = str.substring(17,str.length());
+                       if(str.startsWith("\r\n")){
+                               str = str.substring(2, str.length());                           
+                       }                       
+               }
+               return str;             
+       }
+}
index f6f6d2d..e6dde4b 100644 (file)
@@ -18,6 +18,7 @@ import javax.xml.parsers.SAXParserFactory;
 
 import org.eclipse.linuxtools.oprofile.core.OprofileCorePlugin;
 import org.eclipse.linuxtools.oprofile.core.OpxmlException;
+import org.eclipse.linuxtools.oprofile.core.PathParser;
 import org.eclipse.linuxtools.oprofile.core.opxml.OprofileSAXHandler;
 import org.eclipse.linuxtools.oprofile.core.opxml.XMLProcessor;
 import org.xml.sax.InputSource;
@@ -88,6 +89,7 @@ public class OpxmlRunner {
                        
                        String command = OprofileComm.getCommandString(cmdArray)+" | sed 's/^[^<]*//' | sed 's/&//'";
                        String str = session.run(command, null);
+                       str = PathParser.pathParsing(str);
                        reader.parse(new InputSource(new StringReader(str)));   
                        
                        //jinu removed at 20090616
index f0aa841..79c1b0c 100644 (file)
@@ -48,6 +48,7 @@ import com.samsung.slp.nativeide.launch.SLPLaunchDelegate;
 import com.samsung.slp.nativeide.launch.SLPLaunchMessages;
 
 import org.eclipse.linuxtools.oprofile.core.OprofileCorePlugin;
+import org.eclipse.linuxtools.oprofile.core.PathParser;
 import org.eclipse.linuxtools.oprofile.core.daemon.OprofileDaemonEvent;
 import org.eclipse.linuxtools.oprofile.core.OpcontrolException;
 import org.eclipse.linuxtools.oprofile.launch.OprofileLaunchPlugin;
@@ -103,6 +104,7 @@ public class SLPOprofileLaunchDelegate extends SLPLaunchDelegate {
                        String remoteExePath = getRemoteExePath(config); 
                        String cmd = "cd " + remoteExePath + CMD_RESULT_CHECK;
                        String resultRsp = session.run(cmd, null);
+                       resultRsp = PathParser.pathParsing(resultRsp);
                        if(!resultRsp.contains("0"))
                                newCoreException(SLPLaunchMessages.CANNOT_LAUNCH, new Exception("Cannot change to run-directory : " + ". (Return Code: " + resultRsp + ")"));
 
@@ -110,6 +112,7 @@ public class SLPOprofileLaunchDelegate extends SLPLaunchDelegate {
                        remoteExePath += exeFile.toFile().getName();
                        cmd = "ls " + remoteExePath + CMD_RESULT_CHECK;
                        resultRsp = session.run(cmd, null);
+                       resultRsp = PathParser.pathParsing(resultRsp);
                        if(!resultRsp.contains("0"))
                                newCoreException(SLPLaunchMessages.CANNOT_LAUNCH, new Exception("Executable does not exist on a valid path. You must install your application before running it."));
                        
@@ -232,7 +235,8 @@ public class SLPOprofileLaunchDelegate extends SLPLaunchDelegate {
                // find oprofile
                String oprofileCmd = "/usr/bin/opcontrol";
                String cmd = "ls " + oprofileCmd + CMD_RESULT_CHECK ;
-               String resultRsp = session.run(cmd, null);
+               String resultRsp = session.run(cmd, null);              
+               resultRsp = PathParser.pathParsing(resultRsp);
                if(!resultRsp.contains("0"))
                {
                        if(DeviceManager.getSelectedDevice().getMachineType().equals(IMachine.VIRTUAL_DEVICE))
@@ -275,6 +279,7 @@ public class SLPOprofileLaunchDelegate extends SLPLaunchDelegate {
                        if (!session.isPathExist(destDirectoryPath)) {
                                String command = MAKE_DIRECTORY_CMD + destDirectoryPath + CMD_RESULT_CHECK;
                                String result = session.run(command, null);
+                               result = PathParser.pathParsing(result);
                                if(!result.contains("0"))
                                        throw new Exception(Messages.getString("ProfileLaunch.FAIL_TO_TRANSFER"),
                                                        new Exception("Destination path (" + destDirectoryPath + ") in not exist."));
@@ -314,6 +319,7 @@ public class SLPOprofileLaunchDelegate extends SLPLaunchDelegate {
                        String packageDirectory = TEMPORARY_PKG_PATH;
                        String command = CHANGE_DIRECTORY_CMD + packageDirectory + CMD_RESULT_CHECK;
                        String result = session.run(command, null);
+                       result = PathParser.pathParsing(result);
                        if(!result.contains("0"))
                                throw new Exception(Messages.getString("ProfileLaunch.FAIL_TO_INSTALL"), new Exception("command is " + command));
                        monitor.worked(1);
@@ -321,12 +327,14 @@ public class SLPOprofileLaunchDelegate extends SLPLaunchDelegate {
                        // remount file system
                        command = "mount -o remount,rw /" + CMD_RESULT_CHECK;
                        result = session.run(command, null);
+                       result  = PathParser.pathParsing(result);
                        if(!result.contains("0"))
                                throw new Exception(Messages.getString("ProfileLaunch.FAIL_TO_INSTALL"),        new Exception("command is " + command)); 
 
                        // install new application
                        command = PKG_TOOL_CMD + PKG_TOOL_INSTALL_OPTION + PACKAGE_FILENAME_ARM + CMD_RESULT_CHECK;
                        result = session.run(command, null);
+                       result = PathParser.pathParsing(result);
                        if(!result.contains("0"))
                                throw new Exception(Messages.getString("ProfileLaunch.FAIL_TO_INSTALL"), new Exception("command is " + command));
                        monitor.worked(1);
@@ -334,6 +342,7 @@ public class SLPOprofileLaunchDelegate extends SLPLaunchDelegate {
                        // remount file system
                        command = "mount -o remount,ro /" + CMD_RESULT_CHECK;
                        result = session.run(command, null);
+                       result = PathParser.pathParsing(result);
                } catch (Exception e) {
                        throw e;
                } finally {
diff --git a/org.eclipse.linuxtools.valgrind.launch.exe/src/org/eclipse/linuxtools/valgrind/launch/PathParser.java b/org.eclipse.linuxtools.valgrind.launch.exe/src/org/eclipse/linuxtools/valgrind/launch/PathParser.java
new file mode 100644 (file)
index 0000000..a090388
--- /dev/null
@@ -0,0 +1,13 @@
+package org.eclipse.linuxtools.valgrind.launch;
+
+public class PathParser {
+       static public String pathParsing(String str){
+               if(str.startsWith("/opt/home/root # ")){
+                       str = str.substring(17,str.length());
+                       if(str.startsWith("\r\n")){
+                               str = str.substring(2, str.length());                           
+                       }                       
+               }
+               return str;             
+       }
+}
index ab1845f..6522d2e 100644 (file)
@@ -43,6 +43,7 @@ import org.eclipse.swt.widgets.Display;
 import org.eclipse.ui.PartInitException;
 import org.eclipse.ui.PlatformUI;
 
+import org.eclipse.linuxtools.valgrind.launch.PathParser;
 import org.eclipse.linuxtools.profiling.launch.Messages;
 import org.eclipse.linuxtools.valgrind.ui.ValgrindUIPlugin;
 import org.eclipse.linuxtools.valgrind.core.ValgrindCommand;
@@ -110,6 +111,7 @@ public class SLPValgrindLaunchDelegate extends SLPLaunchDelegate {
                        String valgrindCmd = "/usr/bin/valgrind";
                        String cmd = "ls " + valgrindCmd + CMD_RESULT_CHECK ;
                        String resultRsp = session.run(cmd, null);
+                       resultRsp = PathParser.pathParsing(resultRsp);
                        if(!resultRsp.contains("0"))
                        {
                                if(DeviceManager.getSelectedDevice().getMachineType().equals(IMachine.VIRTUAL_DEVICE))
@@ -126,6 +128,7 @@ public class SLPValgrindLaunchDelegate extends SLPLaunchDelegate {
                        String remoteExePath = getRemoteExePath(config); 
                        cmd = "cd " + remoteExePath + CMD_RESULT_CHECK;
                        resultRsp = session.run(cmd, null);
+                       resultRsp = PathParser.pathParsing(resultRsp);
                        if(!resultRsp.contains("0"))
                                newCoreException(SLPLaunchMessages.CANNOT_LAUNCH, new Exception("Cannot change to run-directory : " + ". (Return Code: " + resultRsp + ", exepath: " + remoteExePath + ")"));
 
@@ -133,6 +136,7 @@ public class SLPValgrindLaunchDelegate extends SLPLaunchDelegate {
                        remoteExePath += exeFile.toFile().getName();
                        cmd = "ls " + remoteExePath + CMD_RESULT_CHECK;
                        resultRsp = session.run(cmd, null);
+                       resultRsp = PathParser.pathParsing(resultRsp);
                        if(!resultRsp.contains("0"))
                                newCoreException(SLPLaunchMessages.CANNOT_LAUNCH, new Exception("Executable does not exist on a valid path. You must install your application before running it."));
                        
@@ -304,6 +308,7 @@ public class SLPValgrindLaunchDelegate extends SLPLaunchDelegate {
                        if (!session.isPathExist(destDirectoryPath)) {
                                String command = MAKE_DIRECTORY_CMD + destDirectoryPath + CMD_RESULT_CHECK;
                                String result = session.run(command, null);
+                               result = PathParser.pathParsing(result);
                                if(!result.contains("0"))
                                        newCoreException(Messages.getString("ProfileLaunch.FAIL_TO_TRANSFER"), 
                                                        new Exception("Destination path (" + destDirectoryPath + ") in not exist."));
@@ -345,6 +350,7 @@ public class SLPValgrindLaunchDelegate extends SLPLaunchDelegate {
                        String packageDirectory = TEMPORARY_PKG_PATH;
                        String command = CHANGE_DIRECTORY_CMD + packageDirectory + CMD_RESULT_CHECK;
                        String result = session.run(command, null);
+                       result = PathParser.pathParsing(result);
                        if(!result.contains("0"))
                                newCoreException(Messages.getString("ProfileLaunch.FAIL_TO_INSTALL"), 
                                                new Exception("command is " + command));
@@ -353,6 +359,7 @@ public class SLPValgrindLaunchDelegate extends SLPLaunchDelegate {
                        // remount file system
                        command = "mount -o remount,rw /" + CMD_RESULT_CHECK;
                        result = session.run(command, null);
+                       result = PathParser.pathParsing(result);
                        if(!result.contains("0"))
                                newCoreException(Messages.getString("ProfileLaunch.FAIL_TO_INSTALL"), 
                                                new Exception("command is " + command)); 
@@ -360,6 +367,7 @@ public class SLPValgrindLaunchDelegate extends SLPLaunchDelegate {
                        // install new application
                        command = PKG_TOOL_CMD + PKG_TOOL_INSTALL_OPTION + PACKAGE_FILENAME_ARM + CMD_RESULT_CHECK;
                        result = session.run(command, null);
+                       result = PathParser.pathParsing(result);
                        if(!result.contains("0"))
                                newCoreException(Messages.getString("ProfileLaunch.FAIL_TO_INSTALL"), 
                                                new Exception("command is " + command)); 
@@ -368,6 +376,7 @@ public class SLPValgrindLaunchDelegate extends SLPLaunchDelegate {
                        // remount file system
                        command = "mount -o remount,ro /" + CMD_RESULT_CHECK;
                        result = session.run(command, null);
+                       result = PathParser.pathParsing(result);
                } catch (CoreException e) {
                        throw e;
                } catch (Exception e) {