[Title] Print Called Function On File Chart Except( Open, ᅟClose, Error )
authorphjwithyou.park <phjwithyou.park@samsung.com>
Tue, 17 Jul 2012 07:48:35 +0000 (16:48 +0900)
committerphjwithyou.park <phjwithyou.park@samsung.com>
Tue, 17 Jul 2012 07:48:35 +0000 (16:48 +0900)
[Type] Feature
[Module] File Page - File Chart
[Priority] Normal
[CQ#]
[Redmine#] 5790
[Problem]
[Cause]
[Solution]
[TestCase]

org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/AnalyzerManager.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/model/FileChartItemData.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/views/filePage/fileChart/DAFileChartCellRenderer.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/views/filePage/fileChart/FileChartManager.java

index 9a577e4..e9a1b0f 100644 (file)
@@ -74,6 +74,8 @@ public class AnalyzerManager {
        private static int imageListSize = 0;
        private static LeakDetector leakDetector = null;
        private static FailedChecker failedChecker = null;
+       private static FailedChecker calledChecker = null;
+       
        private static FunctionUsageProfiler functionUserProfiler = null;
        private static Thread stopLogProcessThread = null;
        private static Thread startStopThread = null;
@@ -175,6 +177,7 @@ public class AnalyzerManager {
 
                leakDetector = null;
                failedChecker = null;
+               calledChecker = null;
                functionUserProfiler = null;
                StopLogProcessThread.count = 0;
                stopLogProcessThread = null;
@@ -455,6 +458,14 @@ public class AnalyzerManager {
                }
                return failedChecker;
        }
+       
+       public static FailedChecker getCalledFunctionChecker() {
+               if (null == calledChecker) {
+                       calledChecker = new FailedChecker();
+               }
+               return calledChecker;
+       }
+       
 
        public static FunctionUsageProfiler getFunctionUserProfiler() {
                if (null == functionUserProfiler) {
index 572abdb..03b7fdd 100644 (file)
@@ -11,6 +11,7 @@ public class FileChartItemData {
        private List<FileChartItemData> children = null;
        private List<FileChartData> data = null;
        private List<FailedData> failedData = null;
+       private List<FailedData> calledFunctionData = null;
 
        private boolean closed = false;
        private String parentKey = null;
@@ -89,6 +90,13 @@ public class FileChartItemData {
                return null;
        }
 
+       public List<FailedData> getCalledFunctionData() {
+               if (null == calledFunctionData) {
+                       calledFunctionData = new ArrayList<FailedData>();
+               }
+               return calledFunctionData;
+       }
+       
        public List<FailedData> getFailedData() {
                if (null == failedData) {
                        failedData = new ArrayList<FailedData>();
@@ -179,6 +187,17 @@ public class FileChartItemData {
                return output;
        }
 
+       public List<String> getCalledFunctionRelations() {
+               List<String> output = new ArrayList<String>();
+               int size = getCalledFunctionData().size();
+               for (int i = 0; i < size; i++) {
+                       FailedData ffd = calledFunctionData.get(i);
+                       String seq = ffd.getLogData(LogCenterConstants.SEQUENCE_NUMBER_INDEX);
+                       output.add(seq);
+               }
+               return output;
+       }
+       
        public boolean isAllChildrenClosed() {
                if (!hasChild()) {
                        return false;
index f38d2ce..8233026 100644 (file)
@@ -299,6 +299,33 @@ public class DAFileChartCellRenderer extends DefaultCellRenderer {
                                                failedRect.width, failedRect.height, true);
                        }
                }
+               
+               List<FailedData> fileCalledFunctionList = data.getCalledFunctionData();
+               size = fileCalledFunctionList.size();
+               startTime = start;
+               x = rect.x + FileChartManager.FILE_CHART_START_MARGIN;
+               y = (rect.y + 7);
+               for (int i = 0; i < size; i++) {
+                       int fx = x;
+                       int fy = y;
+                       int fWidth = 1;
+                       int height = rect.height - 14;
+
+                       FailedData ffd = fileCalledFunctionList.get(i);
+                       long time = Long.parseLong(ffd.getLogData(LogCenterConstants.TIME_INDEX));
+
+                       if (startTime < time && time < end) {
+                               fx += AnalyzerUtil.getWidth(time - startTime);
+
+                               System.out.print("fx["+fx+"] fy ["+fy+"] cWidth["+fWidth+"] height ["+height+"]\n");
+                               
+                               Rectangle failedRect = new Rectangle(fx, fy, fWidth, height);
+                               gc.setForeground(ColorResources.ITEM_BLUE_BRIGHT);
+                               gc.setBackground(ColorResources.ITEM_BLUE_DARK);
+                               gc.fillGradientRectangle(failedRect.x, failedRect.y,failedRect.width, failedRect.height, true);
+                       }
+               }
+               
        }
 
        private int getToggleIndent(GridItem item) {
index 3e59421..802dbe1 100644 (file)
@@ -305,6 +305,32 @@ public class FileChartManager {
                                // read / write
                        } else if (fdApiType.equals(LogCenterConstants.FD_API_TYPE_READ)
                                        || fdApiType.equals(LogCenterConstants.FD_API_TYPE_WRITE)) {
+                               
+                               
+                               // Print Called Function On File Chart Except( Open, ᅟClose, Error )  
+                               FailedData ffd = new FailedData(input);
+                               FileChartItemData fcid = getFDRegister().get(fd);
+                               if (null == fcid) {
+                                       System.out.print("ERROR - parentFailed 1\n");
+                                       ffd = null;
+                                       continue;
+                               }
+                               path = fcid.getParentKey();
+                               if (path.isEmpty()) {
+                                       System.out.print("ERROR - parentFailed 2\n");
+                                       System.out.println();
+                               }
+                               fcid.getCalledFunctionData().add(ffd);
+                               
+                               FileChartItemData parentCalled = getFileRegister().get(path);
+                               if (null == parentCalled) {
+                                       System.out.print("ERROR - parentFailed 3\n");
+                                       parentCalled = createNewFileData(path);
+                               }
+                               parentCalled.getCalledFunctionData().add(ffd);
+                               AnalyzerManager.getCalledFunctionChecker().getFailedList().add(ffd);
+                               
+                               
                                long time = Long.parseLong(input
                                                .get(LogCenterConstants.TIME_INDEX));
                                FileChartItemData child = getFDRegister().get(fd);
@@ -350,9 +376,30 @@ public class FileChartManager {
                                        System.out.println("why"); //$NON-NLS-1$
                                        e.printStackTrace();
                                }
-                       } else if (fdApiType.equals(LogCenterConstants.FD_API_TYPE_OTHERS)) {
-                               // FIXME :
-                               // System.out.println("file util api later added....");
+                       } else{
+                               // Print Called Function On File Chart Except( Open, ᅟClose, Error )  
+                               FailedData ffd = new FailedData(input);
+                               FileChartItemData fcid = getFDRegister().get(fd);
+                               if (null == fcid) {
+                                       System.out.print("ERROR - parentFailed 1\n");
+                                       ffd = null;
+                                       continue;
+                               }
+                               path = fcid.getParentKey();
+                               if (path.isEmpty()) {
+                                       System.out.print("ERROR - parentFailed 2\n");
+                                       System.out.println();
+                               }
+                               fcid.getCalledFunctionData().add(ffd);
+                               
+                               FileChartItemData parentCalled = getFileRegister().get(path);
+                               if (null == parentCalled) {
+                                       System.out.print("ERROR - parentFailed 3\n");
+                                       parentCalled = createNewFileData(path);
+                               }
+                               parentCalled.getCalledFunctionData().add(ffd);
+                               AnalyzerManager.getCalledFunctionChecker().getFailedList().add(ffd);
+                       
                        }
 
                }