1*e5436536SAndroid Build Coastguard Worker# Benchmark tests 2*e5436536SAndroid Build Coastguard Worker 3*e5436536SAndroid Build Coastguard WorkerThis Benchmark app analyses the time taken by AAC Decoder for given set of inputs. It is used to benchmark decoder module on android devices. 4*e5436536SAndroid Build Coastguard Worker 5*e5436536SAndroid Build Coastguard WorkerThis page describes steps to run the AAC decoder Benchmark test. 6*e5436536SAndroid Build Coastguard Worker 7*e5436536SAndroid Build Coastguard WorkerRun the following steps to build the test suite: 8*e5436536SAndroid Build Coastguard Worker``` 9*e5436536SAndroid Build Coastguard Workermmm external/aac/tests/AacDecBenchmark/ 10*e5436536SAndroid Build Coastguard Worker``` 11*e5436536SAndroid Build Coastguard Worker 12*e5436536SAndroid Build Coastguard Worker# Resources 13*e5436536SAndroid Build Coastguard WorkerThe resource folder for the tests is taken from [here](https://dl.google.com/android-unittest/media/external/aac/tests/AacDecBenchmark/AacDecBenchmark-1.0.zip) 14*e5436536SAndroid Build Coastguard Worker 15*e5436536SAndroid Build Coastguard WorkerDownload the AacDecBenchmark-1.0.zip folder, unzip and push it to any path on the device, Let's say the path be /sdcard/test. You can give the path wherever you chose to put the files. 16*e5436536SAndroid Build Coastguard Worker 17*e5436536SAndroid Build Coastguard Worker``` 18*e5436536SAndroid Build Coastguard Workerunzip AacDecBenchmark-1.0.zip 19*e5436536SAndroid Build Coastguard Workeradb push AacDecBenchmark-1.0 /sdcard/test 20*e5436536SAndroid Build Coastguard Worker``` 21*e5436536SAndroid Build Coastguard Worker 22*e5436536SAndroid Build Coastguard Worker# <a name="BenchmarkApplication"></a> Benchmark Application 23*e5436536SAndroid Build Coastguard WorkerTo run the test suite for measuring performance, follow the following steps: 24*e5436536SAndroid Build Coastguard Worker 25*e5436536SAndroid Build Coastguard WorkerBenchmark Application can be run in two ways. 26*e5436536SAndroid Build Coastguard Worker 27*e5436536SAndroid Build Coastguard Worker## Steps to run with atest 28*e5436536SAndroid Build Coastguard WorkerNote that atest command will install Benchmark application and push the required test files to the device as well. 29*e5436536SAndroid Build Coastguard Worker 30*e5436536SAndroid Build Coastguard WorkerFor running the benchmark test, run the following command 31*e5436536SAndroid Build Coastguard Worker``` 32*e5436536SAndroid Build Coastguard Workeratest AacDecBenchmark 33*e5436536SAndroid Build Coastguard Worker``` 34*e5436536SAndroid Build Coastguard Worker 35*e5436536SAndroid Build Coastguard Worker## Steps to run without atest (push binary to the device and run) 36*e5436536SAndroid Build Coastguard Worker 37*e5436536SAndroid Build Coastguard WorkerTo run the test suite for measuring performance of the decoder, follow the following steps: 38*e5436536SAndroid Build Coastguard Worker 39*e5436536SAndroid Build Coastguard WorkerThe 64-bit binaries will be created in the following path : ${OUT}/data/benchmarktest64/ 40*e5436536SAndroid Build Coastguard Worker 41*e5436536SAndroid Build Coastguard WorkerThe 32-bit binaries will be created in the following path : ${OUT}/data/benchmarktest/ 42*e5436536SAndroid Build Coastguard Worker 43*e5436536SAndroid Build Coastguard WorkerTo test 64-bit binary push binaries from benchmarktest64. 44*e5436536SAndroid Build Coastguard Worker 45*e5436536SAndroid Build Coastguard Worker``` 46*e5436536SAndroid Build Coastguard Workeradb push $(OUT)/data/benchmarktest64/AacDecBenchmark/AacDecBenchmark /data/local/tmp/ 47*e5436536SAndroid Build Coastguard Worker``` 48*e5436536SAndroid Build Coastguard Worker 49*e5436536SAndroid Build Coastguard WorkerTo test 32-bit binary push binaries from benchmarktest. 50*e5436536SAndroid Build Coastguard Worker 51*e5436536SAndroid Build Coastguard Worker``` 52*e5436536SAndroid Build Coastguard Workeradb push $(OUT)/data/benchmarktest/AacDecBenchmark/AacDecBenchmark /data/local/tmp/ 53*e5436536SAndroid Build Coastguard Worker``` 54*e5436536SAndroid Build Coastguard Worker 55*e5436536SAndroid Build Coastguard WorkerTo get the resource files for the test follow instructions given in [Resources](#Resources) 56*e5436536SAndroid Build Coastguard Worker 57*e5436536SAndroid Build Coastguard WorkerAfter running the above steps, /sdcard/test should contain AacDecBenchmark-1.0 folder and /data/local/tmp should contain benchmark binary to be executed. 58*e5436536SAndroid Build Coastguard Worker 59*e5436536SAndroid Build Coastguard WorkerRun the following commands to see the benchmark results 60*e5436536SAndroid Build Coastguard Worker``` 61*e5436536SAndroid Build Coastguard Workeradb shell 62*e5436536SAndroid Build Coastguard Workercd /data/local/tmp/ 63*e5436536SAndroid Build Coastguard Workerchmod a+x AacDecBenchmark 64*e5436536SAndroid Build Coastguard Worker./AacDecBenchmark 65*e5436536SAndroid Build Coastguard Worker``` 66*e5436536SAndroid Build Coastguard Worker 67*e5436536SAndroid Build Coastguard WorkerRun the below commands to generate a csv report and see the benchmark results 68*e5436536SAndroid Build Coastguard Worker``` 69*e5436536SAndroid Build Coastguard Workeradb shell 70*e5436536SAndroid Build Coastguard Workercd /data/local/tmp/ 71*e5436536SAndroid Build Coastguard Workerchmod a+x AacDecBenchmark 72*e5436536SAndroid Build Coastguard Worker./AacDecBenchmark --benchmark_out=output.csv 73*e5436536SAndroid Build Coastguard Worker``` 74*e5436536SAndroid Build Coastguard Worker 75*e5436536SAndroid Build Coastguard Workerif the folder path where the resource files are pushed is different from /sdcard/test/ , pass the actual folder path as an argument as shown below and run the following commands to see the benchmark results. Here let's say the path be /sdcard/test/AacDecBenchmark-1.0 76*e5436536SAndroid Build Coastguard Worker``` 77*e5436536SAndroid Build Coastguard Workeradb shell 78*e5436536SAndroid Build Coastguard Workercd /data/local/tmp/ 79*e5436536SAndroid Build Coastguard Workerchmod a+x AacDecBenchmark 80*e5436536SAndroid Build Coastguard Worker./AacDecBenchmark --path=/sdcard/test/AacDecBenchmark-1.0 81*e5436536SAndroid Build Coastguard Worker``` 82*e5436536SAndroid Build Coastguard Worker 83*e5436536SAndroid Build Coastguard WorkerRun the below commands to store the benchmark results in an output.csv file which will be generated in the same path on the device. 84*e5436536SAndroid Build Coastguard Worker 85*e5436536SAndroid Build Coastguard WorkerYou can modify the output csv filename to any name and can be generated in any given absolute path. 86*e5436536SAndroid Build Coastguard Worker``` 87*e5436536SAndroid Build Coastguard Workeradb shell 88*e5436536SAndroid Build Coastguard Workercd /data/local/tmp/ 89*e5436536SAndroid Build Coastguard Workerchmod a+x AacDecBenchmark 90*e5436536SAndroid Build Coastguard Worker./AacDecBenchmark --path=/sdcard/test/AacDecBenchmark-1.0 --benchmark_out=output.csv 91*e5436536SAndroid Build Coastguard Worker``` 92*e5436536SAndroid Build Coastguard Worker 93*e5436536SAndroid Build Coastguard Worker# Analysis 94*e5436536SAndroid Build Coastguard Worker 95*e5436536SAndroid Build Coastguard WorkerThe benchmark results are stored in a CSV file if opted, which can be used for analysis. 96*e5436536SAndroid Build Coastguard Worker 97*e5436536SAndroid Build Coastguard WorkerNote: This timestamp is in nano seconds and will change based on current system time. 98*e5436536SAndroid Build Coastguard Worker 99*e5436536SAndroid Build Coastguard WorkerThis csv file can be pulled from the device using "adb pull" command. 100*e5436536SAndroid Build Coastguard Worker``` 101*e5436536SAndroid Build Coastguard Workeradb pull /data/local/tmp/output.csv ./output.csv 102*e5436536SAndroid Build Coastguard Worker``` 103*e5436536SAndroid Build Coastguard Worker 104*e5436536SAndroid Build Coastguard Worker## CSV Columns 105*e5436536SAndroid Build Coastguard Worker 106*e5436536SAndroid Build Coastguard WorkerFollowing columns are available in CSV. 107*e5436536SAndroid Build Coastguard Worker 108*e5436536SAndroid Build Coastguard WorkerNote: All time values are in nano seconds 109*e5436536SAndroid Build Coastguard Worker 110*e5436536SAndroid Build Coastguard Worker1. **fileName**: The file being used as an input for the benchmark test. 111*e5436536SAndroid Build Coastguard Worker 112*e5436536SAndroid Build Coastguard Worker2. **Channels**: Number of channels does the input audio bitstream contain. 113*e5436536SAndroid Build Coastguard Worker 114*e5436536SAndroid Build Coastguard Worker3. **SampleRate**: SampleRate of the input audio bitstream. 115*e5436536SAndroid Build Coastguard Worker 116*e5436536SAndroid Build Coastguard Worker4. **FrameSize**: FrameSize of the input audio bitstream. 117*e5436536SAndroid Build Coastguard Worker 118*e5436536SAndroid Build Coastguard Worker5. **real_time**: Measures total elapsed time from start to end of process, including wait times and delays. 119*e5436536SAndroid Build Coastguard Worker 120*e5436536SAndroid Build Coastguard Worker6. **cpu_time**: Measures total time spent by cpu actively executing instructions for a process. 121