diff --git a/wlauto/workloads/andebench/__init__.py b/wlauto/workloads/andebench/__init__.py index 9c62623e..56a91ec9 100644 --- a/wlauto/workloads/andebench/__init__.py +++ b/wlauto/workloads/andebench/__init__.py @@ -50,6 +50,10 @@ class Andebench(AndroidUiAutoBenchmark): If ``true``, AndEBench will run with a single thread. Note: this must not be specified if ``number_of_threads`` has been specified. """), + Parameter('native_only', kind=bool, + description=""" + If ``true``, AndEBench will execute only the native portion of the benchmark. + """), ] aliases = [ @@ -71,6 +75,9 @@ class Andebench(AndroidUiAutoBenchmark): self.number_of_threads = self.device.number_of_cores # pylint: disable=W0201 self.logger.debug('Using {} threads'.format(self.number_of_threads)) self.uiauto_params['number_of_threads'] = self.number_of_threads + self.uiauto_params['native_only'] = False + if self.native_only: + self.uiauto_params['native_only'] = True # Called after this setup as modifying uiauto_params super(Andebench, self).setup(context) diff --git a/wlauto/workloads/andebench/uiauto/src/com/arm/wlauto/uiauto/UiAutomation.java b/wlauto/workloads/andebench/uiauto/src/com/arm/wlauto/uiauto/UiAutomation.java index 41e36800..0d8fa06c 100644 --- a/wlauto/workloads/andebench/uiauto/src/com/arm/wlauto/uiauto/UiAutomation.java +++ b/wlauto/workloads/andebench/uiauto/src/com/arm/wlauto/uiauto/UiAutomation.java @@ -30,7 +30,7 @@ import com.android.uiautomator.testrunner.UiAutomatorTestCase; import com.arm.wlauto.uiauto.BaseUiAutomation; -public class UiAutomation extends BaseUiAutomation { +public class UiAutomation extends BaseUiAutomation { public static String TAG = "andebench"; @@ -41,10 +41,11 @@ public class UiAutomation extends BaseUiAutomation { Bundle status = new Bundle(); Bundle params = getParams(); String numThreads = params.getString("number_of_threads"); + Boolean nativeOnly = Boolean.parseBoolean(params.getString("native_only")); status.putString("product", getUiDevice().getProductName()); waitForStartButton(); - setNumberOfThreads(numThreads); + setConfiguration(numThreads, nativeOnly); hitStart(); waitForAndExtractResuts(); @@ -60,27 +61,33 @@ public class UiAutomation extends BaseUiAutomation { } } - public void setNumberOfThreads(String numThreads) throws Exception { + public void setConfiguration(String numThreads, boolean nativeOnly) throws Exception { UiSelector selector = new UiSelector(); getUiDevice().pressMenu(); UiObject settingsButton = new UiObject(selector.clickable(true)); settingsButton.click(); + + if (nativeOnly) { + UiObject nativeButton = new UiObject(selector.textContains("Native")); + nativeButton.click(); + } + UiObject threadNumberField = new UiObject(selector.className("android.widget.EditText")); - threadNumberField.clearTextField(); + threadNumberField.clearTextField(); threadNumberField.setText(numThreads); - getUiDevice().pressBack(); + getUiDevice().pressBack(); sleep(shortDelaySeconds); // If the device does not have a physical keyboard, a virtual one might have // poped up when setting the number of threads. If that happend, then the above // backpress would dismiss the vkb and another one will be necessary to return // from the settings screen. if(threadNumberField.exists()) - { + { getUiDevice().pressBack(); sleep(shortDelaySeconds); - } + } } public void hitStart() throws Exception {