public static final Image SCREEN_SHOT_DISABLE = getPngImage("toolbar_screen_shot_disable"); //$NON-NLS-1$
/* setting */
- public static final Image TARGET_NAME_MOBILE_2_3 = getPngImage("feature_target_mobile"); //$NON-NLS-1$
- public static final Image TARGET_NAME_TV_1_0 = getPngImage("feature_target_tv"); //$NON-NLS-1$
- public static final Image TARGET_NAME_WEARABLE_2_3 = getPngImage("feature_target_wearable"); //$NON-NLS-1$
+ public static final Image TARGET_NAME_MOBILE = getPngImage("feature_target_mobile"); //$NON-NLS-1$
+ public static final Image TARGET_NAME_TV = getPngImage("feature_target_tv"); //$NON-NLS-1$
+ public static final Image TARGET_NAME_WEARABLE = getPngImage("feature_target_wearable"); //$NON-NLS-1$
public static final Image TEMPLATE_BOTTLENECK_ANALYSIS = getPngImage("feature_template_bottleneck"); //$NON-NLS-1$
public static final Image TEMPLATE_MEMORY_LEAK = getPngImage("feature_template_memoryleaks"); //$NON-NLS-1$
Version|0.2
Log Level|4
-Available Target List|mobile-2.3
-Selected Target|mobile-2.3
+Available Target List|mobile-2.3.0|mobile-2.3.1|mobile-2.4.0
+Selected Target|mobile-2.3.0
Selected Chart List|CPU|CPU core|CPU frequency
Default Chart List|CPU|CPU core|CPU frequency
Options Selected Feature List|5002:0
Default Feature List|2|3|103
Total Overhead Range|1000000|3000000|7000000|15000000
-mobile-2.3|Protocol Version|3.0
-mobile-2.3|Available Template List|1|2|3|4|5|6|7|8|9|10
-mobile-2.3|Selected Template|1
-mobile-2.3|Available Feature List|1|1000|4|5|6|7|8|9|100|101|1001|102|200|201|202|203|204
-mobile-2.3|Selected Feature List|1|5|1000:1000|100|101|1001:10
-mobile-2.3|Available Chart List|CPU|CPU core|CPU frequency|Heap allocation|Process Size|Memory|Screenshot|UI event|Disk IO|Network IO|Device|Energy
+mobile-2.3.0|Protocol Version|3.0
+mobile-2.3.0|Available Template List|1|2|3|4|5|6|7|8|9|10
+mobile-2.3.0|Selected Template|1
+mobile-2.3.0|Available Feature List|1|1000|4|5|6|7|8|9|100|101|1001|102|200|201|202|203|204
+mobile-2.3.0|Selected Feature List|1|5|1000:1000|100|101|1001:10
+mobile-2.3.0|Available Chart List|CPU|CPU core|CPU frequency|Heap allocation|Process Size|Memory|Screenshot|UI event|Disk IO|Network IO|Device|Energy
+mobile-2.3.1|Protocol Version|3.0
+mobile-2.3.1|Available Template List|1|2|3|4|5|6|7|8|9|10
+mobile-2.3.1|Selected Template|1
+mobile-2.3.1|Available Feature List|1|1000|4|5|6|7|8|9|100|101|1001|102|200|201|202|203|204
+mobile-2.3.1|Selected Feature List|1|5|1000:1000|100|101|1001:10
+mobile-2.3.1|Available Chart List|CPU|CPU core|CPU frequency|Heap allocation|Process Size|Memory|Screenshot|UI event|Disk IO|Network IO|Device|Energy
+mobile-2.4.0|Protocol Version|4.0
+mobile-2.4.0|Available Template List|1|2|3|4|5|6|7|8|9|10
+mobile-2.4.0|Selected Template|1
+mobile-2.4.0|Available Feature List|1|1000|4|5|6|7|8|9|100|101|1001|102|200|201|202|203|204
+mobile-2.4.0|Selected Feature List|1|5|1000:1000|100|101|1001:10
+mobile-2.4.0|Available Chart List|CPU|CPU core|CPU frequency|Heap allocation|Process Size|Memory|Screenshot|UI event|Disk IO|Network IO|Device|Energy
wearable-2.3|Protocol Version|3.0
wearable-2.3|Available Template List|1|2|3|4|5|6|7|8|9|10
wearable-2.3|Selected Template|1
public String getPlatformName() {
if (platformName == null) {
- platformName = ProfileInfo.getPlatformName(device); // mobile-2.3
+ platformName = ProfileInfo.getPlatformName(device); // mobile-2.3.0
// device.getPlatformInfo().getProfileName(); // mobile
if (platformName == null) {
public static String SETTING_WARNING_MESSAGE_SETTING_INVALID_INPUT_VALUE;
public static String TARGET_NAME_MOBILE_2_3;
+ public static String TARGET_NAME_MOBILE_2_3_1;
+ public static String TARGET_NAME_MOBILE_2_4;
public static String TARGET_NAME_TV_1_0;
public static String TARGET_NAME_WEARABLE_2_3;
SETTING_DIALOG_SCREENSHOT=Screenshot
TARGET_NAME_MOBILE_2_3=mobile-2.3
+TARGET_NAME_MOBILE_2_3_1=mobile-2.3.1
+TARGET_NAME_MOBILE_2_4=mobile-2.4
TARGET_NAME_TV_1_0=tv-1.0
TARGET_NAME_WEARABLE_2_3=wearable-2.3
*/
package org.tizen.dynamicanalyzer.ui.toolbar.setting;
-import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.tizen.dynamicanalyzer.widgets.da.base.DAButton;
import org.tizen.dynamicanalyzer.widgets.da.view.DAPageComposite;
-public class SettingDialogTemplatePage extends DAPageComposite {
-
- private Map<String, Image> targetHashMap = null;
- private Map<String, Image> templateHashMap = null;
+public class SettingDialogTemplatePage extends DAPageComposite {
+ private enum ProfileDisplayInfo {
+ PROFILE_NAME_MOBILE_2_3_0(0, "mobile-2.3.0",
+ ConfigureLabels.TARGET_NAME_MOBILE_2_3, ImageResources.TARGET_NAME_MOBILE),
+ PROFILE_NAME_MOBILE_2_3_1(1, "mobile-2.3.1",
+ ConfigureLabels.TARGET_NAME_MOBILE_2_3_1, ImageResources.TARGET_NAME_MOBILE),
+ PROFILE_NAME_MOBILE_2_4_0(2, "mobile-2.4.0",
+ ConfigureLabels.TARGET_NAME_MOBILE_2_4, ImageResources.TARGET_NAME_MOBILE),
+ PROFILE_NAME_TV_1_0(3, "tv-1.0",
+ ConfigureLabels.TARGET_NAME_TV_1_0, ImageResources.TARGET_NAME_TV),
+ PROFILE_NAME_WEARABLE_2_3(4, "wearable-2.3",
+ ConfigureLabels.TARGET_NAME_WEARABLE_2_3, ImageResources.TARGET_NAME_WEARABLE);
+
+ private int id = -1;
+ private String versionName = null;
+ private String displayName = null;
+ private Image image = null;
+
+ private ProfileDisplayInfo(int id, String versionName, String displayName, Image image) {
+ this.id = id;
+ this.versionName = versionName;
+ this.displayName = displayName;
+ this.image = image;
+ }
+
+ public static String getVersionName(String displayName) {
+ ProfileDisplayInfo[] versions = ProfileDisplayInfo.values();
+ for (ProfileDisplayInfo ver : versions) {
+ if (ver.displayName.equals(displayName)) {
+ return ver.versionName;
+ }
+ }
+ return null;
+ }
+
+ public static String getDisplayName(String versionName) {
+ ProfileDisplayInfo[] versions = ProfileDisplayInfo.values();
+ for (ProfileDisplayInfo ver : versions) {
+ if (ver.versionName.equals(versionName)) {
+ return ver.displayName;
+ }
+ }
+ return null;
+ }
+
+ public static Image getImage(String versionName) {
+ ProfileDisplayInfo[] versions = ProfileDisplayInfo.values();
+ for (ProfileDisplayInfo ver : versions) {
+ if (ver.versionName.equals(versionName)) {
+ return ver.image;
+ }
+ }
+ return null;
+ }
+ };
+
+ private enum TemplateDisplayInfo {
+ TEMPLATE_NAME_BOTTLENECK(0, ConfigureLabels.TEMPLATE_NAME_BOTTLENECK,
+ ImageResources.TEMPLATE_BOTTLENECK_ANALYSIS),
+ TEMPLATE_NAME_MEMORY_LEAKS(1, ConfigureLabels.TEMPLATE_NAME_MEMORY_LEAKS,
+ ImageResources.TEMPLATE_MEMORY_LEAK),
+ TEMPLATE_NAME_PROCESS_ACTIVITY(2, ConfigureLabels.TEMPLATE_NAME_PROCESS_ACTIVITY,
+ ImageResources.TEMPLATE_PROCESS_ACTIVITY),
+ TEMPLATE_NAME_FILE(3, ConfigureLabels.TEMPLATE_NAME_FILE,
+ ImageResources.TEMPLATE_FILE_ANALYSIS),
+ TEMPLATE_NAME_THREAD_ACTIVITY(4, ConfigureLabels.TEMPLATE_NAME_THREAD_ACTIVITY,
+ ImageResources.TEMPLATE_THREAD_ACTIVITY_ANALYSIS),
+ TEMPLATE_NAME_WAIT_STATUS(5, ConfigureLabels.TEMPLATE_NAME_WAIT_STATUS,
+ ImageResources.TEMPLATE_WAIT_STATUS_ANALYSIS),
+ TEMPLATE_NAME_NETWORK(6, ConfigureLabels.TEMPLATE_NAME_NETWORK,
+ ImageResources.TEMPLATE_NETWORK_ANALYSIS),
+ TEMPLATE_NAME_OPEN_GL(7, ConfigureLabels.TEMPLATE_NAME_OPEN_GL,
+ ImageResources.TEMPLATE_OPEN_GL_ANALYSIS),
+ TEMPLATE_NAME_ENERGY(8, ConfigureLabels.TEMPLATE_NAME_ENERGY,
+ ImageResources.TEMPLATE_ENERGY),
+ TEMPLATE_NAME_CUSTOM(9, ConfigureLabels.TEMPLATE_NAME_CUSTOM,
+ ImageResources.TEMPLATE_CUSTOM);
+
+ private int id = -1;
+ private String displayName = null;
+ private Image image = null;
+
+ private TemplateDisplayInfo(int id, String displayName, Image image) {
+ this.id = id;
+ this.displayName = displayName;
+ this.image = image;
+ }
+
+ public static Image getImage(String displayName) {
+ TemplateDisplayInfo[] versions = TemplateDisplayInfo.values();
+ for (TemplateDisplayInfo ver : versions) {
+ if (ver.displayName.equals(displayName)) {
+ return ver.image;
+ }
+ }
+ return null;
+ }
+ };
// target widget
private Composite targetComp = null;
data.height = 18;
title.setLayoutData(data);
- initDataList();
createTargetComposite();
createTemplateDescriptionComposite();
createTemplateTitleComposite();
}
- private void initDataList() {
- targetHashMap = new HashMap<String, Image>();
- targetHashMap.put(ConfigureLabels.TARGET_NAME_MOBILE_2_3,
- ImageResources.TARGET_NAME_MOBILE_2_3);
- targetHashMap.put(ConfigureLabels.TARGET_NAME_TV_1_0, ImageResources.TARGET_NAME_TV_1_0);
- targetHashMap.put(ConfigureLabels.TARGET_NAME_WEARABLE_2_3,
- ImageResources.TARGET_NAME_WEARABLE_2_3);
-
- templateHashMap = new HashMap<String, Image>();
- templateHashMap.put(ConfigureLabels.TEMPLATE_NAME_BOTTLENECK,
- ImageResources.TEMPLATE_BOTTLENECK_ANALYSIS);
- templateHashMap.put(ConfigureLabels.TEMPLATE_NAME_MEMORY_LEAKS,
- ImageResources.TEMPLATE_MEMORY_LEAK);
- templateHashMap.put(ConfigureLabels.TEMPLATE_NAME_PROCESS_ACTIVITY,
- ImageResources.TEMPLATE_PROCESS_ACTIVITY);
- templateHashMap.put(ConfigureLabels.TEMPLATE_NAME_FILE,
- ImageResources.TEMPLATE_FILE_ANALYSIS);
- templateHashMap.put(ConfigureLabels.TEMPLATE_NAME_THREAD_ACTIVITY,
- ImageResources.TEMPLATE_THREAD_ACTIVITY_ANALYSIS);
- templateHashMap.put(ConfigureLabels.TEMPLATE_NAME_WAIT_STATUS,
- ImageResources.TEMPLATE_WAIT_STATUS_ANALYSIS);
- templateHashMap.put(ConfigureLabels.TEMPLATE_NAME_NETWORK,
- ImageResources.TEMPLATE_NETWORK_ANALYSIS);
- templateHashMap.put(ConfigureLabels.TEMPLATE_NAME_OPEN_GL,
- ImageResources.TEMPLATE_OPEN_GL_ANALYSIS);
- templateHashMap.put(ConfigureLabels.TEMPLATE_NAME_ENERGY, ImageResources.TEMPLATE_ENERGY);
- templateHashMap.put(ConfigureLabels.TEMPLATE_NAME_CUSTOM, ImageResources.TEMPLATE_CUSTOM);
- }
-
private void initTargetCompositeWidget() {
if (null != targetLabel) {
targetLabel.dispose();
TargetData target = entry.getValue();
DACustomToggleButton toggle = createToggleButton(targetInputComposite,
- targetHashMap.get(target.getTargetName()), imagePoint, target.getTargetName(),
+ ProfileDisplayInfo.getImage(target.getTargetName()), imagePoint,
+ ProfileDisplayInfo.getDisplayName(target.getTargetName()),
fontPoint, 76, 76, topPosition, leftPosition);
targetGroup.addToggleButton(toggle);
if (toggleButton.isToggled()) {
// set selected target
- SettingDataManager.INSTANCE.setSelectedTarget(toggleButton.getText());
+ SettingDataManager.INSTANCE.setSelectedTarget(
+ ProfileDisplayInfo.getVersionName(toggleButton.getText()));
// update template view
createTemplateTitleComposite();
// image
icon = new Label(descriptionComp, SWT.TRANSPARENT);
- icon.setImage(templateHashMap.get(template.getTemplateName()));
+ icon.setImage(TemplateDisplayInfo.getImage(template.getTemplateName()));
FormData data = new FormData();
data.left = new FormAttachment(0, 21);
data.top = new FormAttachment(0, 16);
for (int i = 0; i < templateList.size(); i++) {
TemplateData template = templateList.get(i).getData();
DACustomToggleButton toggle = createToggleButton(inputComposite,
- templateHashMap.get(template.getTemplateName()), imagePoint,
+ TemplateDisplayInfo.getImage(template.getTemplateName()), imagePoint,
template.getTemplateName(), fontPoint, 92, 76, topPosition, leftPosition);
targetGroup.addToggleButton(toggle);
public void testInitSettingData() {
// check Available Target List
Map<String, TargetData> targetListMap = setting.getTargetListMap();
- assertEquals(1, targetListMap.size());
- assertTrue(setting.isTarget("mobile-2.3"));
+ assertEquals(3, targetListMap.size());
+ assertTrue(setting.isTarget("mobile-2.3.0"));
assertFalse(setting.isTarget("wearable-2.3"));
// check Selected Target
- assertEquals("mobile-2.3", setting.getSelectedTarget());
+ assertEquals("mobile-2.3.0", setting.getSelectedTarget());
String initTarget = Whitebox.getInternalState(setting, "initTarget");
- assertEquals("mobile-2.3", initTarget);
+ assertEquals("mobile-2.3.0", initTarget);
// check Selected Chart List
List<String> chartList = setting.getSelectedChartList();
// check Default Protocol List
List<Feature> defaultFeatureList = setting.getDefaultFeatureList();
- assertEquals(2, defaultFeatureList.size());
+ assertEquals(3, defaultFeatureList.size());
assertEquals(2, defaultFeatureList.get(0).getIndex());
assertEquals(3, defaultFeatureList.get(1).getIndex());
public void testWriteTargetData() {
try {
String result = Whitebox.invokeMethod(setting, "writeTargetData");
- assertEquals("Available Target List|mobile-2.3", result);
+ assertEquals("Available Target List|mobile-2.3.0|mobile-2.3.1|mobile-2.4.0", result);
} catch (Exception e) {
Logger.exception(e);
}
try {
String result = Whitebox.invokeMethod(setting, "writeDefaultFeatureList",
SettingConstants.KEY_DEFAULT_FEATURE_LIST);
- assertEquals("Default Feature List|2|3", result);
+ assertEquals("Default Feature List|2|3|103", result);
} catch (Exception e) {
Logger.exception(e);
}
@Test
public void testProtocolOperation() {
try {
- int level = setting.getSelectedOverheadLevel("mobile-2.3");
+ int level = setting.getSelectedOverheadLevel("mobile-2.3.0");
assertEquals(1, level);
long featureOverheadValue = Whitebox.invokeMethod(setting, "getFeatureOverheadValue",
- setting.getTarget("mobile-2.3"), Feature.OPENGL_ANALYSIS, false);
+ setting.getTarget("mobile-2.3.0"), Feature.OPENGL_ANALYSIS, false);
assertEquals(800000, featureOverheadValue);
double count = Whitebox.invokeMethod(setting, "calculateCallcount", (Object) null,
TargetData target = setting.getTarget("wearable-2.3");
assertNull(target);
- target = setting.getTarget("mobile-2.3");
+ target = setting.getTarget("mobile-2.3.0");
assertNotNull(target);
Set<String> list = setting.getSelectedPageList("test-target");
assertNull(list);
- list = setting.getSelectedPageList("mobile-2.3");
+ list = setting.getSelectedPageList("mobile-2.3.0");
assertEquals(2, list.size());
assertTrue(list.contains("Timeline"));
assertTrue(list.contains("Summary"));
list = setting.getSelectedChartList("test-target");
assertNull(list);
- list = setting.getSelectedChartList("mobile-2.3");
+ list = setting.getSelectedChartList("mobile-2.3.0");
assertEquals(1, list.size());
assertTrue(list.contains("CPU"));
@Test
public void testGetSelectedFeatures() {
Set<Feature> selectedFeatures = setting.getSelectedFeatureSet();
- assertEquals(9, selectedFeatures.size());
+ assertEquals(10, selectedFeatures.size());
assertTrue(selectedFeatures.contains(Feature.SYSTEM));
assertTrue(selectedFeatures.contains(Feature.SYSTEM_CPU));
assertTrue(selectedFeatures.contains(Feature.SYSTEM_PROCESS));
// change target
setting.setSelectedTarget("wearable-2.3");
assertTrue(setting.changedFeatures());
- setting.setSelectedTarget("mobile-2.3");
+ setting.setSelectedTarget("mobile-2.3.0");
// change options feature
setting.addOptionsSelectedFeature(Feature.SCREENSHOT_PERIODICALLY, 50);
setting.revertSettingData();
// check selected target
- assertEquals("mobile-2.3", setting.getSelectedTarget());
+ assertEquals("mobile-2.3.0", setting.getSelectedTarget());
// check selected options feature
List<FeatureValueData> featureList = setting.getOptionsSelectedFeatureList();
@BeforeClass
public static void initTargetData() {
Logger.init(InternalLogger.DEBUG);
- targetData = new TargetData("mobile-2.3");
+ targetData = new TargetData("mobile-2.3.0");
try {
// add available template list
- String availableTemplateListData = "mobile-2.3|Available Template List|1|2|3|4|5|6|7|8|9|10";
+ String availableTemplateListData = "mobile-2.3.0|Available Template List|1|2|3|4|5|6|7|8|9|10";
String list[] = availableTemplateListData
.split(SettingConstants.READ_CSV_SEPARATOR, -1);
Whitebox.invokeMethod(targetData, "makeAvailableTemplateList", (Object) list);
targetData.setSelectedTemplate(Template.getTemplate(1));
// add available feature list
- String availableFeatureListData = "mobile-2.3|Available Feature List|1|1000|3|4|5|6|7|8|100|101|1001|102|200|201|202|203|204";
+ String availableFeatureListData = "mobile-2.3.0|Available Feature List|1|1000|3|4|5|6|7|8|100|101|1001|102|200|201|202|203|204";
list = availableFeatureListData.split(SettingConstants.READ_CSV_SEPARATOR, -1);
Whitebox.invokeMethod(targetData, "makeAvailableFeatureList", (Object) list);
// add selected feature list
- String selectedFeatureListData = "mobile-2.3|Selected Feature List|1|5|1000:1000|100|101|1001:10";
+ String selectedFeatureListData = "mobile-2.3.0|Selected Feature List|1|5|1000:1000|100|101|1001:10";
list = selectedFeatureListData.split(SettingConstants.READ_CSV_SEPARATOR, -1);
Whitebox.invokeMethod(targetData, "makeSelectedFeatureList", (Object) list);
// add available chart list
- String availableChartListData = "mobile-2.3|Available Chart List|CPU|CPU core|CPU frequency|Heap allocation|"
+ String availableChartListData = "mobile-2.3.0|Available Chart List|CPU|CPU core|CPU frequency|Heap allocation|"
+ "Process Size|Memory|Screenshot|UI event|Disk IO|Network IO|Device|Energy";
list = availableChartListData.split(SettingConstants.READ_CSV_SEPARATOR, -1);
Whitebox.invokeMethod(targetData, "makeAvailableChartList", (Object) list);
Version|0.2
Log Level|4
-Available Target List|mobile-2.3
-Selected Target|mobile-2.3
+Available Target List|mobile-2.3.0|mobile-2.3.1|mobile-2.4.0
+Selected Target|mobile-2.3.0
Selected Chart List|CPU|CPU core|CPU frequency
Default Chart List|CPU|CPU core|CPU frequency
Options Selected Feature List|5002:0
Default Feature List|2|3|103
Total Overhead Range|1000000|3000000|7000000|15000000
-mobile-2.3|Protocol Version|3.0
-mobile-2.3|Available Template List|1|2|3|4|5|6|7|8|9|10
-mobile-2.3|Selected Template|1
-mobile-2.3|Available Feature List|1|1000|4|5|6|7|8|9|100|101|1001|102|200|201|202|203|204
-mobile-2.3|Selected Feature List|1|5|1000:1000|100|101|1001:10
-mobile-2.3|Available Chart List|CPU|CPU core|CPU frequency|Heap allocation|Process Size|Memory|Screenshot|UI event|Disk IO|Network IO|Device|Energy
+mobile-2.3.0|Protocol Version|3.0
+mobile-2.3.0|Available Template List|1|2|3|4|5|6|7|8|9|10
+mobile-2.3.0|Selected Template|1
+mobile-2.3.0|Available Feature List|1|1000|4|5|6|7|8|9|100|101|1001|102|200|201|202|203|204
+mobile-2.3.0|Selected Feature List|1|5|1000:1000|100|101|1001:10
+mobile-2.3.0|Available Chart List|CPU|CPU core|CPU frequency|Heap allocation|Process Size|Memory|Screenshot|UI event|Disk IO|Network IO|Device|Energy
+mobile-2.3.1|Protocol Version|3.0
+mobile-2.3.1|Available Template List|1|2|3|4|5|6|7|8|9|10
+mobile-2.3.1|Selected Template|1
+mobile-2.3.1|Available Feature List|1|1000|4|5|6|7|8|9|100|101|1001|102|200|201|202|203|204
+mobile-2.3.1|Selected Feature List|1|5|1000:1000|100|101|1001:10
+mobile-2.3.1|Available Chart List|CPU|CPU core|CPU frequency|Heap allocation|Process Size|Memory|Screenshot|UI event|Disk IO|Network IO|Device|Energy
+mobile-2.4.0|Protocol Version|4.0
+mobile-2.4.0|Available Template List|1|2|3|4|5|6|7|8|9|10
+mobile-2.4.0|Selected Template|1
+mobile-2.4.0|Available Feature List|1|1000|4|5|6|7|8|9|100|101|1001|102|200|201|202|203|204
+mobile-2.4.0|Selected Feature List|1|5|1000:1000|100|101|1001:10
+mobile-2.4.0|Available Chart List|CPU|CPU core|CPU frequency|Heap allocation|Process Size|Memory|Screenshot|UI event|Disk IO|Network IO|Device|Energy
wearable-2.3|Protocol Version|3.0
wearable-2.3|Available Template List|1|2|3|4|5|6|7|8|9|10
wearable-2.3|Selected Template|1