[Title] bug fixed
authorjooyoul_lee <jy.exe.lee@samsung.com>
Tue, 5 Nov 2013 06:13:04 +0000 (15:13 +0900)
committerjooyoul_lee <jy.exe.lee@samsung.com>
Tue, 5 Nov 2013 06:13:04 +0000 (15:13 +0900)
[Desc.] Open trace fixed
[Issue]

org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/handlers/OpenTraceHandler.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/sql/DBTableManager.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/sql/SqlManager.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/channel/data/DataChannelConstants.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/model/DATime.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/model/data/ProfileData.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/model/format/ProfilingLogFormat.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/opentrace/OpenTraceInputReader.java

index d49e6cf..e5b0474 100644 (file)
@@ -114,9 +114,8 @@ public class OpenTraceHandler extends AbstractHandler {
                }\r
 \r
                int percent = OpenTraceProgressManager.getInstance().getPercent();\r
-               if (loadInfos()\r
-               // && loadCallStackData() && loadCallStackApis()\r
-               // && loadProfilingData() && loadProfilingChildData()\r
+               if (loadInfos() && loadCallStackData() && loadCallStackApis()\r
+                               && loadProfilingData() && loadProfilingChildData()\r
                                && loadLeakData() && loadFailedData() && loadImageSet()) {\r
 \r
                        OpenTraceProgressManager.getInstance().setProgressPercent(\r
@@ -263,16 +262,17 @@ public class OpenTraceHandler extends AbstractHandler {
                                for (int i = 0; i < dbInfo.size(); i++) {\r
                                        List<String> info = dbInfo.get(i);\r
                                        ProcessInfo process = new ProcessInfo();\r
-                                       process.loadSaveFormat(info.get(i));\r
+                                       process.loadSaveFormat(info.get(1));\r
                                        pInfos.add(process);\r
                                        if (i == 0) {\r
                                                pip.setPid(process.getPid());\r
                                                pip.setPpid(process.getPpid());\r
-                                               pip.setTargetBinaryPath(process.getMainTargetBinaryPath());\r
+                                               pip.setTargetBinaryPath(process\r
+                                                               .getMainTargetBinaryPath());\r
                                        }\r
                                        String subOption = "where pid = " + process.getPid()\r
-                                                       + " and time = "\r
-                                                       + process.getStartTime().getSaveFormat();\r
+                                                       + " and time = \'"\r
+                                                       + process.getStartTime().getSaveFormat() + "\'";\r
                                        List<List<String>> objInfo = SqlManager.getInstance()\r
                                                        .loadLibObj(subOption);\r
                                        if (null == objInfo) {\r
index 336ee96..f86f8b2 100644 (file)
@@ -279,9 +279,9 @@ public class DBTableManager {
 
                // process info
                {
-                       String[] names = { PROCESS_INFO };
-                       String[] options = { EMPTY };
-                       String[] types = { TEXT };
+                       String[] names = {COMMON_COLUMN_PID,  PROCESS_INFO };
+                       String[] options = { EMPTY, EMPTY };
+                       String[] types = { TEXT, TEXT };
                        DBTableInfo processInfoTableInfo = new DBTableInfo(
                                        TABLE_NAME_PROCESS_INFO, names, options, types);
                        tableInfos.set(TABLE_INDEX_PROCESS_INFO, processInfoTableInfo);
index 0be83e7..27d5f2a 100755 (executable)
@@ -433,10 +433,11 @@ public class SqlManager {
 
                        for (int i = 0; i < processInfoList.size(); i++) {
                                ProcessInfo pInfo = processInfoList.get(i);
-                               List<String> insetRowData = new ArrayList<String>();
-                               insetRowData.add(pInfo.getSaveFormat());
+                               List<String> insertRowData = new ArrayList<String>();
+                               insertRowData.add(Integer.toString(pInfo.getPid()));
+                               insertRowData.add(pInfo.getSaveFormat());
                                List<List<String>> insetData = new ArrayList<List<String>>();
-                               insetData.add(insetRowData);
+                               insetData.add(insertRowData);
 
                                insertQuery(insertQuery, insetData);
                                insertLibObj(pInfo);
index 67eb70d..5febf7e 100644 (file)
@@ -52,4 +52,9 @@ public class DataChannelConstants {
        public final static int MSG_PROBE_SYNC = 0x0110;
        public final static int MSG_PROBE_NETWORK = 0x0111;
        public final static int MSG_PROBE_GLES20 = 0x0112;
+       
+       public final static int DB_TYPE_PROFILE = 0x0001;
+       public final static int DB_TYPE_CONTEXTSWITCH = 0x0002;
+       public final static int DB_TYPE_PROBE = 0x0004;
+       public final static int DB_TYPE_SYSTEM = 0x0008;
 }
index f4295dd..8536312 100644 (file)
@@ -52,12 +52,12 @@ public class DATime {
        }
 
        public String getSaveFormat() {
-               return Integer.toString(sec) + CommonConstants.COMMA
+               return Integer.toString(sec) + CommonConstants.DASH
                                + Integer.toString(nano);
        }
 
        public void loadSaveFormat(String saveData) {
-               String[] splitData = saveData.split(CommonConstants.COMMA);
+               String[] splitData = saveData.split(CommonConstants.DASH);
                sec = Integer.parseInt(splitData[0]);
                nano = Integer.parseInt(splitData[1]);
        }
index 78bc681..43594bb 100644 (file)
@@ -254,9 +254,10 @@ public class ProfileData extends LogData {
                prep.setInt(index++, pid);
                prep.setInt(index++, tid);
                prep.setInt(index++, cpuNum);
-               prep.setLong(index++, ret);
                prep.setString(index++, args);
+               prep.setLong(index++, ret);
                prep.setString(index++, apiName);
+               prep.setString(index++, libName);
                prep.setString(index++, callstack);
        }
 
@@ -271,8 +272,8 @@ public class ProfileData extends LogData {
                pid = rs.getInt(index++);
                tid = rs.getInt(index++);
                cpuNum = rs.getInt(index++);
-               ret = rs.getLong(index++);
                args = rs.getString(index++);
+               ret = rs.getLong(index++);
                apiName = rs.getString(index++);
                libName = rs.getString(index++);
                callstack = rs.getString(index++);
index f11fb6c..72ff20d 100644 (file)
@@ -47,7 +47,7 @@ public class ProfilingLogFormat extends LogFormat {
                dbColumnNames = HeaderColumns.getDBColumnNames();
                dbColumnNames.addAll(Arrays.asList(dcn));
 
-               Integer[] dct = { L, L, I, I, I, I, I, T, L, T, T, T };
+               Integer[] dct = { L, L, I, I, I, I, I, T, T, T, T, T };
                dbColumnTypes = HeaderColumns.getDBColumntypes();
                dbColumnTypes.addAll(Arrays.asList(dct));
 
@@ -56,7 +56,7 @@ public class ProfilingLogFormat extends LogFormat {
                tableColumnNames = HeaderColumns.getTableColumnNames();
                tableColumnNames.addAll(Arrays.asList(tcn));
 
-               Integer[] types = { L, L, I, I, I, I, I, S, L, S, S, S };
+               Integer[] types = { L, L, I, I, I, I, I, S, S, S, S, S };
                logColumnTypes = HeaderColumns.getLogColumnTypes();
                logColumnTypes.addAll(Arrays.asList(types));
        }
index 42e2863..f202dc5 100644 (file)
@@ -79,13 +79,16 @@ public class OpenTraceInputReader implements Runnable {
                AnalyzerManager.setLogParsingComplete(false);
                Project p = AnalyzerManager.getProject();
                long last = p.getLogCount();
-               createPackage(last, DataChannelConstants.MSG_PROBE_FILE);
-
                last = p.getDeviceLogCount();
-               createPackage(last, DataChannelConstants.MSG_DATA_SYSTEM);
+               createPackage(last, DataChannelConstants.DB_TYPE_SYSTEM);
 
                last = p.getProfileLogCount();
-               createPackage(last, DataChannelConstants.MSG_DATA_SAMPLE);
+               createPackage(last, DataChannelConstants.DB_TYPE_PROFILE);
+
+               createPackage(last, DataChannelConstants.DB_TYPE_PROBE);
+               // TODO : context switch data
+               // last = p.getProfileLogCount();
+               // createPackage(last, DataChannelConstants.MSG_DATA_SAMPLE);
 
                System.out.println("input reader complete"); //$NON-NLS-1$
                AnalyzerManager.setLogParsingComplete(true);
@@ -94,36 +97,67 @@ public class OpenTraceInputReader implements Runnable {
 
        private void createPackage(long last, int type) {
                List<LogData> input = null;
-               LogPackage logPackage = new LogPackage();
                long from = 0;
                long to = AnalyzerConstants.DATABASE_READ_SIZE;
                while (!Thread.interrupted()) {
                        if (to >= last) {
                                to = last;
                        }
-                       if (type == DataChannelConstants.MSG_DATA_SAMPLE
-                                       || type == DataChannelConstants.MSG_DATA_SYSTEM) {
-                               input = SqlManager.getInstance().selectArea(type, from, to);
-                               Logs logs = new Logs(type);
-                               logs.setLogs(input);
-                               logPackage.setLogs(type, logs);
-                       } else {
+
+                       LogPackage logPackage = new LogPackage();
+                       switch (type) {
+                       case DataChannelConstants.DB_TYPE_PROFILE:
+                               input = SqlManager.getInstance().selectArea(
+                                               DataChannelConstants.MSG_FUNCTION_ENTRY, from, to);
+                               if (null != input && !input.isEmpty()) {
+                                       for (int i = 0; i < input.size(); i++) {
+                                               int id = input.get(i).getId();
+                                               logPackage.setLogs(id, input.get(i));
+                                       }
+                               }
+                               break;
+                       case DataChannelConstants.DB_TYPE_PROBE:
                                List<Integer> ids = LogDataFactory.getLogList();
                                int size = ids.size();
                                for (int i = 0; i < size; i++) {
                                        int id = ids.get(i);
-                                       if (id == DataChannelConstants.MSG_DATA_SAMPLE
-                                                       || id == DataChannelConstants.MSG_DATA_SYSTEM) {
+                                       if (id == DataChannelConstants.MSG_CONTEXT_SWITCH_ENTRY
+                                                       || id == DataChannelConstants.MSG_CONTEXT_SWITCH_EXIT
+                                                       || id == DataChannelConstants.MSG_FUNCTION_ENTRY
+                                                       || id == DataChannelConstants.MSG_FUNCTION_EXIT
+                                                       || id == DataChannelConstants.MSG_DATA_SAMPLE
+                                                       || id == DataChannelConstants.MSG_DATA_SYSTEM
+                                                       || id == DataChannelConstants.MSG_DATA_RECORD) {
                                                continue;
                                        }
                                        Logs logs = new Logs(id);
                                        input = SqlManager.getInstance().selectArea(id, from, to);
-                                       logs.setLogs(input);
-                                       logPackage.setLogs(id, logs);
+                                       if (null != input && !input.isEmpty()) {
+                                               logs.setLogs(input);
+                                               logPackage.setLogs(id, logs);
+                                       }
                                } // for
+                               break;
+                       case DataChannelConstants.DB_TYPE_SYSTEM:
+                               input = SqlManager.getInstance().selectArea(
+                                               DataChannelConstants.MSG_DATA_SYSTEM, from, to);
+                               Logs logs = new Logs(DataChannelConstants.MSG_DATA_SYSTEM);
+                               if (null != input && !input.isEmpty()) {
+                                       logs.setLogs(input);
+                                       logPackage.setLogs(DataChannelConstants.MSG_DATA_SYSTEM,
+                                                       logs);
+                               }
+                               break;
+                       case DataChannelConstants.DB_TYPE_CONTEXTSWITCH:
+                               // TODO:
+                               break;
+                       default:
+                               break;
                        }
 
-                       updateLog(logPackage);
+                       if (!logPackage.isEmpty()) {
+                               updateLog(logPackage);
+                       }
                        if (to == last) {
                                break;
                        }