[Title] File Page - Print Line Called File Api
authorphjwithyou.park <phjwithyou.park@samsung.com>
Thu, 2 Aug 2012 06:53:05 +0000 (15:53 +0900)
committerphjwithyou.park <phjwithyou.park@samsung.com>
Thu, 2 Aug 2012 06:53:05 +0000 (15:53 +0900)
[Type] feature
[Module] File Page
[Priority] normal
[CQ#]
[Redmine#] 6186
[Problem]
[Cause]
[Solution]
[TestCase]

org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ColorResources.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/theme/DAThemeBlack.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/theme/DAThemeWhite.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 e9d6f1e..3b55b37 100755 (executable)
@@ -29,6 +29,28 @@ public class ColorResources {
        public static final Color RED = getColor("red"); //$NON-NLS-1$\r
        public static final Color PURPLE = getColor("purple"); //$NON-NLS-1$\r
 \r
+\r
+       public static final Color GREEN = getColor("green"); //$NON-NLS-1$\r
+       public static final Color BBOWN = getColor("brown"); //$NON-NLS-1$\r
+       public static final Color NAVY = getColor("navy"); //$NON-NLS-1$\r
+       public static final Color DARKVIOLET = getColor("darkviolet"); //$NON-NLS-1$\r
+       public static final Color MAROON = getColor("maroon"); //$NON-NLS-1$\r
+       public static final Color TEAL = getColor("teal"); //$NON-NLS-1$\r
+       public static final Color INDIGO = getColor("indigo"); //$NON-NLS-1$\r
+       public static final Color DARKGOLDENROD = getColor("darkgoldenrod"); //$NON-NLS-1$\r
+       \r
+       public static final Color GOLDENROD = getColor("goldenrod"); //$NON-NLS-1$\r
+       public static final Color TURQUOISE = getColor("turquoise"); //$NON-NLS-1$\r
+       public static final Color VIOLET = getColor("violet"); //$NON-NLS-1$\r
+       public static final Color SLATEBLUE = getColor("slateblue"); //$NON-NLS-1$\r
+       public static final Color ORANGE = getColor("orange"); //$NON-NLS-1$\r
+       public static final Color YELLOWGREEN = getColor("yellowgreen"); //$NON-NLS-1$\r
+       public static final Color SKYBLUE = getColor("skyblue"); //$NON-NLS-1$\r
+       public static final Color ORCHID = getColor("orchid"); //$NON-NLS-1$\r
+       public static final Color SANDYBROWN = getColor("sandybrown"); //$NON-NLS-1$\r
+       public static final Color MEDIUMPURPLE = getColor("mediumpurple"); //$NON-NLS-1$\r
+\r
+       \r
        // shell window background color\r
        public static Color WINDOW_BG_COLOR = getColor("window_bg_color"); //$NON-NLS-1$\r
        \r
index 1cb21e7..c8423bf 100644 (file)
@@ -17,6 +17,30 @@ public class DAThemeBlack extends DATheme {
        DAThemeBlack() {
                super();
                name = "black";
+               
+               
+               // defaule
+               setColor("blue", new RGB(0, 102, 134));
+               setColor("green", new RGB(68, 98, 12));
+               setColor("purple", new RGB(139, 42, 118));
+               setColor("brown", new RGB(138, 83, 0));
+               setColor("navy", new RGB(57, 66, 161));
+               setColor("darkviolet", new RGB(105, 2, 126));
+               setColor("maroon", new RGB(126, 41, 2));
+               setColor("teal", new RGB(27, 110, 92));
+               setColor("indigo", new RGB(80, 26, 146));
+               setColor("goldenrod", new RGB(212, 150, 57));
+               setColor("turquoise", new RGB(72, 194, 168));
+               setColor("violet", new RGB(226, 109, 201));
+               setColor("slateblue", new RGB(122, 132, 238));
+               setColor("orange", new RGB(236, 107, 47));
+               setColor("yellowgreen", new RGB(129, 172, 50));
+               setColor("skyblue", new RGB(72, 185, 221));
+               setColor("orchid", new RGB(175, 49, 200));
+               setColor("sandybrown", new RGB(201, 168, 58));
+               setColor("mediumpurple", new RGB(160, 108, 224));
+                               
+                               
                // shell window background color
                setColor("window_bg_color", new RGB(51, 52, 53)); //$NON-NLS-1$
                setColor("dialg_bg_upper", new RGB(51, 52, 53));
index b09f121..0e689fb 100644 (file)
@@ -17,6 +17,28 @@ public class DAThemeWhite extends DATheme {
        DAThemeWhite() {
                super();
                name = "white";
+               
+               // defaule
+               setColor("blue", new RGB(0, 102, 134));
+               setColor("green", new RGB(68, 98, 12));
+               setColor("purple", new RGB(139, 42, 118));
+               setColor("brown", new RGB(138, 83, 0));
+               setColor("navy", new RGB(57, 66, 161));
+               setColor("darkviolet", new RGB(105, 2, 126));
+               setColor("maroon", new RGB(126, 41, 2));
+               setColor("teal", new RGB(27, 110, 92));
+               setColor("indigo", new RGB(80, 26, 146));
+               setColor("goldenrod", new RGB(212, 150, 57));
+               setColor("turquoise", new RGB(72, 194, 168));
+               setColor("violet", new RGB(226, 109, 201));
+               setColor("slateblue", new RGB(122, 132, 238));
+               setColor("orange", new RGB(236, 107, 47));
+               setColor("yellowgreen", new RGB(129, 172, 50));
+               setColor("skyblue", new RGB(72, 185, 221));
+               setColor("orchid", new RGB(175, 49, 200));
+               setColor("sandybrown", new RGB(201, 168, 58));
+                               setColor("mediumpurple", new RGB(160, 108, 224));
+                               
                // shell window background color
                setColor("window_bg_color", new RGB(160, 160, 160)); //$NON-NLS-1$
                setColor("dialg_bg_upper", new RGB(206, 206, 206));
index 5e5d186..d102536 100644 (file)
@@ -183,25 +183,34 @@ public class DAFileChartCellRenderer extends DefaultCellRenderer {
     }
 
     private void drawRects(GC gc, FileChartItemData data, Rectangle rect) {
+       
+       
         List<FileChartData> fcData = data.getData();
         int size = fcData.size();
+        
+        
+        
         int x = rect.x + FileChartManager.FILE_CHART_START_MARGIN;
         int y = (rect.y + 7);
         long startTime = start;
         Color pStartColor = null;
         Color pEndColor = null;
-        for (int i = 0; i < size; i++) {
+        
+        
+        
+        for (int i = 0; i < size; i++) 
+        {
             long openTime = fcData.get(i).getOpenTime();
             long closeTime = fcData.get(i).getCloseTime();
             long firstTime = fcData.get(i).getFirstTime();
             long lastTime = fcData.get(i).getLastTime();
-            
-            
+        
             
             int px = x;
             int py = y;
             int pWidth = 0;
             int height = rect.height - 14;
+            
             if (openTime > startTime) {
                 px += AnalyzerUtil.getWidth(openTime - startTime);
             }
@@ -268,14 +277,12 @@ public class DAFileChartCellRenderer extends DefaultCellRenderer {
             Rectangle parentRect = new Rectangle(px, py, pWidth, height);
             gc.setForeground(pStartColor);
             gc.setBackground(pEndColor);
-            gc.fillGradientRectangle(parentRect.x, parentRect.y, parentRect.width,
-                                     parentRect.height, true);
+            gc.fillGradientRectangle(parentRect.x, parentRect.y, parentRect.width, parentRect.height, true);
 
             Rectangle childRect = new Rectangle(cx, cy, cWidth, height);
             gc.setForeground(ColorResources.FILE_USED_START);
             gc.setBackground(ColorResources.FILE_USED_END);
-            gc.fillGradientRectangle(childRect.x, childRect.y, childRect.width, childRect.height,
-                                     true);
+            gc.fillGradientRectangle(childRect.x, childRect.y, childRect.width, childRect.height, true);
 
             if (closeTime > 0) {
                 startTime = closeTime;
@@ -283,6 +290,9 @@ public class DAFileChartCellRenderer extends DefaultCellRenderer {
             }
         } // draw fileData
 
+        
+        
+        
         List<FailedData> fileFailedList = data.getFailedData();
         size = fileFailedList.size();
         startTime = start;
@@ -303,16 +313,18 @@ public class DAFileChartCellRenderer extends DefaultCellRenderer {
                 Rectangle failedRect = new Rectangle(fx, fy, fWidth, height);
                 gc.setForeground(ColorResources.FILE_FAILED_START);
                 gc.setBackground(ColorResources.FILE_FAILED_END);
-                gc.fillGradientRectangle(failedRect.x, failedRect.y, failedRect.width,
-                                         failedRect.height, true);
+                gc.fillGradientRectangle(failedRect.x, failedRect.y, 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;
@@ -320,22 +332,47 @@ public class DAFileChartCellRenderer extends DefaultCellRenderer {
             int height = rect.height - 14;
 
             FailedData ffd = fileCalledFunctionList.get(i);
+            
             long time = Long.parseLong(ffd.getLogData(LogCenterConstants.TIME_INDEX));
-
-            if (startTime < time && time < end) {
+            
+            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);
+                Rectangle failedRect = new Rectangle(fx-1, fy, fWidth+1, height);
+                String strApiName = ffd.getData().get(LogCenterConstants.APINAME_INDEX);
+                Color[] pAPiColor = getFileAPiColorBright( strApiName );
+                gc.setForeground( pAPiColor[0] );
+                gc.setBackground( pAPiColor[1] );
+                
+                
+                gc.fillGradientRectangle(failedRect.x, failedRect.y, failedRect.width,failedRect.height, true);
             }
         }
 
     }
+    
+    
+    
+    public static Color[] getFileAPiColorBright( String strApiName ) 
+    {
+       Color[] pApiColor = new Color[2];
+       if ( strApiName.endsWith("write") ){
+               pApiColor[0] = ColorResources.TURQUOISE;
+               pApiColor[1] = ColorResources.TURQUOISE;
+       }
+       else if ( strApiName.endsWith("read") ){
+               pApiColor[0] = ColorResources.YELLOWGREEN;
+               pApiColor[1] = ColorResources.YELLOWGREEN;
+       }
+       else{
+               pApiColor[0] = ColorResources.SLATEBLUE;
+               pApiColor[1] = ColorResources.SLATEBLUE;
+       }
+
+       return pApiColor;
+       }
+
+    
 
     private int getToggleIndent(GridItem item) {
         return item.getLevel() * 20;
index 55bd0df..5d044a5 100644 (file)
@@ -274,14 +274,12 @@ public class FileChartManager {
                                child.setColsed(true);
                                getFDRegister().remove(fd);
                                long useTime = child.getTotalFileUseTime();
-                               child.setTotalFileUseTime(closeTime
-                                               - child.getLastData().getOpenTime() + useTime);
+                               child.setTotalFileUseTime(closeTime - child.getLastData().getOpenTime() + useTime);
 
                                String parentKey = child.getParentKey();
                                FileChartItemData fileData = getFileRegister().get(parentKey);
                                long pUseTime = fileData.getTotalFileUseTime();
-                               fileData.setTotalFileUseTime(pUseTime + closeTime
-                                               - child.getLastData().getOpenTime());
+                               fileData.setTotalFileUseTime(pUseTime + closeTime - child.getLastData().getOpenTime());
 
                                // warning check
                                warningCheck(fileData, input, TYPE_CLOSE);
@@ -303,219 +301,119 @@ public class FileChartManager {
                                
                                System.out.print("Read Write "+input+"\n");
                                
-                               
-                               // 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 12\n");
-                                       ffd = null;
+                               if ( PrintCalledFunctionChart( input  ) == false ){
                                        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);
-                               
-                               
+                       
+                               // calculate read/write size
                                FileChartItemData child = getFDRegister().get(fd);
-                               if (null == child) {
-                                       continue;
-                               }
-                               
-                               FileChartItemData parent = null;
-                               try
-                               {
-
-                                       child.getLastData().getRelations().add(seqNum);
-                                       
-                                       long time = Long.parseLong(input.get(LogCenterConstants.TIME_INDEX));
-                                       if (child.getLastData().getFirstTime() < 0)
-                                       {
-                                               System.out.print("setFirstTime 1 \n");
-                                               child.getLastData().setFirstTime(time);
-                                               child.getLastData().setLastTime(time);
-                                       } 
-                                       else 
-                                       {
-                                               System.out.print("setLastTime 1 \n");
-                                               child.getLastData().setLastTime(time);
-                                       }
-
-                                       
-                                       parent = getFileRegister().get(child.getParentKey());
-                                       if ( parent.getLastData().getFirstTime() < 0)
-                                       {       
-                                               System.out.print("setFirstTime 2 \n");
-                                               
-                                               parent.getLastData().setFirstTime(time);
-                                               parent.getLastData().setLastTime(time);
-                                       } 
-                                       else 
-                                       {
-                                               System.out.print("setLastTime 2 \n");
-                                               
-                                               parent.getLastData().setLastTime(time);
-                                       }
+                               FileChartItemData parent = getFileRegister().get(child.getParentKey());
                                
-
-                                       
-                                       
-                                       // calculate read/write size
-                                       String rwSizeStr1 = input.get(LogCenterConstants.RESOURCE_SIZE_INDEX);
-                                       long rwSize = Long.parseLong(rwSizeStr1);
-                                       if (fdApiType.equals(LogCenterConstants.FD_API_TYPE_READ)) 
-                                       {
-                                               long rSize = child.getReadSize();
-                                               child.setReadSize(rSize + rwSize);
-                                               long prSize = parent.getReadSize();
-                                               parent.setReadSize(child.getReadSize() + prSize);
-                                       } 
-                                       else if (fdApiType.equals(LogCenterConstants.FD_API_TYPE_WRITE)) 
-                                       {
-                                               String strTotalSize = input.get(LogCenterConstants.RESOURCE_FILE_SIZE_INDEX);
-                                               if ( strTotalSize.equals("?") == false )
-                                               {
-                                                       long totalSize = Long.parseLong(strTotalSize);
-                                                       child.setTotalSize(totalSize);  
-                                               }
-                                               
-                                               long wSize = child.getWriteSize();
-                                               child.setWriteSize( wSize + rwSize );
-                                               long pwSize = parent.getWriteSize();
-                                               parent.setWriteSize( child.getWriteSize() + pwSize);
+                               String rwSizeStr1 = input.get(LogCenterConstants.RESOURCE_SIZE_INDEX);
+                               long rwSize = Long.parseLong(rwSizeStr1);
+                               if (fdApiType.equals(LogCenterConstants.FD_API_TYPE_READ)) {
+                                       long rSize = child.getReadSize();
+                                       child.setReadSize(rSize + rwSize);
+                                       long prSize = parent.getReadSize();
+                                       parent.setReadSize(child.getReadSize() + prSize);
+                               } else if (fdApiType.equals(LogCenterConstants.FD_API_TYPE_WRITE)) {
+                                       String strTotalSize = input.get(LogCenterConstants.RESOURCE_FILE_SIZE_INDEX);
+                                       if (strTotalSize.equals("?") == false) {
+                                               long totalSize = Long.parseLong(strTotalSize);
+                                               child.setTotalSize(totalSize);
                                        }
 
-                               } 
-                               catch (NullPointerException e)
-                               {
-                                       System.out.println("why"); //$NON-NLS-1$
-                                       e.printStackTrace();
+                                       long wSize = child.getWriteSize();
+                                       child.setWriteSize(wSize + rwSize);
+                                       long pwSize = parent.getWriteSize();
+                                       parent.setWriteSize(child.getWriteSize() + pwSize);
                                }
                        } 
-                       
-                       
                        else  /// Other
                        {
-                               
                                System.out.print(" Other "+input+"\n");
-
-                               // Print Called Function On File Chart Except( Open, close, Error )     
-                               FailedData ffd = new FailedData(input);
-                               FileChartItemData fcid = getFDRegister().get(fd);
-                               if (null == fcid) {
-                                       ffd = null;
+                               if ( PrintCalledFunctionChart( input  ) == false ){
                                        continue;
                                }
-                               path = fcid.getParentKey();
-                               if (path.isEmpty()) {
-                                       System.out.println();
-                               }
-                               fcid.getCalledFunctionData().add(ffd);
-                               
-                               FileChartItemData parentCalled = getFileRegister().get(path);
-                               if (null == parentCalled) {
-                                       parentCalled = createNewFileData(path);
-                               }
-                               parentCalled.getCalledFunctionData().add(ffd);
-                               AnalyzerManager.getCalledFunctionChecker().getFailedList().add(ffd);
-                       
-                               
-                               
-                               // Insert File API List Table
-                       //      fcid.getLastData().getRelations().add(seqNum);
-                               
-                               
-                               FileChartItemData child = getFDRegister().get(fd);
-                               if (null == child) {
-                                       continue;
-                               }
-                               
-                               FileChartItemData parent = null;
-                               try
-                               {
-
-                                       child.getLastData().getRelations().add(seqNum);
-                                       
-                                       long time = Long.parseLong(input.get(LogCenterConstants.TIME_INDEX));
-                                       if (child.getLastData().getFirstTime() < 0)
-                                       {
-                                               System.out.print("setFirstTime 1 \n");
-                                               child.getLastData().setFirstTime(time);
-                                               child.getLastData().setLastTime(time);
-                                       } 
-                                       else 
-                                       {
-                                               System.out.print("setLastTime 1 \n");
-                                               child.getLastData().setLastTime(time);
-                                       }
-
-                                       
-                                       parent = getFileRegister().get(child.getParentKey());
-                                       if ( parent.getLastData().getFirstTime() < 0)
-                                       {       
-                                               System.out.print("setFirstTime 2 \n");
-                                               
-                                               parent.getLastData().setFirstTime(time);
-                                               parent.getLastData().setLastTime(time);
-                                       } 
-                                       else 
-                                       {
-                                               System.out.print("setLastTime 2 \n");
-                                               
-                                               parent.getLastData().setLastTime(time);
-                                       }
-                               
+                       }
+               }
+       }
 
-                                       
-                                       
-                                       // calculate read/write size
-                                       String rwSizeStr1 = input.get(LogCenterConstants.RESOURCE_SIZE_INDEX);
-                                       long rwSize = Long.parseLong(rwSizeStr1);
-                                       if (fdApiType.equals(LogCenterConstants.FD_API_TYPE_READ)) 
-                                       {
-                                               long rSize = child.getReadSize();
-                                               child.setReadSize(rSize + rwSize);
-                                               long prSize = parent.getReadSize();
-                                               parent.setReadSize(child.getReadSize() + prSize);
-                                       } 
-                                       else if (fdApiType.equals(LogCenterConstants.FD_API_TYPE_WRITE)) 
-                                       {
-                                               String strTotalSize = input.get(LogCenterConstants.RESOURCE_FILE_SIZE_INDEX);
-                                               if ( strTotalSize.equals("?") == false )
-                                               {
-                                                       long totalSize = Long.parseLong(strTotalSize);
-                                                       child.setTotalSize(totalSize);  
-                                               }
-                                               
-                                               long wSize = child.getWriteSize();
-                                               child.setWriteSize( wSize + rwSize );
-                                               long pwSize = parent.getWriteSize();
-                                               parent.setWriteSize( child.getWriteSize() + pwSize);
-                                       }
+       
+       private boolean PrintCalledFunctionChart( List<String> input )
+       {
+               
+               String seqNum = input.get(LogCenterConstants.SEQUENCE_NUMBER_INDEX);
+               String path = input.get(LogCenterConstants.RESOURCE_FILE_PATH_INDEX);
+               String fd = input.get(LogCenterConstants.RESOURCE_FDVALUE_INDEX);
+               
+               // Print Called Function - File Chart Except( Open, close, Error )      
+               FailedData ffd = new FailedData(input);
+               
+               
+               FileChartItemData fcid = getFDRegister().get(fd);
+               if (null == fcid) {
+                       ffd = null;
+                       return false;
+               }
+               path = fcid.getParentKey();
+               if (path.isEmpty()) {
+                       System.out.println();
+               }
+               fcid.getCalledFunctionData().add(ffd);
+               
+               FileChartItemData parentCalled = getFileRegister().get(path);
+               if (null == parentCalled) {
+                       parentCalled = createNewFileData(path);
+               }
+               parentCalled.getCalledFunctionData().add(ffd);
+               AnalyzerManager.getCalledFunctionChecker().getFailedList().add(ffd);
+       
+               
+               
+               
+               // Insert File API List - Table
+               FileChartItemData child = getFDRegister().get(fd);
+               if (null == child) {
+                       return false;
+               }
+               child.getLastData().getRelations().add(seqNum);
+               
+               
+               // Print API Range
+               FileChartItemData parent = getFileRegister().get(child.getParentKey());
+               try
+               {       
+                       long time = Long.parseLong(input.get(LogCenterConstants.TIME_INDEX));
+                       if (child.getLastData().getFirstTime() < 0)
+                       {
+                               child.getLastData().setFirstTime(time);
+                               child.getLastData().setLastTime(time);
+                       } 
+                       else 
+                       {
+                               child.getLastData().setLastTime(time);
+                       }
 
-                               } 
-                               catch (NullPointerException e)
-                               {
-                                       System.out.println("why"); //$NON-NLS-1$
-                                       e.printStackTrace();
-                               }
-                               
-                               
+                       if ( parent.getLastData().getFirstTime() < 0)
+                       {       
+                               parent.getLastData().setFirstTime(time);
+                               parent.getLastData().setLastTime(time);
+                       } 
+                       else 
+                       {
+                               parent.getLastData().setLastTime(time);
                        }
+
+               } 
+               catch (NullPointerException e)
+               {
+                       System.out.println("PrintCalledFunctionChart Exception"); //$NON-NLS-1$
+                       e.printStackTrace();
                }
+               
+               return true;
        }
-
        
        
        private void warningCheck(FileChartItemData file, List<String> input, int type) {