[Title] fix bug - cpu rate of function usage profiling shows correct value
authorwoojin <woojin2.jung@samsung.com>
Tue, 19 Nov 2013 09:39:50 +0000 (18:39 +0900)
committerwoojin <woojin2.jung@samsung.com>
Tue, 19 Nov 2013 09:39:50 +0000 (18:39 +0900)
[Desc.] 1. fix Infinity/NaN value of cpu rate column 2. calculate cpu rate when loading saved data
[Issue]

org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/handlers/OpenTraceHandler.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/summary/profiling/ProfileDataMaker.java

index 5cf5444..bbc01ae 100644 (file)
@@ -403,7 +403,7 @@ public class OpenTraceHandler extends AbstractHandler {
                        System.out.println("failed - loadProfilingData");\r
                        isSuccess = false;\r
                } else {\r
-\r
+                       int sampleCount = 0;\r
                        ProfileDataMaker profiler = FunctionUsageProfiler.getInstance()\r
                                        .getProfileDataMaker();\r
                        for (int i = 0; i < dbInfo.size(); i++) {\r
@@ -417,6 +417,7 @@ public class OpenTraceHandler extends AbstractHandler {
                                profiler.getSymbolSeqHash().put(symbol, seq);\r
                                UIDataManager.getInstance().getfunctionProfilingDataChecker()\r
                                                .addProfilingData(fupData);\r
+                               sampleCount += fupData.getExCount();\r
                        }\r
 \r
                        ProfilingData ab = profiler\r
@@ -426,6 +427,8 @@ public class OpenTraceHandler extends AbstractHandler {
                                        .getProfilingDataByKey(FunctionUsageProfiler.DEPENDENT_LIB_KEY);\r
                        profiler.setDependentLib(dl);\r
 \r
+                       // restore total sample count                   \r
+                       profiler.setTotalSampleCount(sampleCount);\r
                }\r
                return isSuccess;\r
        }\r
index 7fbbbe6..2ab56cb 100644 (file)
@@ -205,14 +205,16 @@ public class ProfileDataMaker {
                        count = data.getExCount();
                        if(totalSampleCount == 0) {
                                rate = 0;
-                       }                       
-                       rate = count / (double) totalSampleCount * 100;
+                       } else {                        
+                               rate = count / (double) totalSampleCount * 100;
+                       }
                } else {
                        count = data.getInCount();
                        if(totalSampleCount == 0) {
                                rate = 0;
-                       }                       
-                       rate = count / (double) totalSampleCount * 100;
+                       } else {                
+                               rate = count / (double) totalSampleCount * 100;
+                       }
                }
 
                return Formatter.toDoubleFormat2(Double.toString(rate));