1 2# Run Caliper benchmark tests using vogar on a rooted device 3 4- It uses the [Caliper library](https://github.com/google/caliper) developed by Google. 5- Vogar source codes can be found at `external/vogar`. 6 71. Preparation 8 9```shell 10# vogar requires com.android.art.testing 11m vogar com.android.art.testing 12# remount if you haven't done so. 13adb root && adb remount && adb reboot && adb wait-for-device root 14cd libcore/benchmarks/src 15``` 16 17Extra options to reduce noise: 18```shell 19adb shell stop # to kill frameworks and zygote 20``` 21 222. Run an individual test 23 24```shell 25vogar --benchmark benchmarks/regression/ScannerBenchmark.java 26``` 27 28The source code of the tests can be found at `src/benchmarks/` 29 30# Run Jetpack benchmark tests 31Docs about Jetpack Benchmark can be found at 32[https://developer.android.com/studio/profile/benchmarking-overview]() 33 341. Preparation 35 36To lock CPU clocks on a rooted device, 37run the script provided at [https://developer.android.com/studio/profile/run-benchmarks-in-ci#clock-locking](). 38 392. Run an individual test 40```shell 41atest LibcoreBenchmarkTests:libcore.benchmark.FormatterTest#stringFormatNumber_allLocales 42``` 43 44The source code of the tests can be found at `src_androidx/libcore/benchmark/` 45 46## Outdated documentation / Not working 47 48###VM Options 49 50 51The VM's configuration will have a substantial impact on performance. 52Use Caliper's -J<name> <value 1>,<value 2>,<value 3> syntax to compare different VM options. For example: 53```shell 54vogar --benchmark ~/svn/dalvik/benchmarks/regression/CrespoFileIoRegressionBenchmark.java \ 55-- -Jgc -Xgc:noconcurrent,-Xgc:concurrent -Jint -Xint:fast,-Xint:jit,-Xint:portable 56``` 57 58