[SRADA-177] Fixed Detail table issue
authordongkyu6 lee <dongkyu6.lee@samsung.com>
Tue, 22 Mar 2016 08:48:49 +0000 (17:48 +0900)
committerdongkyu6 lee <dongkyu6.lee@samsung.com>
Tue, 22 Mar 2016 09:41:24 +0000 (18:41 +0900)
 - If DB has no data, function in MemoryDetailsTable return null.

Change-Id: I9c4aa4ca0d92bc28995898374695a8bc57d58fdc
Signed-off-by: dongkyu6 lee <dongkyu6.lee@samsung.com>
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/memory/table/MemoryAllocationTraceTable.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/memory/table/MemoryDetailsTable.java

index 3058e81..39d6cdc 100755 (executable)
@@ -131,32 +131,46 @@ public class MemoryAllocationTraceTable extends DATableComposite {
        protected List<TableInput> makeTableInput() {\r
                List<TableInput> output = new ArrayList<TableInput>();          \r
                List<List<Object>> allocDataList = null;\r
+               List<Integer> pidlist = new ArrayList<Integer>();\r
                \r
                if(Global.getProject() == null) {\r
                        return output;\r
                }\r
                \r
+               int[] pids = Global.getProject().getProcessIDs();\r
                int targetPID = Toolbar.INSTANCE.getSelectedPid();\r
                \r
-               allocDataList = MemoryDataManager.getInstance().makeLeakDataForRange(0, 0, targetPID);\r
-\r
-               if (allocDataList == null)\r
-                       return output;\r
+               if(targetPID > 0) {\r
+                       pidlist.add(targetPID);\r
+               }\r
+               else {\r
+                       for (int i = 0; i < pids.length; i++) {\r
+                               pidlist.add(pids[i]);\r
+                       }       \r
+               }\r
                \r
-               int size = allocDataList.size();\r
-               for (int i = 0; i < size; i++) {\r
-                       List<Object> iAllocData = allocDataList.get(i);\r
+               int index = 0;\r
+               for(int i = 0 ; i < pidlist.size() ; i++) {\r
+                       allocDataList = MemoryDataManager.getInstance().makeLeakDataForRange(0, 0, pidlist.get(i));\r
+\r
+                       if (allocDataList == null || allocDataList.size() == 0)\r
+                               continue;\r
                        \r
-                       if (targetPID != 0) {\r
-                               if (targetPID != ((Integer) iAllocData.get(AllocateDBTable.COLUMN.PID.index)).intValue()) {\r
-                                       continue;\r
+                       int size = allocDataList.size();\r
+                       for (int j = 0; j < size; j++) {\r
+                               List<Object> iAllocData = allocDataList.get(j);\r
+                               \r
+                               if (pidlist.get(i) != 0) {\r
+                                       if (pidlist.get(i) != ((Integer) iAllocData.get(AllocateDBTable.COLUMN.PID.index)).intValue()) {\r
+                                               continue;\r
+                                       }\r
                                }\r
-                       }\r
 \r
-                       TableInput alloInput = makeTreeInputForLeakData(iAllocData, i);\r
-                       \r
-                       if (alloInput != null){\r
-                               output.add(alloInput);\r
+                               TableInput alloInput = makeTreeInputForLeakData(iAllocData, index++);\r
+                               \r
+                               if (alloInput != null){\r
+                                       output.add(alloInput);\r
+                               }\r
                        }\r
                }\r
                \r
index 57a23a2..3f995f5 100755 (executable)
@@ -151,6 +151,13 @@ public class MemoryDetailsTable extends DATreeComposite {
                if(Global.getProject() == null) {\r
                        return output;\r
                }\r
+               \r
+               TreeInput systemMemdata = makeSystemMemory();\r
+               if(systemMemdata == null)\r
+                       return output;\r
+               \r
+               output.add(systemMemdata);\r
+               \r
                List<Integer> pidlist = new ArrayList<Integer>();\r
                keyindex = 0;\r
                \r
@@ -166,9 +173,6 @@ public class MemoryDetailsTable extends DATreeComposite {
                        }       \r
                }\r
                \r
-               TreeInput systemMemdata = makeSystemMemory();\r
-               output.add(systemMemdata);\r
-               \r
                for(int i = 0 ; i < pidlist.size() ; i++) {\r
                        try {\r
                                TreeInput processMemdata = makeprocessMemory(pidlist.get(i));                   \r
@@ -199,6 +203,9 @@ public class MemoryDetailsTable extends DATreeComposite {
        private TreeInput makeSystemMemory() {          \r
                List<Long> memorylist = MemoryDataManager.getInstance().getSystemMemoryMinMaxFromDB(0, 0);\r
                \r
+               if(memorylist.size() == 0)\r
+                       return null;\r
+               \r
                List<Long> sorteddata = SortMemoryData(memorylist);\r
                \r
                DATableDataFormat tableData = new DATableDataFormat(keyindex++);\r