aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Trofimov <sergei.trofimov@arm.com>2018-03-12 17:41:33 +0000
committerMarc Bonnici <marc.bonnici@arm.com>2018-03-15 17:42:25 +0000
commit2b7d1de9f1db2ca2c0b9cf146063f58eb4a2aad5 (patch)
tree9cbcb8dbcf597f387a1acc643b5ced3e9e4d583e
parentdd7ff641f3face54cbb2d2db05629d1cac4efac7 (diff)
workloads: add hwuitest
Port automation for hwuitest (Android's libhwui microbenchmark) from WA2.
-rw-r--r--wa/workloads/hwuitest/__init__.py122
1 files changed, 122 insertions, 0 deletions
diff --git a/wa/workloads/hwuitest/__init__.py b/wa/workloads/hwuitest/__init__.py
new file mode 100644
index 00000000..2e3dc129
--- /dev/null
+++ b/wa/workloads/hwuitest/__init__.py
@@ -0,0 +1,122 @@
+# Copyright 2013-2018 ARM Limited
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+#pylint: disable=E1101,W0201
+
+import os
+import re
+from collections import defaultdict
+
+from wa import Workload, Parameter, Executable
+from wa.utils.exec_control import once
+from wa.utils.types import caseless_string
+
+
+BINARY = "hwuitest"
+IGNORED_METRICS = ["Stats since", "Total frames rendered"]
+
+
+class HWUITest(Workload):
+
+ name = 'hwuitest'
+ description = """
+ Tests UI rendering latency on Android devices.
+
+ The binary for this workload is built as part of AOSP's
+ frameworks/base/libs/hwui component.
+ """
+ supported_platforms = ['android']
+
+ parameters = [
+ Parameter('test', kind=caseless_string, default="shadowgrid",
+ allowed_values=["shadowgrid", "rectgrid", "oval"],
+ description="""
+ The test to run:
+
+ - ``'shadowgrid'``: creates a grid of rounded rects that
+ cast shadows, high CPU & GPU load
+ - ``'rectgrid'``: creates a grid of 1x1 rects
+ - ``'oval'``: draws 1 oval
+ """),
+ Parameter('loops', kind=int, default=3,
+ description="The number of test iterations."),
+ Parameter('frames', kind=int, default=150,
+ description="The number of frames to run the test over."),
+ ]
+
+ def __init__(self, target, *args, **kwargs):
+ super(HWUITest, self).__init__(target, *args, **kwargs)
+ HWUITest.target_exe = None
+
+
+ @once
+ def initialize(self, context):
+ host_exe = context.resolver.get(Executable(self,
+ self.target.abi,
+ BINARY))
+ HWUITest.target_exe = self.target.install(host_exe)
+
+ def run(self, context):
+ self.output = self.target.execute("{} {} {} {}".format(self.target_exe,
+ self.test.lower(),
+ self.loops,
+ self.frames))
+
+ def extract_results(self, context):
+ outfile = os.path.join(context.output_directory, 'hwuitest.output')
+ with open(outfile, 'w') as wfh:
+ wfh.write(self.output)
+ context.add_artifact('hwuitest', outfile, kind='raw')
+
+ def update_output(self, context):
+ normal = re.compile(r'(?P<value>\d*)(?P<unit>\w*)')
+ with_pct = re.compile(r'(?P<value>\d*) \((?P<percent>.*)%\)')
+ count = 0
+ for line in self.output.splitlines():
+ #Filters out "Success!" and blank lines
+ try:
+ metric, value_string = [p.strip() for p in line.split(':', 1)]
+ except ValueError:
+ continue
+
+ # Filters out unwanted lines
+ if metric in IGNORED_METRICS:
+ continue
+
+ if metric == "Janky frames":
+ count += 1
+ match = with_pct.match(value_string).groupdict()
+ context.add_metric(metric,
+ match['value'],
+ None,
+ classifiers={"loop": count,
+ "frames": self.frames})
+ context.add_metric(metric + "_pct",
+ match['percent'],
+ "%",
+ classifiers={"loop": count,
+ "frames": self.frames})
+ else:
+ match = normal.match(value_string).groupdict()
+ context.add_metric(metric,
+ match['value'],
+ match['unit'],
+ classifiers={"loop": count,
+ "frames": self.frames})
+
+ @once
+ def finalize(self, context):
+ if (self.target_exe):
+ self.target.uninstall(self.target_exe)