aboutsummaryrefslogtreecommitdiff
path: root/benchmarks-script/antutu
diff options
context:
space:
mode:
Diffstat (limited to 'benchmarks-script/antutu')
-rw-r--r--benchmarks-script/antutu/run.py123
-rwxr-xr-xbenchmarks-script/antutu/run.sh24
-rw-r--r--benchmarks-script/antutu/session.xml3
-rw-r--r--benchmarks-script/antutu/shared_prefs/com.antutu.ABenchMark_preferences.xml6
4 files changed, 156 insertions, 0 deletions
diff --git a/benchmarks-script/antutu/run.py b/benchmarks-script/antutu/run.py
new file mode 100644
index 0000000..1deb16d
--- /dev/null
+++ b/benchmarks-script/antutu/run.py
@@ -0,0 +1,123 @@
+import os
+import re
+import subprocess
+import sys
+
+cur_dir = os.path.realpath(os.path.dirname(__file__))
+log_path = os.path.join(cur_dir, 'logcat.log')
+log_path_canvas = os.path.join(cur_dir, 'logcat_canvas.log')
+result_path = os.path.join(cur_dir, 'results.txt')
+
+
+def getResultFromCanvas():
+ if not os.path.exists(log_path_canvas):
+ return
+ log_fd = open(log_path_canvas)
+ output = log_fd.readlines()
+ log_fd.close()
+ #D/Canvas ( 6368): RAM:
+ #D/Canvas ( 6368): 727
+ #D/Canvas ( 6368): CPU integer:
+ #D/Canvas ( 6368): 1291
+ #D/Canvas ( 6368): CPU float-point:
+ #D/Canvas ( 6368): 1049
+ #D/Canvas ( 6368): 2D graphics:
+ #D/Canvas ( 6368): 293
+ #D/Canvas ( 6368): 3D graphics:
+ #D/Canvas ( 6368): 1212
+ #D/Canvas ( 6368): Database IO:
+ #D/Canvas ( 6368): 330
+ #D/Canvas ( 6368): SD card write:
+ #D/Canvas ( 6368): 0
+ #D/Canvas ( 6368): SD card read:
+ #D/Canvas ( 6368): 0
+ tmp_hash = {'RAM': 'memory',
+ 'CPU integer': 'integer',
+ 'CPU float-point': 'float',
+ '2D graphics': 'score2d',
+ '3D graphics': 'score3d',
+ 'Database IO': 'database',
+ 'SD card write': 'sdwrite',
+ 'SD card read': 'sdread',
+ 'Total score': 'score'
+ }
+ res_hash = {}
+ for index in range(len(output)):
+ tmp_ary = output[index].split(':')
+ if len(tmp_ary) != 3:
+ index = index + 1
+ continue
+ key = tmp_ary[1].strip()
+ if key in tmp_hash.keys():
+ value = output[index + 1].split(':')[1].strip()
+ res_hash[tmp_hash[key]] = value
+ index = index + 2
+ return res_hash
+
+
+def checkResults():
+ if not os.path.exists(log_path):
+ return
+ log_fd = open(log_path)
+ output = log_fd.readlines()
+ log_fd.close()
+
+ #I/Antutu Benchmark( 3373): memory: 789
+ #I/Antutu Benchmark( 3373): integer: 1319
+ #I/Antutu Benchmark( 3373): float: 1084
+ #I/Antutu Benchmark( 3373): score2d: 332
+ #I/Antutu Benchmark( 3373): score3d: 1313
+ #I/Antutu Benchmark( 3373): database: 260
+ #I/Antutu Benchmark( 3373): sdwrite: 0
+ #I/Antutu Benchmark( 3373): sdread: 0
+ #I/Antutu Benchmark( 3373): score: 5097
+ pat_str = ('^\s*I/Antutu Benchmark\s*\(\s*\d+\s*\)\s*:'
+ '\s*(?P<key>(memory|integer|float|score2d|score3d|'
+ 'database|sdwrite|sdread|score))\s*:'
+ '\s*(?P<score>\d+)\s*$'
+ )
+ pat = re.compile(pat_str)
+ res_hash = {}
+ for line in output:
+ match = pat.search(line)
+ if not match:
+ continue
+ data = match.groupdict()
+ res_hash[data['key'].strip()] = data['score'].strip()
+
+ if len(res_hash) == 0:
+ res_hash = getResultFromCanvas()
+
+ tmp_hash = {'integer': 'Antutu CPU integer',
+ 'float': 'Antutu CPU float-point',
+ 'memory': 'Antutu RAM',
+ 'score2d': 'Antutu 2D graphics',
+ 'score3d': 'Antutu 3D graphics',
+ 'database': 'Antutu Database IO',
+ 'sdwrite': 'Antutu SD card write',
+ 'sdread': 'Antutu SD card read',
+ 'score': 'Antutu Total'
+ }
+ f = open(result_path, "w")
+ for key in res_hash.keys():
+ f.write('%s=%s\n' % (tmp_hash[key], res_hash.get(key)))
+ f.close()
+
+
+def main():
+
+ dev_ids = []
+ if len(sys.argv) >= 2:
+ dev_ids = sys.argv[1:]
+ else:
+ dev_ids = ['']
+ for dev_id in dev_ids:
+ if os.path.exists(result_path):
+ os.unlink(result_path)
+ run_sh = os.path.realpath(os.path.dirname(__file__)) + "/run.sh"
+ subprocess.call(['/bin/bash', run_sh, dev_id])
+ checkResults()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/benchmarks-script/antutu/run.sh b/benchmarks-script/antutu/run.sh
new file mode 100755
index 0000000..66dc194
--- /dev/null
+++ b/benchmarks-script/antutu/run.sh
@@ -0,0 +1,24 @@
+#!/bin/bash
+
+#need to be defined for different benchmark apks
+activity="com.antutu.ABenchMark/.ABenchMarkStart"
+apk_file_name="com.antutu.ABenchMark-1.apk"
+test_method="testAntutu"
+apk_package="com.antutu.ABenchMark"
+
+function change_no_update(){
+ user=`adb shell ls -l /data/data/|grep com.antutu.ABenchMark|cut -d \ -f 2`
+ user=`echo ${user}|sed 's/\r//'`
+ dir_prefs="/data/data/com.antutu.ABenchMark/shared_prefs"
+ adb push ${parent_dir}/shared_prefs "${dir_prefs}"
+ adb shell chown ${user}:${user} "${dir_prefs}"
+ adb shell chmod 700 "${dir_prefs}"
+ adb shell chown ${user}:${user} "${dir_prefs}/com.antutu.ABenchMark_preferences.xml"
+ adb shell chmod 660 "${dir_prefs}/com.antutu.ABenchMark_preferences.xml"
+}
+
+#following should no need to modify
+parent_dir=`dirname ${0}`
+source "${parent_dir}/../common/common.sh"
+post_install="change_no_update"
+main "$@"
diff --git a/benchmarks-script/antutu/session.xml b/benchmarks-script/antutu/session.xml
new file mode 100644
index 0000000..7843358
--- /dev/null
+++ b/benchmarks-script/antutu/session.xml
@@ -0,0 +1,3 @@
+<?xml version="1.0" encoding="US-ASCII" ?>
+<session version="1" title="Antutu" target_path="@F" call_stack_unwinding="yes" parse_debug_info="yes" high_resolution="no" buffer_mode="streaming" sample_rate="normal" duration="0">
+</session>
diff --git a/benchmarks-script/antutu/shared_prefs/com.antutu.ABenchMark_preferences.xml b/benchmarks-script/antutu/shared_prefs/com.antutu.ABenchMark_preferences.xml
new file mode 100644
index 0000000..e6f0315
--- /dev/null
+++ b/benchmarks-script/antutu/shared_prefs/com.antutu.ABenchMark_preferences.xml
@@ -0,0 +1,6 @@
+<?xml version='1.0' encoding='utf-8' standalone='yes' ?>
+<map>
+<int name="lastVersionCode" value="63" />
+<boolean name="frist_start" value="false" />
+<boolean name="setting_update" value="false" />
+</map>