[Title] range data bug fix
authorjooyoul_lee <jy.exe.lee@samsung.com>
Sun, 24 Nov 2013 10:30:53 +0000 (19:30 +0900)
committerjooyoul_lee <jy.exe.lee@samsung.com>
Sun, 24 Nov 2013 10:30:53 +0000 (19:30 +0900)
[Desc.]
[Issue]

org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/info/callstack/CallstackTable.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/range/RangeDataManager.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/utils/AnalyzerUtil.java

index 155b292..fb0c372 100644 (file)
@@ -40,6 +40,7 @@ import org.tizen.dynamicanalyzer.common.DASelectionData;
 import org.tizen.dynamicanalyzer.model.TableInput;
 import org.tizen.dynamicanalyzer.swap.model.data.LogData;
 import org.tizen.dynamicanalyzer.ui.file.FileChartView;
+import org.tizen.dynamicanalyzer.ui.range.RangeProfilingView;
 import org.tizen.dynamicanalyzer.ui.summary.profiling.FunctionUsageProfilingView;
 import org.tizen.dynamicanalyzer.ui.userinterface.profiling.UIFunctionProfilingView;
 import org.tizen.dynamicanalyzer.ui.widgets.DATabComposite;
@@ -88,6 +89,7 @@ public class CallstackTable extends DATableComposite {
                if (null == viewId || viewId.isEmpty()
                                || viewId.equals(FileChartView.ID)
                                || viewId.equals(UIFunctionProfilingView.ID)
+                               || viewId.equals(RangeProfilingView.ID)
                                || viewId.equals(FunctionUsageProfilingView.ID)) {
                        return;
                }
index 0defde1..30cb777 100644 (file)
@@ -33,22 +33,27 @@ import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Display;
 import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
 import org.tizen.dynamicanalyzer.common.AnalyzerManager;
-import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
+import org.tizen.dynamicanalyzer.communicator.DACommunicator;
 import org.tizen.dynamicanalyzer.sql.SqlManager;
+import org.tizen.dynamicanalyzer.swap.callstack.BaseCallstackManager;
+import org.tizen.dynamicanalyzer.swap.callstack.SWAPCallStackManager;
 import org.tizen.dynamicanalyzer.swap.channel.data.DataChannelConstants;
+import org.tizen.dynamicanalyzer.swap.channel.data.ProcessInfo;
+import org.tizen.dynamicanalyzer.swap.channel.data.ProcessInfoPackage;
 import org.tizen.dynamicanalyzer.swap.logparser.LogPackage;
 import org.tizen.dynamicanalyzer.swap.logparser.Logs;
 import org.tizen.dynamicanalyzer.swap.model.data.LogData;
 import org.tizen.dynamicanalyzer.swap.model.data.LogDataFactory;
 import org.tizen.dynamicanalyzer.swap.model.data.ProfileData;
-import org.tizen.dynamicanalyzer.swap.model.data.UserFunctionData;
 import org.tizen.dynamicanalyzer.ui.file.FileDataMaker;
 import org.tizen.dynamicanalyzer.ui.info.callstack.CallStackManager;
 import org.tizen.dynamicanalyzer.ui.page.DAPageComposite;
 import org.tizen.dynamicanalyzer.ui.summary.failed.FailedChecker;
+import org.tizen.dynamicanalyzer.ui.summary.failed.FailedData;
 import org.tizen.dynamicanalyzer.ui.summary.leaks.LeakDetector;
 import org.tizen.dynamicanalyzer.ui.summary.profiling.ProfileDataMaker;
 import org.tizen.dynamicanalyzer.ui.summary.warning.WarningChecker;
+import org.tizen.dynamicanalyzer.ui.summary.warning.WarningData;
 import org.tizen.dynamicanalyzer.ui.timeline.TimelinePage;
 import org.tizen.dynamicanalyzer.ui.widgets.DATabButton;
 import org.tizen.dynamicanalyzer.ui.widgets.DATabComposite;
@@ -64,7 +69,8 @@ public class RangeDataManager implements Runnable {
        private WarningChecker warningChecker = null;
        private FileDataMaker fileDataMaker = null;
        private ProfileDataMaker profileDataMaker = null;
-       private CallStackManager callstackManager = null;
+       private BaseCallstackManager callstackManager = null;
+       private BaseCallstackManager swapCallstackManager = null;
 
        private long markerStartTime = 0;
        private long markerEndTime = 0;
@@ -78,6 +84,7 @@ public class RangeDataManager implements Runnable {
                leakDetector = new LeakDetector();
                warningChecker = new WarningChecker();
                callstackManager = new CallStackManager();
+               swapCallstackManager = new SWAPCallStackManager();
                profileDataMaker = new ProfileDataMaker(callstackManager);
 
                fileDataMaker = new FileDataMaker(failedChecker, leakDetector,
@@ -358,6 +365,26 @@ public class RangeDataManager implements Runnable {
                        }
                }
 
+               // make failed data
+
+               List<FailedData> failedList = AnalyzerManager.getFailedChecker()
+                               .getFailedList();
+               for (FailedData failedData : failedList) {
+                       long time = failedData.getTime();
+                       if (time <= markerEndTime && time >= markerStartTime) {
+                               failedChecker.getFailedList().add(failedData);
+                       }
+               }
+
+               List<WarningData> warningList = AnalyzerManager.getWarningChecker()
+                               .getWarningData();
+               for (WarningData warningData : warningList) {
+                       long time = warningData.getLogData().getTime();
+                       if (time <= markerEndTime && time >= markerStartTime) {
+                               warningChecker.getWarningData().add(warningData);
+                       }
+               }
+
                AnalyzerUtil.changePage(RangePage.ID);
                final DAPageComposite page = AnalyzerManager.getCurrentPage();
                Display.getDefault().syncExec(new Runnable() {
@@ -371,41 +398,52 @@ public class RangeDataManager implements Runnable {
        private void makeRangeData(LogPackage logPack) {
                Logs logs = logPack.getLogs(DataChannelConstants.LOG_USER_FUNCTION);
                if (null != logs) {
-                       List<LogData> userFunctions = logs.getLogs();
-                       int size = userFunctions.size();
-                       for (int i = 0; i < size; i++) {
-                               UserFunctionData input = (UserFunctionData) userFunctions
-                                               .get(i);
-                               if (input.getId() != DataChannelConstants.MSG_DATA_SAMPLE) {
-                                       long start = input.getLowPc();
-                                       long end = input.getHighPc();
-                                       if (start > 0 && end > 0
-                                                       && !AnalyzerManager.isBinStartEndSet()) {
-                                               AnalyzerManager.setBinaryStartEndAddr(start, end);
+                       if (DACommunicator.isSWAPVersion()) {
+                               List<LogData> profileData = logs.getLogs();
+                               int size = profileData.size();
+                               for (int i = 0; i < size; i++) {
+                                       ProfileData input = (ProfileData) profileData.get(i);
+                                       if (input.getId() != DataChannelConstants.MSG_DATA_SAMPLE) {
+                                               ProcessInfoPackage processInfoPkg = AnalyzerManager
+                                                               .getProject().getProcessInfo(input.getPid());
+                                               ProcessInfo processInfo = processInfoPkg
+                                                               .getProcessInfo(input.getTime());
+                                               long pcAddr = input.getPcAddr();
+                                               if (pcAddr >= processInfo.getLowestAddress()
+                                                               && pcAddr <= processInfo.getHighestAddress()) {
+                                                       /* user callstack create by entry and exit */
+                                                       swapCallstackManager.makeUserCallstack(input,
+                                                                       profileDataMaker);
+                                               } else {
+                                                       swapCallstackManager
+                                                                       .makeCallstackWithoutBacktrace(input);
+                                               }
+                                       } else {
+                                               profileDataMaker.makeFunctionUsageProfileData(input);
                                        }
-                                       callstackManager.makeUserCallstack(input, profileDataMaker);
-                               }
-                       }
-               }
 
-               logs = logPack.getLogs(DataChannelConstants.LOG_USER_FUNCTION);
-               if (null != logs) {
-                       List<LogData> profilingInputs = logs.getLogs();
-                       /* profiling data make */
-                       int size = profilingInputs.size();
-                       for (int i = 0; i < size; i++) {
-                               ProfileData input = (ProfileData) profilingInputs.get(i);
-                               if (input.getId() == DataChannelConstants.MSG_DATA_SAMPLE) {
-                                       profileDataMaker.makeFunctionUsageProfileData(input);
                                }
                        }
                }
 
+               // logs = logPack.getLogs(DataChannelConstants.LOG_USER_FUNCTION);
+               // if (null != logs) {
+               // List<LogData> profilingInputs = logs.getLogs();
+               // /* profiling data make */
+               // int size = profilingInputs.size();
+               // for (int i = 0; i < size; i++) {
+               // ProfileData input = (ProfileData) profilingInputs.get(i);
+               // if (input.getId() == DataChannelConstants.MSG_DATA_SAMPLE) {
+               // profileDataMaker.makeFunctionUsageProfileData(input);
+               // }
+               // }
+               // }
+
                logs = logPack.getLogs(DataChannelConstants.MSG_PROBE_FILE);
                if (null != logs) {
                        List<LogData> resourceInputs = logs.getLogs();
                        /* make file failed data and warning data */
-//                     fileDataMaker.makeData(resourceInputs);
+                       // fileDataMaker.makeData(resourceInputs);
                        /* resource leak check */
                        int size = resourceInputs.size();
                        for (int i = 0; i < size; i++) {
@@ -422,7 +460,6 @@ public class RangeDataManager implements Runnable {
                                leakDetector.runLeakDectect(memoryInputs.get(i));
                        }
                }
-
                /* created failed and warning/leak data */
        }
 }
index 18978ba..421aa39 100755 (executable)
@@ -1146,13 +1146,13 @@ public class AnalyzerUtil {
 
        public static String getFuncName(ProfileData input) {
                long pcAddr = input.getPcAddr();
-               // HashMap<Long, String> funcNameMap = AnalyzerManager.getFuncNameMap();
-               // String functionName = funcNameMap.get(pcAddr);
-               // if (null != functionName) {
-               // return functionName;
-               // }
+                HashMap<Long, String> funcNameMap = AnalyzerManager.getFuncNameMap();
+                String functionName = funcNameMap.get(pcAddr);
+                if (null != functionName) {
+                return functionName;
+                }
 
-               String functionName = null;
+//             String functionName = null;
                ProcessInfoPackage processInfoPkg = AnalyzerManager.getProject()
                                .getProcessInfo(input.getPid());
                ProcessInfo processInfo = processInfoPkg
@@ -1205,8 +1205,8 @@ public class AnalyzerUtil {
 
                                /** for debug */
                                if (lowAddr > pcAddr || highAddr < pcAddr) {
-                                       System.out.print(input.getId() + " lib : " + binPath
-                                                       + " ==> ");
+//                                     System.out.print(input.getId() + " lib : " + binPath
+//                                                     + " ==> ");
                                        AnalyzerUtil.printHexdecimal(lowAddr);
                                        System.out.print(" < ");
                                        AnalyzerUtil.printHexdecimal(pcAddr);