[SRADA-XXX] Apply protocol 4.2
authordongkyu6 lee <dongkyu6.lee@samsung.com>
Tue, 24 May 2016 08:00:34 +0000 (17:00 +0900)
committerdongkyu6 lee <dongkyu6.lee@samsung.com>
Thu, 26 May 2016 23:58:01 +0000 (08:58 +0900)
 - Change DataManager of Process Memory Chart in timeline
 - Move checking protocol 4.2
 - Add protocol number in Protocol ENUM

Change-Id: I673bcf758a5f751c98751afcffaf76d209d90194

org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/communicator/BaseCommunicator.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/communicator/DeviceManager.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/control/StartTraceManager.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/protocol/Protocol.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/protocol/p40/ProtocolConfig40.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/protocol/p41/ProtocolConfig41.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/setting/SettingDataManager.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/memory/MemoryPage.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/TimelinePage.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/common/TimelineChartManager.java

index 1ddd2f2..a1c6e13 100644 (file)
@@ -42,7 +42,6 @@ import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
 import org.tizen.dynamicanalyzer.common.AnalyzerShellCommands;
 import org.tizen.dynamicanalyzer.common.DAResult;
 import org.tizen.dynamicanalyzer.common.DAResult.ErrorCode;
-import org.tizen.dynamicanalyzer.common.Global;
 import org.tizen.dynamicanalyzer.constant.CommonConstants;
 import org.tizen.dynamicanalyzer.control.IProgress;
 import org.tizen.dynamicanalyzer.protocol.DebugLog;
@@ -438,10 +437,7 @@ public class BaseCommunicator {
                        subCommunicator = new Communicator40(this);
                        break;
                case VERSION_42:
-                       if(Global.getCurrentDeviceInfo() != null) {
-                               Global.getCurrentDeviceInfo().setMempAvailable(true);
-                       }
-               case VERSION_41:                        
+               case VERSION_41:
                        subCommunicator = new Communicator41(this);
                        break;
                default: // unknown version
index 895ce40..f8e00d2 100644 (file)
@@ -37,6 +37,7 @@ import org.tizen.dynamicanalyzer.common.DAResult.ErrorCode;
 import org.tizen.dynamicanalyzer.common.Global;
 import org.tizen.dynamicanalyzer.common.path.PathManager;
 import org.tizen.dynamicanalyzer.handlers.UIAction;
+import org.tizen.dynamicanalyzer.protocol.Protocol;
 import org.tizen.dynamicanalyzer.ui.toolbar.Toolbar;
 import org.tizen.dynamicanalyzer.util.Logger;
 import org.tizen.sdblib.IDevice;
@@ -122,10 +123,23 @@ public class DeviceManager {
 
                // set availability of root
                devInfo.setAvailabilityOfRoot(CommunicatorUtils.enableRoot(device));
-
                // connect with swap of device
                DAResult result = devInfo.getCommunicator().connect();
                if (result.isSuccess()) {
+                       String devProtocol = devInfo.getCommunicator().getProtocolVersion();
+                       if (devProtocol != null) {
+                               try {
+                                       double versionNum = Double.parseDouble(devProtocol);
+
+                                       if (versionNum >= Protocol.VERSION_42.getVersionNum()) {
+                                               Logger.debug("set Memps Available");
+                                               devInfo.setMempAvailable(true);
+                                       }
+                               } catch (Exception ex) {
+                                       Logger.debug("protocol version - " + devProtocol);
+                               }
+                       }
+                       
                        devices.add(devInfo);
                        bAdded = true;
                }
index c9df7ce..ed42b8e 100755 (executable)
@@ -322,7 +322,7 @@ public class StartTraceManager implements Runnable {
                                case SEND_STARTMSG:
                                        try {
                                                DACommunicator.stopTrace();
-                                       } catch (InterruptedException e) {
+                                       } catch (Exception e) {
                                                // never happened currently
                                                Logger.error("Interrupted during stop trace");
                                        }
index 724889d..31b2f41 100644 (file)
@@ -37,15 +37,16 @@ import org.tizen.dynamicanalyzer.protocol.p41.ProtocolConfig41;
 import org.tizen.dynamicanalyzer.setting.Feature;
 
 public enum Protocol {
-       VERSION_UNKNOWN(CommonConstants.EMPTY),
-       VERSION_30("3.0"),
-       VERSION_30A("3.0 a"),
-       VERSION_30_UIHV("3.0_UIHV"),
-       VERSION_40("4.0"),
-       VERSION_41("4.1"),
-       VERSION_42("4.2");
+       VERSION_UNKNOWN(CommonConstants.EMPTY, 0.0),
+       VERSION_30("3.0", 3.1),
+       VERSION_30A("3.0 a", 3.01),
+       VERSION_30_UIHV("3.0_UIHV", 3.02),
+       VERSION_40("4.0", 4.0),
+       VERSION_41("4.1", 4.1),
+       VERSION_42("4.2", 4.2);
 
        private String versionName;
+       private double versionNum;
 
        // data channel message name map for printing debug info
        private static final Map<Integer, String> dataMsgNameMap;
@@ -97,8 +98,9 @@ public enum Protocol {
                dataMsgNameMap = Collections.unmodifiableMap(tempMap);
        }
 
-       private Protocol(String versionName) {
+       private Protocol(String versionName, double version) {
                this.versionName = versionName;
+               this.versionNum = version;
        }
 
        @Override
@@ -106,6 +108,10 @@ public enum Protocol {
                return versionName;
        }
 
+       public double getVersionNum() {
+               return versionNum;
+       }
+
        public static Protocol getVersion(String versionString) {
                Protocol[] versions = Protocol.values();
                for (Protocol ver : versions) {
index 970ae98..f995529 100644 (file)
@@ -131,10 +131,10 @@ public enum ProtocolConfig40 implements IProtocolConfig {
                Map<FlatPreferences, ProtocolConfig40[]> tempMap = new EnumMap<FlatPreferences, ProtocolConfig40[]>(
                                FlatPreferences.class);
                tempMap.put(FlatPreferences.RECORDING, new ProtocolConfig40[] { RECORDING });
-               tempMap.put(FlatPreferences.FUNCTION_PROFILING, new ProtocolConfig40[] { FUNCTION_PROFILING });
-               tempMap.put(FlatPreferences.APP_STARTUP, new ProtocolConfig40[] { APP_STARTUP });
-               tempMap.put(FlatPreferences.WEB_FUNCTION_PROFILING, new ProtocolConfig40[] { WEB_FUNCTION_PROFILING });
-               tempMap.put(FlatPreferences.WEBAPP_STARTUP, new ProtocolConfig40[] { WEBAPP_STARTUP });
+               tempMap.put(FlatPreferences.FUNCTION_PROFILING, new ProtocolConfig40[] { FUNCTION_PROFILING
+                                                                                                                               WEB_FUNCTION_PROFILING});
+               tempMap.put(FlatPreferences.APP_STARTUP, new ProtocolConfig40[] { APP_STARTUP,
+                                                                                                                               WEBAPP_STARTUP});
                tempMap.put(FlatPreferences.SYSTEM_ALL_PROCESSES, new ProtocolConfig40[] { SYSTEM_PROCESSES_LOAD });
                tempMap.put(FlatPreferences.PROCESS_MEMORY, new ProtocolConfig40[] { SYSTEM_PROCESS });
 
index d5aad1b..9568133 100644 (file)
@@ -135,10 +135,10 @@ public enum ProtocolConfig41 implements IProtocolConfig {
                Map<FlatPreferences, ProtocolConfig41[]> tempMap = new EnumMap<FlatPreferences, ProtocolConfig41[]>(
                                FlatPreferences.class);
                tempMap.put(FlatPreferences.RECORDING, new ProtocolConfig41[] { RECORDING });
-               tempMap.put(FlatPreferences.FUNCTION_PROFILING, new ProtocolConfig41[] { FUNCTION_PROFILING });
-               tempMap.put(FlatPreferences.APP_STARTUP, new ProtocolConfig41[] { APP_STARTUP });
-               tempMap.put(FlatPreferences.WEB_FUNCTION_PROFILING, new ProtocolConfig41[] { WEB_FUNCTION_PROFILING });
-               tempMap.put(FlatPreferences.WEBAPP_STARTUP, new ProtocolConfig41[] { WEBAPP_STARTUP });
+               tempMap.put(FlatPreferences.FUNCTION_PROFILING, new ProtocolConfig41[] { FUNCTION_PROFILING
+                                                                                                                               WEB_FUNCTION_PROFILING});
+               tempMap.put(FlatPreferences.APP_STARTUP, new ProtocolConfig41[] { APP_STARTUP,
+                                                                                                                               WEBAPP_STARTUP});
                tempMap.put(FlatPreferences.SYSTEM_ALL_PROCESSES, new ProtocolConfig41[] { SYSTEM_PROCESSES_LOAD });
                tempMap.put(FlatPreferences.PROCESS_MEMORY, new ProtocolConfig41[] { SYSTEM_PROCESS });
 
@@ -229,11 +229,12 @@ public enum ProtocolConfig41 implements IProtocolConfig {
        public static byte[] getFlatFeatureFlagValue(Set<FlatFeature> flatFeatures, Set<FlatPreferences> selectedPreferences) {
                long lowValue = 0;
                long highValue = 0;
+
                if (flatFeatures != null) {
-                       Logger.debug(flatFeatures);
                        for (FlatFeature flatFeature : flatFeatures) {
                                ProtocolConfig41[] configs = flatFeatureProtocolMap.get(flatFeature);
                                if (configs != null) {
+                                       Logger.debug(flatFeature);
                                        for (int i = 0; i < configs.length; i++) {
                                                int bitshift = configs[i].getShift();
                                                if (bitshift >= 64) { // high 8byte bit
@@ -245,12 +246,11 @@ public enum ProtocolConfig41 implements IProtocolConfig {
                                }
                        }
                }
-               
                if (selectedPreferences != null) {
-                       Logger.debug(selectedPreferences);
                        for (FlatPreferences feature : selectedPreferences) {
                                ProtocolConfig41[] configs = preferencesProtocolMap.get(feature);
                                if (configs != null) {
+                                       Logger.debug(feature);
                                        for (int i = 0; i < configs.length; i++) {
                                                int bitshift = configs[i].getShift();
                                                if (bitshift >= 64) { // high 8byte bit
index 00ce06d..bdf3a6d 100644 (file)
@@ -909,12 +909,6 @@ public enum SettingDataManager {
                if (!isOptionsSelectedPrefereces(FlatPreferences.APP_STARTUP)) {
                        selectedFeatures.add(FlatPreferences.APP_STARTUP);
                }
-               if (!isOptionsSelectedPrefereces(FlatPreferences.WEB_FUNCTION_PROFILING)) {
-                       selectedFeatures.add(FlatPreferences.WEB_FUNCTION_PROFILING);
-               }
-               if (!isOptionsSelectedPrefereces(FlatPreferences.WEBAPP_STARTUP)) {
-                       selectedFeatures.add(FlatPreferences.WEBAPP_STARTUP);
-               }
                if (!isOptionsSelectedPrefereces(FlatPreferences.SYSTEM_ALL_PROCESSES)) {
                        selectedFeatures.add(FlatPreferences.SYSTEM_ALL_PROCESSES);
                }
index 15755ec..ba2df89 100644 (file)
@@ -119,7 +119,7 @@ public class MemoryPage extends DAPageComposite {
                bottomLeftForm.setSashWidth(AnalyzerConstants.SASH_WIDTH);
                bottomRightForm.setSashWidth(AnalyzerConstants.SASH_WIDTH);
                
-               DataManagerRegistry.registerPageDataManager(MemoryDataManager.getInstance());
+               //DataManagerRegistry.registerPageDataManager(MemoryDataManager.getInstance());
                DataManagerRegistry.registerPageDataManager(HeapDataManager.getInstance());
        }
 
index 49c1aac..41f465e 100644 (file)
@@ -39,6 +39,7 @@ import org.tizen.dynamicanalyzer.swap.logparser.DataManagerRegistry;
 import org.tizen.dynamicanalyzer.ui.info.callstack.CallstackView;
 import org.tizen.dynamicanalyzer.ui.info.screenshot.ScreenshotDataManager;
 import org.tizen.dynamicanalyzer.ui.interactive.data.InteractiveDataManager;
+import org.tizen.dynamicanalyzer.ui.memory.data.MemoryDataManager;
 import org.tizen.dynamicanalyzer.ui.timeline.calltrace.CallTraceDataManager;
 import org.tizen.dynamicanalyzer.ui.timeline.calltrace.CallTraceView;
 import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineChartManager;
@@ -107,6 +108,7 @@ public class TimelinePage extends DAPageComposite {
                DataManagerRegistry.registerPageDataManager(CallTraceDataManager.getInstance());
                DataManagerRegistry.registerPageDataManager(InteractiveDataManager.getInstance());
                DataManagerRegistry.registerPageDataManager(ScreenshotDataManager.getInstance());
+               DataManagerRegistry.registerPageDataManager(MemoryDataManager.getInstance());
        }
        
        @Override
index bc25b7d..7648684 100644 (file)
@@ -62,6 +62,7 @@ import org.tizen.dynamicanalyzer.swap.model.data.UIEventData;
 import org.tizen.dynamicanalyzer.ui.common.TimelineChartMouseEventListener;
 import org.tizen.dynamicanalyzer.ui.common.TimelineChartMouseTrackAdapter;
 import org.tizen.dynamicanalyzer.ui.info.screenshot.ScreenshotDataManager;
+import org.tizen.dynamicanalyzer.ui.memory.data.MemoryDataManager;
 import org.tizen.dynamicanalyzer.ui.timeline.CustomDataDBTable;
 import org.tizen.dynamicanalyzer.ui.timeline.LifeCycleDBTable;
 import org.tizen.dynamicanalyzer.ui.timeline.SystemDataDBTable;
@@ -762,8 +763,8 @@ public class TimelineChartManager extends PageDataManager implements IDAChartSer
                if (Toolbar.INSTANCE != null) {
                        selectedPID = Toolbar.INSTANCE.getSelectedPid();
                }
-               Map<Integer, List<List<Object>>> targetProcessDBData = getTargetProcessDataFromDB(
-                               startTime, endTime, selectedPID);
+               
+               Map<Integer, List<List<Object>>> targetProcessDBData = getTargetProcessDataFromDB(startTime, endTime, selectedPID);
 
                /*
                 * 2. Make series of chart
@@ -773,7 +774,15 @@ public class TimelineChartManager extends PageDataManager implements IDAChartSer
                                continue;
                        }
 
-                       if (chart.getProbeType() == ProtocolConstants.MSG_DATA_SYSTEM) {
+                       if (chart.getChartType() == TimelineConstants.CHART_TYPE_PROCESS_MEMORY) {
+                               List<Object> dataList = new ArrayList<Object>();
+                               targetProcessDBData = MemoryDataManager.getInstance()
+                                               .getTargetProcessDataMapFromDB(startTime, endTime, selectedPID);
+                               
+                               dataList.add(systemDBData);
+                               dataList.add(targetProcessDBData);
+                               chart.inputChartSeries(dataList);
+                       } else if (chart.getProbeType() == ProtocolConstants.MSG_DATA_SYSTEM) {
                                List<Object> dataList = new ArrayList<Object>();
                                dataList.add(systemDBData);
                                dataList.add(targetProcessDBData);