1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2025-05-08 18:35:18 +01:00

andebench: added parameter to only run native portion of the benchmark.

This commit is contained in:
Sergei Trofimov 2015-09-03 17:18:45 +01:00
parent bfed59a7cf
commit 0d076fe8ba
2 changed files with 21 additions and 7 deletions
wlauto/workloads/andebench
__init__.py
uiauto/src/com/arm/wlauto/uiauto

@ -50,6 +50,10 @@ class Andebench(AndroidUiAutoBenchmark):
If ``true``, AndEBench will run with a single thread. Note: this must If ``true``, AndEBench will run with a single thread. Note: this must
not be specified if ``number_of_threads`` has been specified. 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 = [ aliases = [
@ -71,6 +75,9 @@ class Andebench(AndroidUiAutoBenchmark):
self.number_of_threads = self.device.number_of_cores # pylint: disable=W0201 self.number_of_threads = self.device.number_of_cores # pylint: disable=W0201
self.logger.debug('Using {} threads'.format(self.number_of_threads)) self.logger.debug('Using {} threads'.format(self.number_of_threads))
self.uiauto_params['number_of_threads'] = 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 # Called after this setup as modifying uiauto_params
super(Andebench, self).setup(context) super(Andebench, self).setup(context)

@ -41,10 +41,11 @@ public class UiAutomation extends BaseUiAutomation {
Bundle status = new Bundle(); Bundle status = new Bundle();
Bundle params = getParams(); Bundle params = getParams();
String numThreads = params.getString("number_of_threads"); String numThreads = params.getString("number_of_threads");
Boolean nativeOnly = Boolean.parseBoolean(params.getString("native_only"));
status.putString("product", getUiDevice().getProductName()); status.putString("product", getUiDevice().getProductName());
waitForStartButton(); waitForStartButton();
setNumberOfThreads(numThreads); setConfiguration(numThreads, nativeOnly);
hitStart(); hitStart();
waitForAndExtractResuts(); waitForAndExtractResuts();
@ -60,12 +61,18 @@ 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(); UiSelector selector = new UiSelector();
getUiDevice().pressMenu(); getUiDevice().pressMenu();
UiObject settingsButton = new UiObject(selector.clickable(true)); UiObject settingsButton = new UiObject(selector.clickable(true));
settingsButton.click(); settingsButton.click();
if (nativeOnly) {
UiObject nativeButton = new UiObject(selector.textContains("Native"));
nativeButton.click();
}
UiObject threadNumberField = new UiObject(selector.className("android.widget.EditText")); UiObject threadNumberField = new UiObject(selector.className("android.widget.EditText"));
threadNumberField.clearTextField(); threadNumberField.clearTextField();
threadNumberField.setText(numThreads); threadNumberField.setText(numThreads);