[Title] change profiling start time as start time in MSG_START_ACK 58/20058/1
authorgreatim <jaewon81.lim@samsung.com>
Fri, 25 Apr 2014 10:29:52 +0000 (19:29 +0900)
committergreatim <jaewon81.lim@samsung.com>
Fri, 25 Apr 2014 10:29:52 +0000 (19:29 +0900)
[Desc.]
[Issue]

Change-Id: Iafcd58c29d3fe970c2ebeac6ed2b0014ace26600

org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/common/AnalyzerPlugin.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/communicator/Communicator30.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/logparser/MessageParser.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/kernel/data/KernelDataMaker.java

index 7cf6d91..a9853ac 100644 (file)
@@ -60,6 +60,7 @@ public class AnalyzerPlugin extends AbstractUIPlugin {
                workbench.addWorkbenchListener(new IWorkbenchListener() {\r
                        @Override\r
                        public void postShutdown(IWorkbench workbench) {\r
+                               // close db connection\r
                                SqlConnectionManager.closeConnection();\r
                                SqlManager.getInstance().closeConnection();\r
                                \r
index 4b19de8..df45e5e 100755 (executable)
@@ -100,7 +100,7 @@ import org.tizen.sdblib.service.SyncResult;
 
 public class Communicator30 extends BaseCommunicator {
        private static final DALogger DA_LOG = DALogger.getInstance();
-       
+
        static final boolean PRINT_CONTROL_LOG_TOFILE = true;
        private PrintWriter printWriter = null;
 
@@ -187,9 +187,9 @@ public class Communicator30 extends BaseCommunicator {
                                length, rear);
 
                DA_LOG.debug("print start message");
-//             ByteUtils.printByteArrayForStart(ret);
-               
-               if(PRINT_CONTROL_LOG_TOFILE) {
+               // ByteUtils.printByteArrayForStart(ret);
+
+               if (PRINT_CONTROL_LOG_TOFILE) {
                        File logPath = new File(
                                        PathManager.DA_DEBUG_CONTROL_CHANNEL_LOG_FILE);
                        if (logPath.exists()) {
@@ -197,12 +197,13 @@ public class Communicator30 extends BaseCommunicator {
                        }
 
                        try {
-                               printWriter = new PrintWriter(new BufferedWriter(new FileWriter(logPath)), true);
+                               printWriter = new PrintWriter(new BufferedWriter(
+                                               new FileWriter(logPath)), true);
                        } catch (IOException e) {
                                e.printStackTrace();
                        }
                }
-               
+
                // data receive thread create and start
                Thread dataThread = new Thread(null, new DataChannelThread(),
                                AnalyzerConstants.COMMUNICATOR_RECEIVE_THREAD);
@@ -213,10 +214,10 @@ public class Communicator30 extends BaseCommunicator {
 
                // FIX
                if (!StartProcessManager.getInstance().isCancelled()) {
-                       //StartProcessManager.getInstance().setCancelDisable();
+                       // StartProcessManager.getInstance().setCancelDisable();
                        StartProcessManager.getInstance().setValue(100);
                }
-               
+
                if (result.isSuccess()) {
                        if (!isCorrectAck(MSG_START_ACK, result)) {
                                HostResult failResult = HostResult.ERR_MSG_START_FAIL;
@@ -225,6 +226,17 @@ public class Communicator30 extends BaseCommunicator {
                                DACommunicator.setRunning(false);
                                dataThread = null;
                                return failResult;
+                       } else { // right ack for start
+                               byte[] data = result.getRet();
+                               int index = 0;
+                               index += INT_SIZE; // message id
+                               index += INT_SIZE; // payload length
+                               index += INT_SIZE; // return id
+                               int sec = ByteUtils.toInt(data, index);
+                               index += INT_SIZE;
+                               int nano = ByteUtils.toInt(data, index);
+
+                               AnalyzerManager.getProject().setProfileStartTime(new DATime(sec, nano));
                        }
                } else {
                        DACommunicator.setRunning(false);
@@ -245,13 +257,14 @@ public class Communicator30 extends BaseCommunicator {
                index += INT_SIZE;
                profilingStartTime.setSec(sec);
                profilingStartTime.setNano(nano);
-               
+
                UIRecorderTool.getInstance().startRecorder();
                DA_LOG.performance("TEST", "Start Trace", "Start recoding thread");
                ToolbarArea.getInstance().startTimer();
                DA_LOG.performance("TEST", "Start Trace", "Start Timer");
                SWAPLogParser.startLogParser();
-               DA_LOG.performance("TEST", "Start Trace", "Start SWAP log parser thread");
+               DA_LOG.performance("TEST", "Start Trace",
+                               "Start SWAP log parser thread");
                // start registered data manager thread
                DataManagerRegistry.startThreads();
                DA_LOG.performance("TEST", "Start Trace", "Start DataManager threads");
@@ -282,7 +295,7 @@ public class Communicator30 extends BaseCommunicator {
                        String appType = app.getInfo(AppInfo.APPTYPE_INDEX);
                        if (appType.contains(AppInfo.APPTYPE_CPP)) {
                                appInst.setApplicationType(ApplicationInfo.APPTYPE_TIZEN);
-                       } else if(appType.contains(AppInfo.APPTYPE_WEB)) {
+                       } else if (appType.contains(AppInfo.APPTYPE_WEB)) {
                                appInst.setApplicationType(ApplicationInfo.APPTYPE_WEB);
                        } else {
                                appInst.setApplicationType(ApplicationInfo.APPTYPE_COMMON_EXEC);
@@ -312,12 +325,12 @@ public class Communicator30 extends BaseCommunicator {
                                functionInstList.add(functionInst);
 
                                // for debug
-//                             System.out.print("DEBUG : addr ");
-//                             AnalyzerUtil.printHexdecimal(addrSymbol.getAddr());
-//                             System.out.print("   symbol " + addrSymbol.getSymbol()
-//                                             + "   args ");
-//                             ByteUtils.printByteArray(functionInst.getArgs());
-//                             System.out.println();
+                               // System.out.print("DEBUG : addr ");
+                               // AnalyzerUtil.printHexdecimal(addrSymbol.getAddr());
+                               // System.out.print("   symbol " + addrSymbol.getSymbol()
+                               // + "   args ");
+                               // ByteUtils.printByteArray(functionInst.getArgs());
+                               // System.out.println();
                        }
                        appInst.setFunctionCount(size - exSize);
                        // appInst.setFunctionCount(0);
@@ -471,7 +484,8 @@ public class Communicator30 extends BaseCommunicator {
        private HostResult pullTheFile(String from, String to) {
 
                try {
-                       DACommunicator.getSelectedDevice().getIDevice().becomeSuperUser(true);
+                       DACommunicator.getSelectedDevice().getIDevice()
+                                       .becomeSuperUser(true);
                } catch (TimeoutException e) {
                        e.printStackTrace();
                } catch (SdbCommandRejectedException e) {
@@ -507,7 +521,7 @@ public class Communicator30 extends BaseCommunicator {
                int length = rtByte.length;
                byte[] msg = ByteUtils.getByte(config, length, rtByte);
 
-//             ByteUtils.printByteArrayForStart(msg);
+               // ByteUtils.printByteArrayForStart(msg);
 
                HostResult result = handleControlMessage(devInfo, msg);
 
@@ -580,9 +594,9 @@ public class Communicator30 extends BaseCommunicator {
 
                try {
                        if (null != controlSock && !controlSock.isClosed()) {
-                               if(PRINT_CONTROL_LOG_TOFILE && printWriter != null) {
+                               if (PRINT_CONTROL_LOG_TOFILE && printWriter != null) {
                                        printWriter.printf("send :");
-                                       for(int k = 0; k < message.length; k++)
+                                       for (int k = 0; k < message.length; k++)
                                                printWriter.printf("%02x ", message[k]);
                                        printWriter.printf("\n");
                                }
@@ -590,8 +604,7 @@ public class Communicator30 extends BaseCommunicator {
                        }
 
                        int msgId = ByteUtils.toInt(message);
-                       DA_LOG.debug("wait for ack... [send message : " + msgId
-                                       + " ]");
+                       DA_LOG.debug("wait for ack... [send message : " + msgId + " ]");
 
                        int readsize = -1;
                        // read buffer size is sufficient??
@@ -600,9 +613,9 @@ public class Communicator30 extends BaseCommunicator {
                        DA_LOG.debug("blocked");
                        readsize = controlSock.getInputStream().read(cbuf);
                        blocked = false;
-                       if(PRINT_CONTROL_LOG_TOFILE && printWriter != null) {
+                       if (PRINT_CONTROL_LOG_TOFILE && printWriter != null) {
                                printWriter.printf("recv :");
-                               for(int k = 0; k < readsize; k++)
+                               for (int k = 0; k < readsize; k++)
                                        printWriter.printf("%02x ", cbuf[k]);
                                printWriter.printf("\n");
                        }
@@ -980,12 +993,12 @@ public class Communicator30 extends BaseCommunicator {
                                functionInstList.add(functionInst);
 
                                // for debug
-//                             System.out.print("LIB : addr ");
-//                             AnalyzerUtil.printHexdecimal(addrSymbol.getAddr());
-//                             System.out.print("   symbol " + addrSymbol.getSymbol()
-//                                             + "   args ");
-//                             ByteUtils.printByteArray(functionInst.getArgs());
-//                             System.out.println();
+                               // System.out.print("LIB : addr ");
+                               // AnalyzerUtil.printHexdecimal(addrSymbol.getAddr());
+                               // System.out.print("   symbol " + addrSymbol.getSymbol()
+                               // + "   args ");
+                               // ByteUtils.printByteArray(functionInst.getArgs());
+                               // System.out.println();
                        }
                        size = size - exSize;
                        libInst = ByteUtils.getByte(libInst, binaryPath, size);
@@ -999,7 +1012,7 @@ public class Communicator30 extends BaseCommunicator {
                int length = libInst.length;
                msg = ByteUtils.getByte(msg, length, libInst);
 
-//             ByteUtils.printByteArrayForStart(msg);
+               // ByteUtils.printByteArrayForStart(msg);
                HostResult result = handleControlMessage(
                                DACommunicator.getSelectedDevice(), msg);
 
index 1ff71d0..e84d2ec 100755 (executable)
@@ -76,7 +76,7 @@ import org.tizen.dynamicanalyzer.widgets.da.base.DADialog;
 public class MessageParser {
        private static final DALogger DA_LOG = DALogger.getInstance();
        
-       static final boolean PRINT_DATA_LOG_TOFILE = false;
+       static final boolean PRINT_DATA_LOG_TOFILE = true;
 
        static final int MSG_ID_INDEX = 0;
        static final int MSG_LENGTH_INDEX = 1;
@@ -226,23 +226,8 @@ public class MessageParser {
 //                                     + AnalyzerUtil.toHexdecimal(lowestAddr) + " high : "
 //                                     + AnalyzerUtil.toHexdecimal(highestAddr));
                }
-
-               DATime startTime = AnalyzerManager.getProject().getProfileStartTime();
-               int startSec = AnalyzerManager.getProject().getProfileStartTime()
-                               .getSec();
-               int startNano = AnalyzerManager.getProject().getProfileStartTime()
-                               .getNano();
-
-               if (0 == startSec && 0 == startNano) {
-                       // original code (before webapp support)
-                       startTime.setSec(sec);
-                       startTime.setNano(nano);
-                       
-                       // for webapp support
-//                     startTime.setSec(ByteUtils.toInt(data, 8));
-//                     startTime.setNano(ByteUtils.toInt(data, 12));
-                       AnalyzerManager.getProject().setProfileStartTime(startTime);
-               }
+               
+               DATime startTime = new DATime(sec, nano);
 
                pInfo.setPid(pid);
                pInfo.setPpid(ppid);
index deee31a..f07b002 100755 (executable)
@@ -39,7 +39,7 @@ import org.tizen.dynamicanalyzer.util.DALogger;
 
 public class KernelDataMaker {
        private static final DALogger DA_LOG = DALogger.getInstance();
-       
+
        private static final String queryto_withTime = "where %s < %s and %s > %s order by %s";
        private static final String queryto_withTidAndTime = "where %s = %s and %s < %s and %s > %s order by %s";
        private static final String queryto_withTid = "where %s = %s group by %s";
@@ -190,7 +190,7 @@ public class KernelDataMaker {
                                KernelDataPerThread kdata = findKernelData(tid);
                                if (kdata == null) {
                                        // TODO : error
-                                       DA_LOG.error("function entry log is coming without any context entry log");
+                                       // DA_LOG.error("function entry log is coming without any context entry log");
                                } else {
                                        assert (kdata.getCorelog() != null);
                                        if (kdata.getFunclog() == null) {
@@ -238,7 +238,7 @@ public class KernelDataMaker {
                                KernelDataPerThread kdata = findKernelData(tid);
                                if (kdata == null) {
                                        // TODO : error
-                                       DA_LOG.error("function entry log is coming without any context entry log");
+                                       // DA_LOG.error("function entry log is coming without any context entry log");
                                } else {
                                        assert (kdata.getCorelog() != null);
                                        if (kdata.getFunclog() == null) {