summaryrefslogtreecommitdiff
path: root/hwbinder_latency_test
diff options
context:
space:
mode:
authorHsin-Yi Chen <hsinyichen@google.com>2017-05-31 19:55:37 +0800
committerHsin-Yi Chen <hsinyichen@google.com>2017-06-02 19:10:41 +0800
commitd46cbebc67da36d452e4c1ee68e3dd1406789472 (patch)
tree86603f0fa6a42110b6f6477062b2d3612c65c127 /hwbinder_latency_test
parent020c924dfd4b0c4944e34272eb5eae4096748e75 (diff)
downloadperformance-d46cbebc67da36d452e4c1ee68e3dd1406789472.tar.gz
Report benchmark result as table
Add methods to convert hwbinder latency results from JSON object to table. For Google benchmark results, call benchmark_parser to convert. Bug: 38283802 Test: vts-tradefed run commandAndExit vts -m BinderPerformanceTest Change-Id: Iec1db80497b55679fba54e91cc1058de840bbbd7
Diffstat (limited to 'hwbinder_latency_test')
-rw-r--r--hwbinder_latency_test/HwBinderLatencyTest.py76
1 files changed, 72 insertions, 4 deletions
diff --git a/hwbinder_latency_test/HwBinderLatencyTest.py b/hwbinder_latency_test/HwBinderLatencyTest.py
index 5d70625..8486dab 100644
--- a/hwbinder_latency_test/HwBinderLatencyTest.py
+++ b/hwbinder_latency_test/HwBinderLatencyTest.py
@@ -27,7 +27,38 @@ from vts.utils.python.cpu import cpu_frequency_scaling
class HwBinderLatencyTest(base_test.BaseTestClass):
- """A test case for the hwbinder latency benchmarking."""
+ """A test case for the hwbinder latency benchmarking.
+
+ Sample output of libhwbinder_latency
+ {
+ "cfg":{"pair":6,"iterations":166,"deadline_us":2500,"passthrough":1},
+ "fifo_0_data": [15052, ...],
+ "fifo_1_data": [...],
+ ...
+ "ALL":{"SYNC":"GOOD","S":1992,"I":1992,"R":1,
+ "other_ms":{ "avg":0.0048, "wst":0.32, "bst":0.0022, "miss":0, "meetR":1},
+ "fifo_ms": { "avg":0.0035, "wst":0.037, "bst":0.0021, "miss":0, "meetR":1},
+ "otherdis":{ "p50":0.19531, "p90":0.19531, "p95":0.19531, "p99": 0.19531},
+ "fifodis": { "p50":0.19531, "p90":0.19531, "p95":0.19531, "p99": 0.19531}
+ },
+ "P0":{...
+ },
+ ...
+ "inheritance": "PASS"
+ }
+ """
+ # The order of the columns in the output table
+ _MS_COLUMNS = ["avg", "wst", "bst", "miss", "meetR"]
+ _DIS_COLUMNS = ["p50", "p90", "p95", "p99"]
+ # The keys in the JSON object
+ _CFG = "cfg"
+ _PAIR = "pair"
+ _ALL = "ALL"
+ _OTHER_MS = "other_ms"
+ _FIFO_MS = "fifo_ms"
+ _OTHERDIS = "otherdis"
+ _FIFODIS = "fifodis"
+ _INHERITANCE = "inheritance"
def setUpClass(self):
required_params = ["hidl_hal_mode"]
@@ -47,10 +78,14 @@ class HwBinderLatencyTest(base_test.BaseTestClass):
self._cpu_freq.EnableCpuScaling()
def testRunBenchmark32Bit(self):
- self._uploadResult(self._runBenchmark(32), 32)
+ result = self._runBenchmark(32)
+ self._addBenchmarkTableToResult(result, 32)
+ self._uploadResult(result, 32)
def testRunBenchmark64Bit(self):
- self._uploadResult(self._runBenchmark(64), 64)
+ result = self._runBenchmark(64)
+ self._addBenchmarkTableToResult(result, 64)
+ self._uploadResult(result, 64)
def _runBenchmark(self, bits):
"""Runs the native binary and parses its result.
@@ -82,10 +117,43 @@ class HwBinderLatencyTest(base_test.BaseTestClass):
any(results[const.EXIT_CODE]),
"testRunBenchmark%sBit failed." % (bits))
json_result = json.loads(results[const.STDOUT][1]);
- asserts.assertTrue(json_result["inheritance"] == "PASS",
+ asserts.assertTrue(json_result[self._INHERITANCE] == "PASS",
"Scheduler does not support priority inheritance.");
return json_result
+ def _createRow(self, pair_name, ms_result, dis_result):
+ """Creates a row from the JSON output.
+
+ Args:
+ pair_name: string, the pair name in the first column.
+ ms_result: dict, the fifo_ms or other_ms object.
+ dis_result: dict, the fifodis or otherdis object.
+
+ Returns:
+ the list containing pair_name and the values in the objects.
+ """
+ row = [pair_name]
+ row.extend([ms_result[x] for x in self._MS_COLUMNS])
+ row.extend([dis_result[x] for x in self._DIS_COLUMNS])
+ return row
+
+ def _addBenchmarkTableToResult(self, result, bits):
+ pair_cnt = result[self._CFG][self._PAIR]
+ row_names = ["P" + str(i) for i in range(pair_cnt)] + [self._ALL]
+ col_names = ["pair"] + self._MS_COLUMNS + self._DIS_COLUMNS
+ fifo_table = [col_names]
+ other_table = [col_names]
+ for row_name in row_names:
+ pair_result = result[row_name]
+ fifo_table.append(self._createRow(row_name,
+ pair_result[self._FIFO_MS], pair_result[self._FIFODIS]))
+ other_table.append(self._createRow(row_name,
+ pair_result[self._OTHER_MS], pair_result[self._OTHERDIS]))
+ self.addTableToResult(
+ "hwbinder_latency_%sbits_fifo" % bits,fifo_table)
+ self.addTableToResult(
+ "hwbinder_latency_%sbits_other" % bits, other_table)
+
def _uploadResult(self, result, bits):
"""Uploads the output of benchmark program to web DB.