blob: 4b36eda135bcd1a5adc98aa6cc6d972ab3903816 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
|
# ART Performance Tests
## How to Run
You can run the benchmarks with the `run.py` script, and obtain compilation
statistics from a target adb device using `compile_stats.py`. Running on a
device requires that the Android environment be set up, and the device be
connected via adb. See either `run.py --help` or `compile_stats.py --help`
for details.
For example you can run on a target adb device:
./run.py --iterations 5 --mode 64 --target
Or on the host, with no adb device:
./run.py --iterations 5
Running 5 iterations of the compilation process with the benchmarks and all
APK files in ~/apk:
./compile_stats.py -i5 build/bench.apk ~/apk
## How to Write a Benchmark
Each set of related benchmarks is implemented as a Java class and kept in the
benchmarks/ folder.
Before contributing, make sure that `test/test.py` passes.
### Rules
1. Test method names start with "time" -- Test launcher will find all timeXXX()
methods and run them.
2. Verify methods start with "verify" -- all boolean verifyXXX() methods will
be run to check the benchmark is working correctly.
3. Leave iterations as parameter -- Test launcher will fill it with a value
to make sure it runs in a reasonable duration.
4. Benchmarks should take between 5 and 10 seconds to run.
### Example
public class MyBenchmark {
public static void main(String [] args) {
MyBenchmark b = new MyBenchmark();
long before = System.currentTimeMillis();
b.timeMethod0(1000);
b.timeMethod1(1000);
long after = System.currentTimeMillis();
System.out.println("MyBenchmark: " + (after - before));
}
// +----> test method prefix should be "time..."
// |
// ignored <---+ | +-------> No need to set iterations. Test
| | | framework will try to fill a
| | | reasonable value automatically.
// | | |
public int timeTestAdd(int iters) {
int result = 0;
for (int i = 0; i < iters; i++) {
// test code
testAddResults[i] = i + i;
}
return result;
}
public boolean verifyTestAdd() {
boolean result = // test contents of testAddResults[]
return result;
}
// If you want to fill iterations with your own value. Write a method like:
// Don't warm up test <-----+ +---------> Your choice
// | |
@IterationsAnnotation(noWarmup=true, iterations=600)
public long timeSfib(int iters) {
long sum = 0;
for (int i = 0; i < iters; i++) {
sum += sfib(20);
}
return sum;
}
}
// Please refer to existing benchmarks for further examples.
## Test Suite Details
TODO: Detail all benchmarks here, especially what they are intended to achieve.
### e.g. Raytrace
Description, License (if any), Main Focus, Secondary Focus, Additional Comments
### Control Flow Recursive
Control flow recursive is ported from:
https://github.com/WebKit/webkit/blob/master/PerformanceTests/SunSpider/tests/sunspider-1.0.2/controlflow-recursive.js
License is Revised BSD licence:
http://benchmarksgame.alioth.debian.org/license.html
### HashMapBench
Benchmark for hash map, which is converted from:
http://browserbench.org/JetStream/sources/hash-map.js
License is Apache 2.0.
### BitfieldRotate
Large portions Copyright (c) 2000-2015 The Legion of the Bouncy Castle Inc. (http://www.bouncycastle.org)
See BitfieldRotate.java header for license text.
License iS BSD-like.
|