├── .github └── workflows │ ├── profile_generation.yml │ └── profile_verification.yml ├── .gitignore ├── LICENSE ├── README.md ├── auto-benchmark-plugin ├── .gitignore ├── build.gradle.kts ├── gradle.properties ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── plugin │ ├── .gitignore │ ├── build.gradle.kts │ └── src │ │ └── main │ │ └── kotlin │ │ └── io.github.sagar.auto_benchmark_plugin │ │ ├── AutoBenchmarkExtension.kt │ │ ├── AutoBenchmarkPlugin.kt │ │ └── BenchmarkJsonParserTask.kt └── settings.gradle.kts ├── baseline-profile ├── .gitignore ├── build.gradle.kts └── src │ └── main │ ├── AndroidManifest.xml │ └── java │ └── io │ └── github │ └── sagar │ └── baseline_profile │ └── AutoBenchmarkSampleBaselineProfileGenerator.kt ├── benchmark ├── .gitignore ├── benchmark-rules.pro ├── build.gradle.kts └── src │ └── main │ ├── AndroidManifest.xml │ └── java │ └── io │ └── github │ └── sagar │ └── benchmark │ └── ExampleStartupBenchmark.kt ├── build.gradle.kts ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── sample ├── .gitignore ├── build.gradle.kts ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── io │ │ └── github │ │ └── sagar │ │ └── auto_benchmark │ │ └── ExampleInstrumentedTest.kt │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── io │ │ │ └── github │ │ │ └── sagar │ │ │ └── auto_benchmark │ │ │ └── MainActivity.kt │ └── res │ │ ├── drawable-v24 │ │ └── ic_launcher_foreground.xml │ │ ├── drawable │ │ └── ic_launcher_background.xml │ │ ├── mipmap-anydpi-v26 │ │ ├── ic_launcher.xml │ │ └── ic_launcher_round.xml │ │ ├── mipmap-anydpi-v33 │ │ └── ic_launcher.xml │ │ ├── mipmap-hdpi │ │ ├── ic_launcher.webp │ │ └── ic_launcher_round.webp │ │ ├── mipmap-mdpi │ │ ├── ic_launcher.webp │ │ └── ic_launcher_round.webp │ │ ├── mipmap-xhdpi │ │ ├── ic_launcher.webp │ │ └── ic_launcher_round.webp │ │ ├── mipmap-xxhdpi │ │ ├── ic_launcher.webp │ │ └── ic_launcher_round.webp │ │ ├── mipmap-xxxhdpi │ │ ├── ic_launcher.webp │ │ └── ic_launcher_round.webp │ │ ├── values-night │ │ └── themes.xml │ │ ├── values │ │ ├── colors.xml │ │ ├── strings.xml │ │ └── themes.xml │ │ └── xml │ │ └── data_extraction_rules.xml │ └── release │ └── generated │ └── baselineProfiles │ └── baseline-prof.txt └── settings.gradle.kts /.github/workflows/profile_generation.yml: -------------------------------------------------------------------------------- 1 | name: Generate Baseline Profile 2 | 3 | on: 4 | pull_request: 5 | branches-ignore: 6 | - release 7 | 8 | jobs: 9 | build-benchmark-apks: 10 | name: Generate baseline profile 11 | runs-on: macos-latest 12 | timeout-minutes: 20 13 | 14 | steps: 15 | - name: Checkout 16 | uses: actions/checkout@v3 17 | 18 | - name: Validate Gradle Wrapper 19 | uses: gradle/wrapper-validation-action@v1 20 | 21 | - name: Set up JDK 17 22 | uses: actions/setup-java@v3 23 | with: 24 | distribution: 'zulu' 25 | java-version: 17 26 | 27 | - name: Install GMD image for baseline profile generation 28 | run: yes | "$ANDROID_HOME"/cmdline-tools/latest/bin/sdkmanager "system-images;android-33;aosp_atd;x86_64" 29 | 30 | - name: Accept Android licenses 31 | run: yes | "$ANDROID_HOME"/cmdline-tools/latest/bin/sdkmanager --licenses || true 32 | 33 | - name: Generate profile 34 | run: ./gradlew :sample:generateBaselineProfile 35 | -Pandroid.testoptions.manageddevices.emulator.gpu="swiftshader_indirect" 36 | -------------------------------------------------------------------------------- /.github/workflows/profile_verification.yml: -------------------------------------------------------------------------------- 1 | name: Verify Baseline Profile 2 | 3 | on: 4 | pull_request: 5 | branches: 6 | - release 7 | 8 | jobs: 9 | build-benchmark-apks: 10 | name: Build APKs and Run profile verification 11 | runs-on: macos-latest 12 | timeout-minutes: 20 13 | 14 | steps: 15 | - name: Checkout 16 | uses: actions/checkout@v3 17 | 18 | - name: Validate Gradle Wrapper 19 | uses: gradle/wrapper-validation-action@v1 20 | 21 | - name: Set up JDK 17 22 | uses: actions/setup-java@v3 23 | with: 24 | distribution: 'zulu' 25 | java-version: 17 26 | 27 | - name: Build benchmark apk 28 | run: ./gradlew :benchmark:assembleBenchmark 29 | 30 | - name: Build app apk 31 | run: ./gradlew :sample:assembleBenchmark 32 | 33 | - name: Setup GCloud Credentials for Flank 34 | run: | 35 | GCLOUD_DIR="$HOME/.config/gcloud/" 36 | mkdir -p "$GCLOUD_DIR" 37 | echo "${{ vars.GCLOUD_KEY }}" | base64 --decode > "$GCLOUD_DIR/application_default_credentials.json" 38 | 39 | - name: Verify baseline profile 40 | run: ./gradlew :sample:runBenchmarkAndVerifyProfile 41 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/ 5 | .DS_Store 6 | /build 7 | /captures 8 | .externalNativeBuild 9 | .cxx 10 | local.properties -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 Autobenchmark Contributors 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Autobenchmark 2 | [![Gradle Plugin](https://img.shields.io/gradle-plugin-portal/v/io.github.sagar-viradiya.autobenchmark?color=%233cafc6&label=Plugin&logo=gradle&style=flat-square)](https://plugins.gradle.org/plugin/io.github.sagar-viradiya.autobenchmark) 3 | 4 | A Gradle plugin to automate macro-benchmark on baseline profile. 5 | Run your macro-benchmark tests for profile verification on Firbase test lab and verify benchmark result JSON. 6 | With this plugin it is possible to integrate baseline profile verification in your CI pipeline to fully automate baseline profile. 7 | 8 | For generating profile you can leverage the official [baseline profile gradle plugin](https://developer.android.com/topic/performance/baselineprofiles/create-baselineprofile#baseline-profile-gradle-plugin). This plugin closes the loop of automating baseline profile end to end by providing automation on profile verification. 9 | 10 | For more information on benchmarking baseline profile visit official [Android guide](https://developer.android.com/topic/performance/baselineprofiles/measure-baselineprofile). 11 | 12 | ## Applying plugin 13 | 14 | ### Using plugin DSL 15 | Apply plugin to app module `build.gradle.kts` file. 16 | ```kotlin 17 | plugins { 18 | id("io.github.sagar-viradiya.autobenchmark") version "1.0.0.alpha02" 19 | } 20 | ``` 21 | 22 | ### Using legacy plugin application 23 | 24 | Add this to top project level `build.gradle.kts` 25 | ```kotlin 26 | buildscript { 27 | repositories { 28 | maven { 29 | url = uri("https://plugins.gradle.org/m2/") 30 | } 31 | } 32 | dependencies { 33 | classpath("io.github.sagar-viradiya:autobenchmark:1.0.0.alpha02") 34 | } 35 | } 36 | ``` 37 | And then apply plugin to app module `build.gradle.kts` file. 38 | 39 | ```kotlin 40 | apply(plugin = "io.github.sagar-viradiya.autobenchmark") 41 | ``` 42 | 43 | ## ⚙️ Configuring plugin 44 | 45 | Since it is recommended to run macro-benchmark on a physical device this plugin supports running tests on Firebase test lab through [Fladle](https://runningcode.github.io/fladle/). 46 | Following are the mandatory parameters that you need to configure. 47 | 48 | ```kotlin 49 | autoBenchmark { 50 | // A relative file path from the root to app apk with baseline profile 51 | appApkFilePath.set("/sample/build/outputs/apk/benchmark/sample-benchmark.apk") 52 | // A relative file path from the root to benchmark apk 53 | benchmarkApkFilePath.set("/benchmark/build/outputs/apk/benchmark/benchmark-benchmark.apk") 54 | // Service account JSON file path to authenticate GCloud 55 | serviceAccountJsonFilePath.set("../../.config/gcloud/application_default_credentials.json") 56 | // Physical device configuration map to run benchmark 57 | physicalDevices.set(mapOf( 58 | "model" to "redfin", "version" to "30" 59 | )) 60 | // Tolerance percentage for improvement below which verification will fail 61 | tolerancePercentage.set(10f) 62 | } 63 | ``` 64 | 65 | ### 🔐 Authenticate G-Cloud to run tests on Firebase test lab 66 | 67 | To run tests on Firebase test lab and download JSON result of profile verification, you need to authenticate to G-Cloud. 68 | 69 | #### Authenticating on local machine 70 | 71 | 1. Run `./gradlew flankAuth` 72 | 2. Sign in to web browser. 73 | 74 | This will store credentials in ~/.flank directory 75 | 76 | #### Authenticating on CI 77 | 78 | You will need service account JSON file to setup authentication on CI. Follow the [test lab docs](https://firebase.google.com/docs/test-lab/android/continuous) to create a service account. 79 | Base64 encode this file on your local machine and set this as environment variable on CI as GCLOUD_KEY. 80 | 81 | ```shell 82 | base64 -i "$HOME/.config/gcloud/application_default_credentials.json" | pbcopy 83 | ``` 84 | 85 | Then on CI decode the JSON. 86 | 87 | ```shell 88 | GCLOUD_DIR="$HOME/.config/gcloud/" 89 | mkdir -p "$GCLOUD_DIR" 90 | echo "$GCLOUD_KEY" | base64 --decode > "$GCLOUD_DIR/application_default_credentials.json" 91 | ``` 92 | Please refer to GitHub action setup to know how this is being done. 93 | 94 | For more info refer [this](https://flank.github.io/flank/#authenticate-with-a-service-account) flank guide for authentication as this plugin internally uses Fladle and Flank 95 | 96 | ## 📈 Running benchmark tests and baseline profile verification 97 | 98 | To run benchmark and verify result run following gradle task. 99 | 100 | ```shell 101 | ./gradlew [your_app]:runBenchmarkAndVerifyProfile 102 | ``` 103 | 104 | First, this will run all benchmark tests on Firebase test lab, and it will download benchmark result JSON from G-Cloud. 105 | This JSON file will be analysed next to compare 'No compilation median startup time' with 'baseline profile median startup time'. 106 | If the improvement percentage is below provided `tolerancePercentage` then gradle task will fail. 107 | 108 | For example, if no compilation median startup is 233 ms and baseline profile median startup 109 | is 206 ms then startup time is improved by ~11%. If the provided tolerance percentage is 110 | 10 then task will successfully complete. 111 | 112 | Task will also print improvement percentage, no compilation startup time median, and baseline profile startup time median. 113 | 114 | ```shell 115 | > Task :sample:runBenchmarkAndVerifyProfile 116 | No compilation median : 233.609398 117 | Baseline profile median : 206.635229 118 | Improvement percentage : 11.546700 119 | 120 | BUILD SUCCESSFUL in 2m 35s 121 | 9 actionable tasks: 3 executed, 6 up-to-date 122 | ``` 123 | 124 | > Note : One important requirement for benchmark result JSON parsing to work properly 125 | > is to have 'NoCompilation' in the test name targeting no compilation mode, and 'BaselineProfile' in the test name targeting baseline profile mode. 126 | 127 | ## Sample 128 | Please refer to sample app to see the plugin setup. Before you issue `./gradlew :sample:runBenchmarkAndVerifyProfile` you need to, 129 | build sample apk and benchmark apk first. 130 | 131 | Run following commands to build apks 132 | 133 | ```shell 134 | ./gradlew :sample:assembleBenchmark 135 | ``` 136 | 137 | ```shell 138 | ./gradlew :benchmark:assembleBenchmark 139 | ``` 140 | 141 | Also make sure to have service account JSON file in the configured path (`serviceAccountJsonFilePath`) 142 | 143 | For verifying profile on CI, please refer to GitHub action setup. 144 | 145 | ## Contribution 146 | Unfortunately it is not ready to accept any contribution 147 | yet. Once this is stable enough contribution guidelines will be updated here. Meanwhile, feel free to open an [issue](https://github.com/sagar-viradiya/auto-benchmark/issues) for feature requests and improvements. 148 | 149 | ## License 150 | 151 | MIT License 152 | 153 | Copyright (c) 2023 Autobenchmark Contributors 154 | 155 | Permission is hereby granted, free of charge, to any person obtaining a copy 156 | of this software and associated documentation files (the "Software"), to deal 157 | in the Software without restriction, including without limitation the rights 158 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 159 | copies of the Software, and to permit persons to whom the Software is 160 | furnished to do so, subject to the following conditions: 161 | 162 | The above copyright notice and this permission notice shall be included in all 163 | copies or substantial portions of the Software. 164 | 165 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 166 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 167 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 168 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 169 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 170 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 171 | SOFTWARE. 172 | -------------------------------------------------------------------------------- /auto-benchmark-plugin/.gitignore: -------------------------------------------------------------------------------- 1 | .gradle 2 | build/ 3 | !gradle/wrapper/gradle-wrapper.jar 4 | !**/src/main/**/build/ 5 | !**/src/test/**/build/ 6 | 7 | ### IntelliJ IDEA ### 8 | /.idea/ 9 | *.iws 10 | *.iml 11 | *.ipr 12 | out/ 13 | !**/src/main/**/out/ 14 | !**/src/test/**/out/ 15 | 16 | ### Mac OS ### 17 | .DS_Store 18 | -------------------------------------------------------------------------------- /auto-benchmark-plugin/build.gradle.kts: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023 Autobenchmark Contributors 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | plugins { 26 | id("org.jetbrains.kotlin.jvm") version "1.8.10" apply false 27 | id("com.gradle.plugin-publish") version "1.1.0" apply false 28 | } 29 | 30 | allprojects { 31 | group = property("GROUP").toString() 32 | version = property("VERSION").toString() 33 | } 34 | 35 | tasks.register("clean", Delete::class.java) { 36 | delete(rootProject.buildDir) 37 | } 38 | 39 | tasks.wrapper { 40 | distributionType = Wrapper.DistributionType.ALL 41 | } 42 | -------------------------------------------------------------------------------- /auto-benchmark-plugin/gradle.properties: -------------------------------------------------------------------------------- 1 | # 2 | # MIT License 3 | # 4 | # Copyright (c) 2023 Autobenchmark Contributors 5 | # 6 | # Permission is hereby granted, free of charge, to any person obtaining a copy 7 | # of this software and associated documentation files (the "Software"), to deal 8 | # in the Software without restriction, including without limitation the rights 9 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | # copies of the Software, and to permit persons to whom the Software is 11 | # furnished to do so, subject to the following conditions: 12 | # 13 | # The above copyright notice and this permission notice shall be included in all 14 | # copies or substantial portions of the Software. 15 | # 16 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | # SOFTWARE. 23 | # 24 | 25 | ID=io.github.sagar-viradiya.autobenchmark 26 | VERSION=1.0.0-alpha02 27 | GROUP=io.github.sagar-viradiya 28 | DISPLAY_NAME=Auto Benchmark 29 | DESCRIPTION=Automate baseline profile on CI by running benchmark instrumentation tests on Firebase test lab and verifying benchmark result. 30 | IMPLEMENTATION_CLASS=io.github.sagar.auto_benchmark_plugin.AutoBenchmarkPlugin 31 | kotlin.code.style=official 32 | WEBSITE=https://github.com/sagar-viradiya/auto-benchmark 33 | VCS_URL=https://github.com/sagar-viradiya/auto-benchmark 34 | -------------------------------------------------------------------------------- /auto-benchmark-plugin/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sagar-viradiya/auto-benchmark/809b1a227306d4fc3aba98d2235727bf7ef441ca/auto-benchmark-plugin/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /auto-benchmark-plugin/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | # 2 | # MIT License 3 | # 4 | # Copyright (c) 2023 Autobenchmark Contributors 5 | # 6 | # Permission is hereby granted, free of charge, to any person obtaining a copy 7 | # of this software and associated documentation files (the "Software"), to deal 8 | # in the Software without restriction, including without limitation the rights 9 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | # copies of the Software, and to permit persons to whom the Software is 11 | # furnished to do so, subject to the following conditions: 12 | # 13 | # The above copyright notice and this permission notice shall be included in all 14 | # copies or substantial portions of the Software. 15 | # 16 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | # SOFTWARE. 23 | # 24 | 25 | distributionBase=GRADLE_USER_HOME 26 | distributionPath=wrapper/dists 27 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip 28 | zipStoreBase=GRADLE_USER_HOME 29 | zipStorePath=wrapper/dists 30 | -------------------------------------------------------------------------------- /auto-benchmark-plugin/gradlew: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # 4 | # Copyright © 2015-2021 the original authors. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # https://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | ############################################################################## 20 | # 21 | # Gradle start up script for POSIX generated by Gradle. 22 | # 23 | # Important for running: 24 | # 25 | # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is 26 | # noncompliant, but you have some other compliant shell such as ksh or 27 | # bash, then to run this script, type that shell name before the whole 28 | # command line, like: 29 | # 30 | # ksh Gradle 31 | # 32 | # Busybox and similar reduced shells will NOT work, because this script 33 | # requires all of these POSIX shell features: 34 | # * functions; 35 | # * expansions «$var», «${var}», «${var:-default}», «${var+SET}», 36 | # «${var#prefix}», «${var%suffix}», and «$( cmd )»; 37 | # * compound commands having a testable exit status, especially «case»; 38 | # * various built-in commands including «command», «set», and «ulimit». 39 | # 40 | # Important for patching: 41 | # 42 | # (2) This script targets any POSIX shell, so it avoids extensions provided 43 | # by Bash, Ksh, etc; in particular arrays are avoided. 44 | # 45 | # The "traditional" practice of packing multiple parameters into a 46 | # space-separated string is a well documented source of bugs and security 47 | # problems, so this is (mostly) avoided, by progressively accumulating 48 | # options in "$@", and eventually passing that to Java. 49 | # 50 | # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, 51 | # and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; 52 | # see the in-line comments for details. 53 | # 54 | # There are tweaks for specific operating systems such as AIX, CygWin, 55 | # Darwin, MinGW, and NonStop. 56 | # 57 | # (3) This script is generated from the Groovy template 58 | # https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt 59 | # within the Gradle project. 60 | # 61 | # You can find Gradle at https://github.com/gradle/gradle/. 62 | # 63 | ############################################################################## 64 | 65 | # Attempt to set APP_HOME 66 | 67 | # Resolve links: $0 may be a link 68 | app_path=$0 69 | 70 | # Need this for daisy-chained symlinks. 71 | while 72 | APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path 73 | [ -h "$app_path" ] 74 | do 75 | ls=$( ls -ld "$app_path" ) 76 | link=${ls#*' -> '} 77 | case $link in #( 78 | /*) app_path=$link ;; #( 79 | *) app_path=$APP_HOME$link ;; 80 | esac 81 | done 82 | 83 | APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit 84 | 85 | APP_NAME="Gradle" 86 | APP_BASE_NAME=${0##*/} 87 | 88 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 89 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 90 | 91 | # Use the maximum available, or set MAX_FD != -1 to use that value. 92 | MAX_FD=maximum 93 | 94 | warn () { 95 | echo "$*" 96 | } >&2 97 | 98 | die () { 99 | echo 100 | echo "$*" 101 | echo 102 | exit 1 103 | } >&2 104 | 105 | # OS specific support (must be 'true' or 'false'). 106 | cygwin=false 107 | msys=false 108 | darwin=false 109 | nonstop=false 110 | case "$( uname )" in #( 111 | CYGWIN* ) cygwin=true ;; #( 112 | Darwin* ) darwin=true ;; #( 113 | MSYS* | MINGW* ) msys=true ;; #( 114 | NONSTOP* ) nonstop=true ;; 115 | esac 116 | 117 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 118 | 119 | 120 | # Determine the Java command to use to start the JVM. 121 | if [ -n "$JAVA_HOME" ] ; then 122 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 123 | # IBM's JDK on AIX uses strange locations for the executables 124 | JAVACMD=$JAVA_HOME/jre/sh/java 125 | else 126 | JAVACMD=$JAVA_HOME/bin/java 127 | fi 128 | if [ ! -x "$JAVACMD" ] ; then 129 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 130 | 131 | Please set the JAVA_HOME variable in your environment to match the 132 | location of your Java installation." 133 | fi 134 | else 135 | JAVACMD=java 136 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 137 | 138 | Please set the JAVA_HOME variable in your environment to match the 139 | location of your Java installation." 140 | fi 141 | 142 | # Increase the maximum file descriptors if we can. 143 | if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then 144 | case $MAX_FD in #( 145 | max*) 146 | MAX_FD=$( ulimit -H -n ) || 147 | warn "Could not query maximum file descriptor limit" 148 | esac 149 | case $MAX_FD in #( 150 | '' | soft) :;; #( 151 | *) 152 | ulimit -n "$MAX_FD" || 153 | warn "Could not set maximum file descriptor limit to $MAX_FD" 154 | esac 155 | fi 156 | 157 | # Collect all arguments for the java command, stacking in reverse order: 158 | # * args from the command line 159 | # * the main class name 160 | # * -classpath 161 | # * -D...appname settings 162 | # * --module-path (only if needed) 163 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. 164 | 165 | # For Cygwin or MSYS, switch paths to Windows format before running java 166 | if "$cygwin" || "$msys" ; then 167 | APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) 168 | CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) 169 | 170 | JAVACMD=$( cygpath --unix "$JAVACMD" ) 171 | 172 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 173 | for arg do 174 | if 175 | case $arg in #( 176 | -*) false ;; # don't mess with options #( 177 | /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath 178 | [ -e "$t" ] ;; #( 179 | *) false ;; 180 | esac 181 | then 182 | arg=$( cygpath --path --ignore --mixed "$arg" ) 183 | fi 184 | # Roll the args list around exactly as many times as the number of 185 | # args, so each arg winds up back in the position where it started, but 186 | # possibly modified. 187 | # 188 | # NB: a `for` loop captures its iteration list before it begins, so 189 | # changing the positional parameters here affects neither the number of 190 | # iterations, nor the values presented in `arg`. 191 | shift # remove old arg 192 | set -- "$@" "$arg" # push replacement arg 193 | done 194 | fi 195 | 196 | # Collect all arguments for the java command; 197 | # * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of 198 | # shell script including quotes and variable substitutions, so put them in 199 | # double quotes to make sure that they get re-expanded; and 200 | # * put everything else in single quotes, so that it's not re-expanded. 201 | 202 | set -- \ 203 | "-Dorg.gradle.appname=$APP_BASE_NAME" \ 204 | -classpath "$CLASSPATH" \ 205 | org.gradle.wrapper.GradleWrapperMain \ 206 | "$@" 207 | 208 | # Use "xargs" to parse quoted args. 209 | # 210 | # With -n1 it outputs one arg per line, with the quotes and backslashes removed. 211 | # 212 | # In Bash we could simply go: 213 | # 214 | # readarray ARGS < <( xargs -n1 <<<"$var" ) && 215 | # set -- "${ARGS[@]}" "$@" 216 | # 217 | # but POSIX shell has neither arrays nor command substitution, so instead we 218 | # post-process each arg (as a line of input to sed) to backslash-escape any 219 | # character that might be a shell metacharacter, then use eval to reverse 220 | # that process (while maintaining the separation between arguments), and wrap 221 | # the whole thing up as a single "set" statement. 222 | # 223 | # This will of course break if any of these variables contains a newline or 224 | # an unmatched quote. 225 | # 226 | 227 | eval "set -- $( 228 | printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | 229 | xargs -n1 | 230 | sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | 231 | tr '\n' ' ' 232 | )" '"$@"' 233 | 234 | exec "$JAVACMD" "$@" 235 | -------------------------------------------------------------------------------- /auto-benchmark-plugin/gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%" == "" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%" == "" set DIRNAME=. 29 | set APP_BASE_NAME=%~n0 30 | set APP_HOME=%DIRNAME% 31 | 32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 34 | 35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 37 | 38 | @rem Find java.exe 39 | if defined JAVA_HOME goto findJavaFromJavaHome 40 | 41 | set JAVA_EXE=java.exe 42 | %JAVA_EXE% -version >NUL 2>&1 43 | if "%ERRORLEVEL%" == "0" goto execute 44 | 45 | echo. 46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 47 | echo. 48 | echo Please set the JAVA_HOME variable in your environment to match the 49 | echo location of your Java installation. 50 | 51 | goto fail 52 | 53 | :findJavaFromJavaHome 54 | set JAVA_HOME=%JAVA_HOME:"=% 55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 56 | 57 | if exist "%JAVA_EXE%" goto execute 58 | 59 | echo. 60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 61 | echo. 62 | echo Please set the JAVA_HOME variable in your environment to match the 63 | echo location of your Java installation. 64 | 65 | goto fail 66 | 67 | :execute 68 | @rem Setup the command line 69 | 70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 71 | 72 | 73 | @rem Execute Gradle 74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 75 | 76 | :end 77 | @rem End local scope for the variables with windows NT shell 78 | if "%ERRORLEVEL%"=="0" goto mainEnd 79 | 80 | :fail 81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 82 | rem the _cmd.exe /c_ return code! 83 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 84 | exit /b 1 85 | 86 | :mainEnd 87 | if "%OS%"=="Windows_NT" endlocal 88 | 89 | :omega 90 | -------------------------------------------------------------------------------- /auto-benchmark-plugin/plugin/.gitignore: -------------------------------------------------------------------------------- 1 | .gradle 2 | build/ 3 | !gradle/wrapper/gradle-wrapper.jar 4 | !**/src/main/**/build/ 5 | !**/src/test/**/build/ 6 | 7 | ### IntelliJ IDEA ### 8 | .idea/modules.xml 9 | .idea/jarRepositories.xml 10 | .idea/compiler.xml 11 | .idea/libraries/ 12 | *.iws 13 | *.iml 14 | *.ipr 15 | out/ 16 | !**/src/main/**/out/ 17 | !**/src/test/**/out/ 18 | 19 | ### Mac OS ### 20 | .DS_Store 21 | -------------------------------------------------------------------------------- /auto-benchmark-plugin/plugin/build.gradle.kts: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023 Autobenchmark Contributors 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | @file:Suppress("UnstableApiUsage") 26 | 27 | import org.jetbrains.kotlin.gradle.tasks.KotlinCompile 28 | 29 | plugins { 30 | id("org.jetbrains.kotlin.jvm") 31 | `kotlin-dsl` 32 | `java-gradle-plugin` 33 | id("com.gradle.plugin-publish") 34 | } 35 | 36 | dependencies { 37 | compileOnly(gradleApi()) 38 | compileOnly(kotlin("stdlib")) 39 | compileOnly("com.android.tools.build:gradle:8.0.0") 40 | compileOnly("org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.10") 41 | implementation("com.osacky.flank.gradle:fladle:0.17.4") 42 | testImplementation(platform("org.junit:junit-bom:5.9.1")) 43 | testImplementation("org.junit.jupiter:junit-jupiter") 44 | } 45 | 46 | java { 47 | sourceCompatibility = JavaVersion.VERSION_11 48 | targetCompatibility = JavaVersion.VERSION_11 49 | } 50 | 51 | tasks.withType { 52 | kotlinOptions { 53 | jvmTarget = JavaVersion.VERSION_11.toString() 54 | } 55 | } 56 | 57 | tasks.test { 58 | useJUnitPlatform() 59 | } 60 | 61 | gradlePlugin { 62 | website.set(property("WEBSITE").toString()) 63 | vcsUrl.set(property("VCS_URL").toString()) 64 | plugins { 65 | create(property("ID").toString()) { 66 | id = property("ID").toString() 67 | implementationClass = property("IMPLEMENTATION_CLASS").toString() 68 | version = property("VERSION").toString() 69 | description = property("DESCRIPTION").toString() 70 | displayName = property("DISPLAY_NAME").toString() 71 | tags.set(listOf("macro-benchmark", "android", "baseline profile")) 72 | } 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /auto-benchmark-plugin/plugin/src/main/kotlin/io.github.sagar.auto_benchmark_plugin/AutoBenchmarkExtension.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023 Autobenchmark Contributors 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package io.github.sagar.auto_benchmark_plugin 26 | 27 | import org.gradle.api.Project 28 | import org.gradle.api.provider.MapProperty 29 | import org.gradle.api.provider.Property 30 | import org.gradle.kotlin.dsl.create 31 | 32 | interface AutoBenchmarkExtension { 33 | 34 | /** 35 | * A file path to app apk under benchmark 36 | */ 37 | val appApkFilePath: Property 38 | 39 | /** 40 | * A file path to benchmark apk 41 | */ 42 | val benchmarkApkFilePath: Property 43 | 44 | /** 45 | * Service account JSON file path to authenticate GCloud 46 | */ 47 | val serviceAccountJsonFilePath: Property 48 | 49 | /** 50 | * Physical device configuration map to run benchmark 51 | */ 52 | val physicalDevices: MapProperty 53 | 54 | /** 55 | * Tolerance percentage for improvement below which verification will fail 56 | */ 57 | val tolerancePercentage: Property 58 | 59 | companion object { 60 | private const val NAME = "autoBenchmark" 61 | 62 | /** 63 | * Creates a extension of type [AutoBenchmarkExtension] and returns 64 | */ 65 | fun create(target: Project) = target.extensions.create(NAME) 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /auto-benchmark-plugin/plugin/src/main/kotlin/io.github.sagar.auto_benchmark_plugin/AutoBenchmarkPlugin.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023 Autobenchmark Contributors 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package io.github.sagar.auto_benchmark_plugin 26 | 27 | import com.android.build.api.variant.AndroidComponentsExtension 28 | import com.osacky.flank.gradle.FlankGradleExtension 29 | import org.gradle.api.Plugin 30 | import org.gradle.api.Project 31 | import java.io.File 32 | 33 | class AutoBenchmarkPlugin : Plugin { 34 | companion object { 35 | private const val TASK_NAME = "runBenchmarkAndVerifyProfile" 36 | private const val FLADLE_CONFIG_NAME = "autoBenchmark" 37 | private const val LOCAL_RESULT_DIR = "benchmark_result" 38 | private const val FLADLE_TASK_NAME = "runFlankAutoBenchmark" 39 | private const val ADDITIONAL_TEST_OUTPUT_DIR = "/sdcard/Download/" 40 | private const val ENV_ADDITIONAL_TEST_OUTPUT_KEY = "additionalTestOutputDir" 41 | private const val ENV_ADDITIONAL_NO_ISOLATION_KEY = "no-isolated-storage" 42 | private const val ENV_ADDITIONAL_NO_ISOLATION_VALUE = "true" 43 | private const val PLUGIN_APPLY_ERROR_MESSAGE = "This plugin is only applicable for Android modules" 44 | } 45 | 46 | override fun apply(project: Project) { 47 | // Apply fladle plugin as dependency 48 | project.pluginManager.apply("com.osacky.fladle") 49 | 50 | // Fail if plugin is not applied to android app module 51 | runCatching { 52 | project.extensions.getByType(AndroidComponentsExtension::class.java) 53 | }.getOrElse { error(PLUGIN_APPLY_ERROR_MESSAGE) } 54 | 55 | // Get the extensions 56 | val extension = AutoBenchmarkExtension.create(project) 57 | 58 | // Register Fladle configuration to run tests on firebase test lab and download benchmark result 59 | configureFladle(project, extension) 60 | // Register task to verify downloaded benchmark result 61 | setupMacroBenchmarkVerificationTask(project, extension) 62 | } 63 | 64 | /** 65 | * Adds a fladle configuration to be executed for uploading apks to Firebase test lab. 66 | * Also, configures custom test output directory and download directory from G-Cloud. 67 | * 68 | * @param project An instance of gradle project 69 | * @param extension An instance of [AutoBenchmarkExtension] 70 | */ 71 | private fun configureFladle(project: Project, extension: AutoBenchmarkExtension) { 72 | project.extensions.configure(FlankGradleExtension::class.java) { 73 | configs.register(FLADLE_CONFIG_NAME) { 74 | with(this@configure) { 75 | flakyTestAttempts.set(1) 76 | localResultsDir.set(LOCAL_RESULT_DIR) 77 | performanceMetrics.set(false) 78 | disableSharding.set(true) 79 | devices.set( 80 | listOf( 81 | extension.physicalDevices.get() 82 | ) 83 | ) 84 | serviceAccountCredentials.set(File(extension.serviceAccountJsonFilePath.get())) 85 | } 86 | 87 | apply { 88 | filesToDownload.set(listOf(".*$ADDITIONAL_TEST_OUTPUT_DIR.*")) 89 | directoriesToPull.set(listOf(ADDITIONAL_TEST_OUTPUT_DIR)) 90 | debugApk.set(project.provider { "${project.rootDir.path}${extension.appApkFilePath.get()}" }) 91 | instrumentationApk.set(project.provider { 92 | "${project.rootDir.path}${extension.benchmarkApkFilePath.get()}" 93 | }) 94 | environmentVariables.set( 95 | mapOf( 96 | ENV_ADDITIONAL_TEST_OUTPUT_KEY to ADDITIONAL_TEST_OUTPUT_DIR, 97 | ENV_ADDITIONAL_NO_ISOLATION_KEY to ENV_ADDITIONAL_NO_ISOLATION_VALUE 98 | ) 99 | ) 100 | } 101 | } 102 | } 103 | } 104 | 105 | /** 106 | * Register a task for benchmark result verification. 107 | * This task depends on fladle task created above to run tests on firebase test lab and download result. 108 | * 109 | * @param project An instance of gradle project 110 | * @param extension An instance of [AutoBenchmarkExtension] 111 | */ 112 | private fun setupMacroBenchmarkVerificationTask(project: Project, extension: AutoBenchmarkExtension) { 113 | project.tasks.register( 114 | TASK_NAME, 115 | BenchmarkJsonParserTask::class.java 116 | ) { 117 | buildDirectory.set(project.buildDir) 118 | tolerancePercentage.set(extension.tolerancePercentage) 119 | dependsOn(FLADLE_TASK_NAME) 120 | } 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /auto-benchmark-plugin/plugin/src/main/kotlin/io.github.sagar.auto_benchmark_plugin/BenchmarkJsonParserTask.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023 Autobenchmark Contributors 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package io.github.sagar.auto_benchmark_plugin 26 | 27 | import groovy.json.JsonSlurper 28 | import org.gradle.api.DefaultTask 29 | import org.gradle.api.GradleException 30 | import org.gradle.api.file.DirectoryProperty 31 | import org.gradle.api.provider.Property 32 | import org.gradle.api.tasks.Input 33 | import org.gradle.api.tasks.InputDirectory 34 | import org.gradle.api.tasks.TaskAction 35 | import java.math.BigDecimal 36 | 37 | abstract class BenchmarkJsonParserTask : DefaultTask() { 38 | 39 | @get: InputDirectory 40 | abstract val buildDirectory: DirectoryProperty 41 | 42 | @get: Input 43 | abstract val tolerancePercentage: Property 44 | 45 | @TaskAction 46 | @Suppress("UNCHECKED_CAST") 47 | fun execute() { 48 | val jsonFile = buildDirectory.dir("fladle/benchmark_result").get().asFileTree.filter { file -> 49 | file.name.contains("benchmarkData") 50 | }.singleFile 51 | val json: Map = JsonSlurper().parse(jsonFile) as Map 52 | val benchmarkResult: List> = json["benchmarks"] as List> 53 | var noCompilationMedian = BigDecimal(0) 54 | var baselineProfileMedian = BigDecimal(0) 55 | benchmarkResult.forEach { benchmark -> 56 | if (benchmark["name"].toString().contains("NoCompilation", true)) { 57 | noCompilationMedian = 58 | ((benchmark["metrics"] as Map)["timeToInitialDisplayMs"] as Map)["median"] as BigDecimal 59 | } 60 | 61 | if (benchmark["name"].toString().contains("BaselineProfile", true)) { 62 | baselineProfileMedian = 63 | ((benchmark["metrics"] as Map)["timeToInitialDisplayMs"] as Map)["median"] as BigDecimal 64 | } 65 | } 66 | 67 | if (noCompilationMedian <= baselineProfileMedian) { 68 | throw GradleException("Negative improvements : No compilation mode is better than baseline profile based compilation") 69 | } 70 | 71 | println("No compilation median : $noCompilationMedian") 72 | println("Baseline profile median : $baselineProfileMedian") 73 | val improvement = ((noCompilationMedian - baselineProfileMedian) / noCompilationMedian) * BigDecimal(100) 74 | println("Improvement percentage : $improvement") 75 | if (improvement < BigDecimal(tolerancePercentage.get().toDouble())) { 76 | throw GradleException("Improvement is below tolerance percentage, time to check baseline profile") 77 | } 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /auto-benchmark-plugin/settings.gradle.kts: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023 Autobenchmark Contributors 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | pluginManagement { 26 | repositories { 27 | google() 28 | mavenCentral() 29 | gradlePluginPortal() 30 | } 31 | } 32 | dependencyResolutionManagement { 33 | repositories { 34 | google() 35 | mavenCentral() 36 | } 37 | } 38 | 39 | rootProject.name = "auto-benchmark-plugin" 40 | include(":plugin") 41 | -------------------------------------------------------------------------------- /baseline-profile/.gitignore: -------------------------------------------------------------------------------- 1 | /build -------------------------------------------------------------------------------- /baseline-profile/build.gradle.kts: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023 Autobenchmark Contributors 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | import com.android.build.api.dsl.ManagedVirtualDevice 26 | 27 | plugins { 28 | id("com.android.test") 29 | id("androidx.baselineprofile") 30 | id("org.jetbrains.kotlin.android") 31 | } 32 | 33 | android { 34 | namespace = "io.github.sagar.baseline_profile" 35 | compileSdk = 34 36 | 37 | defaultConfig { 38 | minSdk = 24 39 | testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" 40 | } 41 | 42 | targetProjectPath = ":sample" 43 | 44 | compileOptions { 45 | sourceCompatibility = JavaVersion.VERSION_11 46 | targetCompatibility = JavaVersion.VERSION_11 47 | } 48 | kotlinOptions { 49 | jvmTarget = "11" 50 | } 51 | 52 | testOptions { 53 | managedDevices { 54 | devices { 55 | create ("pixel6Api33", ManagedVirtualDevice::class) { 56 | device = "Pixel 6" 57 | apiLevel = 33 58 | systemImageSource = "aosp" 59 | } 60 | } 61 | } 62 | } 63 | } 64 | 65 | dependencies { 66 | implementation("androidx.test.ext:junit:1.1.5") 67 | implementation("androidx.test.espresso:espresso-core:3.5.1") 68 | implementation("androidx.test.uiautomator:uiautomator:2.2.0") 69 | implementation("androidx.benchmark:benchmark-macro-junit4:1.2.0") 70 | } 71 | 72 | baselineProfile { 73 | managedDevices += "pixel6Api33" 74 | useConnectedDevices = false 75 | } 76 | -------------------------------------------------------------------------------- /baseline-profile/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /baseline-profile/src/main/java/io/github/sagar/baseline_profile/AutoBenchmarkSampleBaselineProfileGenerator.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023 Autobenchmark Contributors 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package io.github.sagar.baseline_profile 26 | 27 | import androidx.benchmark.macro.junit4.BaselineProfileRule 28 | import org.junit.Rule 29 | import org.junit.Test 30 | 31 | class AutoBenchmarkSampleBaselineProfileGenerator { 32 | 33 | @get:Rule 34 | val baselineProfileRule = BaselineProfileRule() 35 | 36 | @Test 37 | fun startup(): Unit = baselineProfileRule.collect( 38 | packageName = "io.github.sagar.auto_benchmark", 39 | profileBlock = { 40 | startActivityAndWait() 41 | } 42 | ) 43 | } -------------------------------------------------------------------------------- /benchmark/.gitignore: -------------------------------------------------------------------------------- 1 | /build -------------------------------------------------------------------------------- /benchmark/benchmark-rules.pro: -------------------------------------------------------------------------------- 1 | -dontobfuscate -------------------------------------------------------------------------------- /benchmark/build.gradle.kts: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023 Autobenchmark Contributors 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | plugins { 26 | id("com.android.test") 27 | id("org.jetbrains.kotlin.android") 28 | } 29 | 30 | android { 31 | namespace = "io.github.sagar.benchmark" 32 | compileSdk = 34 33 | 34 | compileOptions { 35 | sourceCompatibility = JavaVersion.VERSION_11 36 | targetCompatibility = JavaVersion.VERSION_11 37 | } 38 | 39 | kotlinOptions { 40 | jvmTarget = "11" 41 | } 42 | 43 | defaultConfig { 44 | minSdk = 24 45 | targetSdk = 34 46 | 47 | testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" 48 | } 49 | 50 | buildTypes { 51 | create("benchmark") { 52 | isDebuggable = true 53 | signingConfig = getByName("debug").signingConfig 54 | matchingFallbacks += listOf("release") 55 | proguardFiles("benchmark-rules.pro") 56 | } 57 | } 58 | 59 | targetProjectPath = ":sample" 60 | experimentalProperties["android.experimental.self-instrumenting"] = true 61 | } 62 | 63 | dependencies { 64 | implementation("androidx.test.ext:junit:1.1.5") 65 | implementation("androidx.test.espresso:espresso-core:3.5.1") 66 | implementation("androidx.test.uiautomator:uiautomator:2.2.0") 67 | implementation("androidx.benchmark:benchmark-macro-junit4:1.2.0") 68 | } 69 | 70 | androidComponents { 71 | beforeVariants(selector().all()) { 72 | it.enable = it.buildType == "benchmark" 73 | } 74 | } -------------------------------------------------------------------------------- /benchmark/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /benchmark/src/main/java/io/github/sagar/benchmark/ExampleStartupBenchmark.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023 Autobenchmark Contributors 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package io.github.sagar.benchmark 26 | 27 | import androidx.benchmark.macro.BaselineProfileMode 28 | import androidx.benchmark.macro.CompilationMode 29 | import androidx.benchmark.macro.StartupMode 30 | import androidx.benchmark.macro.StartupTimingMetric 31 | import androidx.benchmark.macro.junit4.MacrobenchmarkRule 32 | import androidx.test.ext.junit.runners.AndroidJUnit4 33 | import org.junit.Rule 34 | import org.junit.Test 35 | import org.junit.runner.RunWith 36 | 37 | /** 38 | * This is an example startup benchmark. 39 | * 40 | * It navigates to the device's home screen, and launches the default activity. 41 | * 42 | * Before running this benchmark: 43 | * 1) switch your app's active build variant in the Studio (affects Studio runs only) 44 | * 2) add `` to your app's manifest, within the `` tag 45 | * 46 | * Run this benchmark from Studio to see startup measurements, and captured system traces 47 | * for investigating your app's performance. 48 | */ 49 | @RunWith(AndroidJUnit4::class) 50 | class ExampleStartupBenchmark { 51 | @get:Rule 52 | val benchmarkRule = MacrobenchmarkRule() 53 | 54 | @Test 55 | fun startupNoCompilation() = startup(CompilationMode.None()) 56 | 57 | @Test 58 | fun startupBaselineProfile() = startup(CompilationMode.Partial(BaselineProfileMode.Require)) 59 | 60 | @Test 61 | fun startupFullCompilation() = startup(CompilationMode.Full()) 62 | 63 | 64 | private fun startup(compilationMode: CompilationMode) = benchmarkRule.measureRepeated( 65 | packageName = "io.github.sagar.auto_benchmark", 66 | metrics = listOf(StartupTimingMetric()), 67 | compilationMode = compilationMode, 68 | iterations = 5, 69 | startupMode = StartupMode.COLD 70 | ) { 71 | pressHome() 72 | startActivityAndWait() 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /build.gradle.kts: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023 Autobenchmark Contributors 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | plugins { 26 | id("com.android.application") version "8.2.0-beta05" apply false 27 | id("org.jetbrains.kotlin.android") version "1.8.10" apply false 28 | id("com.android.test") version "8.2.0-beta05" apply false 29 | id("androidx.baselineprofile") version "1.2.0-alpha16" apply false 30 | } 31 | 32 | tasks.register("clean", Delete::class.java) { 33 | delete(rootProject.buildDir) 34 | } 35 | 36 | tasks.wrapper { 37 | distributionType = Wrapper.DistributionType.ALL 38 | } 39 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # 2 | # MIT License 3 | # 4 | # Copyright (c) 2023 Autobenchmark Contributors 5 | # 6 | # Permission is hereby granted, free of charge, to any person obtaining a copy 7 | # of this software and associated documentation files (the "Software"), to deal 8 | # in the Software without restriction, including without limitation the rights 9 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | # copies of the Software, and to permit persons to whom the Software is 11 | # furnished to do so, subject to the following conditions: 12 | # 13 | # The above copyright notice and this permission notice shall be included in all 14 | # copies or substantial portions of the Software. 15 | # 16 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | # SOFTWARE. 23 | # 24 | 25 | # Project-wide Gradle settings. 26 | # IDE (e.g. Android Studio) users: 27 | # Gradle settings configured through the IDE *will override* 28 | # any settings specified in this file. 29 | # For more details on how to configure your build environment visit 30 | # http://www.gradle.org/docs/current/userguide/build_environment.html 31 | # Specifies the JVM arguments used for the daemon process. 32 | # The setting is particularly useful for tweaking memory settings. 33 | org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 34 | # When configured, Gradle will run in incubating parallel mode. 35 | # This option should only be used with decoupled projects. More details, visit 36 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 37 | # org.gradle.parallel=true 38 | # AndroidX package structure to make it clearer which packages are bundled with the 39 | # Android operating system, and which are packaged with your app's APK 40 | # https://developer.android.com/topic/libraries/support-library/androidx-rn 41 | android.useAndroidX=true 42 | # Kotlin code style for this project: "official" or "obsolete": 43 | kotlin.code.style=official 44 | # Enables namespacing of each library's R class so that its R class includes only the 45 | # resources declared in the library itself and none from the library's dependencies, 46 | # thereby reducing the size of the R class for that library 47 | android.nonTransitiveRClass=true 48 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sagar-viradiya/auto-benchmark/809b1a227306d4fc3aba98d2235727bf7ef441ca/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | # 2 | # MIT License 3 | # 4 | # Copyright (c) 2023 Autobenchmark Contributors 5 | # 6 | # Permission is hereby granted, free of charge, to any person obtaining a copy 7 | # of this software and associated documentation files (the "Software"), to deal 8 | # in the Software without restriction, including without limitation the rights 9 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | # copies of the Software, and to permit persons to whom the Software is 11 | # furnished to do so, subject to the following conditions: 12 | # 13 | # The above copyright notice and this permission notice shall be included in all 14 | # copies or substantial portions of the Software. 15 | # 16 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | # SOFTWARE. 23 | # 24 | 25 | #Sat Jul 15 19:58:19 CEST 2023 26 | distributionBase=GRADLE_USER_HOME 27 | distributionPath=wrapper/dists 28 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip 29 | zipStoreBase=GRADLE_USER_HOME 30 | zipStorePath=wrapper/dists 31 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # 4 | # Copyright 2015 the original author or authors. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # https://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | ############################################################################## 20 | ## 21 | ## Gradle start up script for UN*X 22 | ## 23 | ############################################################################## 24 | 25 | # Attempt to set APP_HOME 26 | # Resolve links: $0 may be a link 27 | PRG="$0" 28 | # Need this for relative symlinks. 29 | while [ -h "$PRG" ] ; do 30 | ls=`ls -ld "$PRG"` 31 | link=`expr "$ls" : '.*-> \(.*\)$'` 32 | if expr "$link" : '/.*' > /dev/null; then 33 | PRG="$link" 34 | else 35 | PRG=`dirname "$PRG"`"/$link" 36 | fi 37 | done 38 | SAVED="`pwd`" 39 | cd "`dirname \"$PRG\"`/" >/dev/null 40 | APP_HOME="`pwd -P`" 41 | cd "$SAVED" >/dev/null 42 | 43 | APP_NAME="Gradle" 44 | APP_BASE_NAME=`basename "$0"` 45 | 46 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 47 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 48 | 49 | # Use the maximum available, or set MAX_FD != -1 to use that value. 50 | MAX_FD="maximum" 51 | 52 | warn () { 53 | echo "$*" 54 | } 55 | 56 | die () { 57 | echo 58 | echo "$*" 59 | echo 60 | exit 1 61 | } 62 | 63 | # OS specific support (must be 'true' or 'false'). 64 | cygwin=false 65 | msys=false 66 | darwin=false 67 | nonstop=false 68 | case "`uname`" in 69 | CYGWIN* ) 70 | cygwin=true 71 | ;; 72 | Darwin* ) 73 | darwin=true 74 | ;; 75 | MINGW* ) 76 | msys=true 77 | ;; 78 | NONSTOP* ) 79 | nonstop=true 80 | ;; 81 | esac 82 | 83 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 84 | 85 | 86 | # Determine the Java command to use to start the JVM. 87 | if [ -n "$JAVA_HOME" ] ; then 88 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 89 | # IBM's JDK on AIX uses strange locations for the executables 90 | JAVACMD="$JAVA_HOME/jre/sh/java" 91 | else 92 | JAVACMD="$JAVA_HOME/bin/java" 93 | fi 94 | if [ ! -x "$JAVACMD" ] ; then 95 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 96 | 97 | Please set the JAVA_HOME variable in your environment to match the 98 | location of your Java installation." 99 | fi 100 | else 101 | JAVACMD="java" 102 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 103 | 104 | Please set the JAVA_HOME variable in your environment to match the 105 | location of your Java installation." 106 | fi 107 | 108 | # Increase the maximum file descriptors if we can. 109 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 110 | MAX_FD_LIMIT=`ulimit -H -n` 111 | if [ $? -eq 0 ] ; then 112 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 113 | MAX_FD="$MAX_FD_LIMIT" 114 | fi 115 | ulimit -n $MAX_FD 116 | if [ $? -ne 0 ] ; then 117 | warn "Could not set maximum file descriptor limit: $MAX_FD" 118 | fi 119 | else 120 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 121 | fi 122 | fi 123 | 124 | # For Darwin, add options to specify how the application appears in the dock 125 | if $darwin; then 126 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 127 | fi 128 | 129 | # For Cygwin or MSYS, switch paths to Windows format before running java 130 | if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then 131 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 132 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 133 | 134 | JAVACMD=`cygpath --unix "$JAVACMD"` 135 | 136 | # We build the pattern for arguments to be converted via cygpath 137 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 138 | SEP="" 139 | for dir in $ROOTDIRSRAW ; do 140 | ROOTDIRS="$ROOTDIRS$SEP$dir" 141 | SEP="|" 142 | done 143 | OURCYGPATTERN="(^($ROOTDIRS))" 144 | # Add a user-defined pattern to the cygpath arguments 145 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 146 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 147 | fi 148 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 149 | i=0 150 | for arg in "$@" ; do 151 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 152 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 153 | 154 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 155 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 156 | else 157 | eval `echo args$i`="\"$arg\"" 158 | fi 159 | i=`expr $i + 1` 160 | done 161 | case $i in 162 | 0) set -- ;; 163 | 1) set -- "$args0" ;; 164 | 2) set -- "$args0" "$args1" ;; 165 | 3) set -- "$args0" "$args1" "$args2" ;; 166 | 4) set -- "$args0" "$args1" "$args2" "$args3" ;; 167 | 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 168 | 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 169 | 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 170 | 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 171 | 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 172 | esac 173 | fi 174 | 175 | # Escape application args 176 | save () { 177 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 178 | echo " " 179 | } 180 | APP_ARGS=`save "$@"` 181 | 182 | # Collect all arguments for the java command, following the shell quoting and substitution rules 183 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 184 | 185 | exec "$JAVACMD" "$@" 186 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%" == "" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%" == "" set DIRNAME=. 29 | set APP_BASE_NAME=%~n0 30 | set APP_HOME=%DIRNAME% 31 | 32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 34 | 35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 37 | 38 | @rem Find java.exe 39 | if defined JAVA_HOME goto findJavaFromJavaHome 40 | 41 | set JAVA_EXE=java.exe 42 | %JAVA_EXE% -version >NUL 2>&1 43 | if "%ERRORLEVEL%" == "0" goto execute 44 | 45 | echo. 46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 47 | echo. 48 | echo Please set the JAVA_HOME variable in your environment to match the 49 | echo location of your Java installation. 50 | 51 | goto fail 52 | 53 | :findJavaFromJavaHome 54 | set JAVA_HOME=%JAVA_HOME:"=% 55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 56 | 57 | if exist "%JAVA_EXE%" goto execute 58 | 59 | echo. 60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 61 | echo. 62 | echo Please set the JAVA_HOME variable in your environment to match the 63 | echo location of your Java installation. 64 | 65 | goto fail 66 | 67 | :execute 68 | @rem Setup the command line 69 | 70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 71 | 72 | 73 | @rem Execute Gradle 74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 75 | 76 | :end 77 | @rem End local scope for the variables with windows NT shell 78 | if "%ERRORLEVEL%"=="0" goto mainEnd 79 | 80 | :fail 81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 82 | rem the _cmd.exe /c_ return code! 83 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 84 | exit /b 1 85 | 86 | :mainEnd 87 | if "%OS%"=="Windows_NT" endlocal 88 | 89 | :omega 90 | -------------------------------------------------------------------------------- /sample/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /sample/build.gradle.kts: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023 Autobenchmark Contributors 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | @file:Suppress("UnstableApiUsage") 26 | 27 | plugins { 28 | id("com.android.application") 29 | id("org.jetbrains.kotlin.android") 30 | id("androidx.baselineprofile") 31 | id("io.github.sagar-viradiya.autobenchmark") 32 | } 33 | 34 | android { 35 | namespace = "io.github.sagar.auto_benchmark" 36 | compileSdk = 34 37 | 38 | defaultConfig { 39 | applicationId = "io.github.sagar.auto_benchmark" 40 | minSdk = 24 41 | targetSdk = 34 42 | versionCode = 1 43 | versionName = "1.0" 44 | 45 | testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" 46 | } 47 | 48 | buildTypes { 49 | release { 50 | isMinifyEnabled = false 51 | proguardFiles( 52 | getDefaultProguardFile("proguard-android-optimize.txt"), 53 | "proguard-rules.pro" 54 | ) 55 | } 56 | create("benchmark") { 57 | initWith(buildTypes.getByName("release")) 58 | signingConfig = signingConfigs.getByName("debug") 59 | matchingFallbacks += listOf("release") 60 | isDebuggable = false 61 | } 62 | } 63 | 64 | buildFeatures { 65 | compose = true 66 | } 67 | 68 | composeOptions { 69 | kotlinCompilerExtensionVersion = "1.4.3" 70 | } 71 | 72 | compileOptions { 73 | sourceCompatibility = JavaVersion.VERSION_11 74 | targetCompatibility = JavaVersion.VERSION_11 75 | } 76 | kotlinOptions { 77 | jvmTarget = "11" 78 | } 79 | } 80 | 81 | dependencies { 82 | implementation("androidx.appcompat:appcompat:1.4.1") 83 | implementation("com.google.android.material:material:1.5.0") 84 | implementation(platform("androidx.compose:compose-bom:2023.06.01")) 85 | implementation("androidx.compose.ui:ui") 86 | implementation("androidx.compose.material:material") 87 | implementation("androidx.compose.ui:ui-tooling-preview") 88 | implementation("androidx.activity:activity-compose") 89 | implementation("androidx.profileinstaller:profileinstaller:1.3.1") 90 | 91 | baselineProfile(project(":baseline-profile")) 92 | } 93 | 94 | autoBenchmark { 95 | appApkFilePath.set("/sample/build/outputs/apk/benchmark/sample-benchmark.apk") 96 | benchmarkApkFilePath.set("/benchmark/build/outputs/apk/benchmark/benchmark-benchmark.apk") 97 | serviceAccountJsonFilePath.set("../../../../.config/gcloud/application_default_credentials.json") 98 | physicalDevices.set(mapOf( 99 | "model" to "redfin", "version" to "30" 100 | )) 101 | tolerancePercentage.set(5f) 102 | } 103 | -------------------------------------------------------------------------------- /sample/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle.kts. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /sample/src/androidTest/java/io/github/sagar/auto_benchmark/ExampleInstrumentedTest.kt: -------------------------------------------------------------------------------- 1 | package io.github.sagar.auto_benchmark 2 | 3 | import androidx.test.platform.app.InstrumentationRegistry 4 | import androidx.test.ext.junit.runners.AndroidJUnit4 5 | 6 | import org.junit.Test 7 | import org.junit.runner.RunWith 8 | 9 | import org.junit.Assert.* 10 | 11 | /** 12 | * Instrumented test, which will execute on an Android device. 13 | * 14 | * See [testing documentation](http://d.android.com/tools/testing). 15 | */ 16 | @RunWith(AndroidJUnit4::class) 17 | class ExampleInstrumentedTest { 18 | @Test 19 | fun useAppContext() { 20 | // Context of the app under test. 21 | val appContext = InstrumentationRegistry.getInstrumentation().targetContext 22 | assertEquals("io.github.sagar.auto_benchmark", appContext.packageName) 23 | } 24 | } -------------------------------------------------------------------------------- /sample/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 25 | 26 | 28 | 29 | 36 | 37 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /sample/src/main/java/io/github/sagar/auto_benchmark/MainActivity.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023 Autobenchmark Contributors 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | package io.github.sagar.auto_benchmark 26 | 27 | import androidx.appcompat.app.AppCompatActivity 28 | import android.os.Bundle 29 | import androidx.activity.compose.setContent 30 | import androidx.compose.material.Text 31 | import androidx.compose.runtime.Composable 32 | 33 | class MainActivity : AppCompatActivity() { 34 | override fun onCreate(savedInstanceState: Bundle?) { 35 | super.onCreate(savedInstanceState) 36 | setContent { 37 | Screen() 38 | } 39 | } 40 | } 41 | 42 | @Composable 43 | fun Screen() { 44 | Text("Hello World!") 45 | } 46 | -------------------------------------------------------------------------------- /sample/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 24 | 25 | 31 | 33 | 34 | 40 | 43 | 46 | 47 | 48 | 49 | 55 | -------------------------------------------------------------------------------- /sample/src/main/res/drawable/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 25 | 26 | 32 | 34 | 36 | 38 | 40 | 42 | 44 | 46 | 48 | 50 | 52 | 54 | 56 | 58 | 60 | 62 | 64 | 66 | 68 | 70 | 72 | 74 | 76 | 78 | 80 | 82 | 84 | 86 | 88 | 90 | 92 | 94 | 96 | 98 | 99 | -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-anydpi-v33/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-hdpi/ic_launcher.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sagar-viradiya/auto-benchmark/809b1a227306d4fc3aba98d2235727bf7ef441ca/sample/src/main/res/mipmap-hdpi/ic_launcher.webp -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-hdpi/ic_launcher_round.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sagar-viradiya/auto-benchmark/809b1a227306d4fc3aba98d2235727bf7ef441ca/sample/src/main/res/mipmap-hdpi/ic_launcher_round.webp -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-mdpi/ic_launcher.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sagar-viradiya/auto-benchmark/809b1a227306d4fc3aba98d2235727bf7ef441ca/sample/src/main/res/mipmap-mdpi/ic_launcher.webp -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-mdpi/ic_launcher_round.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sagar-viradiya/auto-benchmark/809b1a227306d4fc3aba98d2235727bf7ef441ca/sample/src/main/res/mipmap-mdpi/ic_launcher_round.webp -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-xhdpi/ic_launcher.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sagar-viradiya/auto-benchmark/809b1a227306d4fc3aba98d2235727bf7ef441ca/sample/src/main/res/mipmap-xhdpi/ic_launcher.webp -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-xhdpi/ic_launcher_round.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sagar-viradiya/auto-benchmark/809b1a227306d4fc3aba98d2235727bf7ef441ca/sample/src/main/res/mipmap-xhdpi/ic_launcher_round.webp -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-xxhdpi/ic_launcher.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sagar-viradiya/auto-benchmark/809b1a227306d4fc3aba98d2235727bf7ef441ca/sample/src/main/res/mipmap-xxhdpi/ic_launcher.webp -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sagar-viradiya/auto-benchmark/809b1a227306d4fc3aba98d2235727bf7ef441ca/sample/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-xxxhdpi/ic_launcher.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sagar-viradiya/auto-benchmark/809b1a227306d4fc3aba98d2235727bf7ef441ca/sample/src/main/res/mipmap-xxxhdpi/ic_launcher.webp -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sagar-viradiya/auto-benchmark/809b1a227306d4fc3aba98d2235727bf7ef441ca/sample/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp -------------------------------------------------------------------------------- /sample/src/main/res/values-night/themes.xml: -------------------------------------------------------------------------------- 1 | 24 | 25 | 26 | 27 | 40 | 41 | -------------------------------------------------------------------------------- /sample/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 25 | 26 | 27 | #FFBB86FC 28 | #FF6200EE 29 | #FF3700B3 30 | #FF03DAC5 31 | #FF018786 32 | #FF000000 33 | #FFFFFFFF 34 | 35 | -------------------------------------------------------------------------------- /sample/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 24 | 25 | 26 | auto-benchmark 27 | 28 | -------------------------------------------------------------------------------- /sample/src/main/res/values/themes.xml: -------------------------------------------------------------------------------- 1 | 24 | 25 | 26 | 27 | 40 | 41 | -------------------------------------------------------------------------------- /sample/src/main/res/xml/data_extraction_rules.xml: -------------------------------------------------------------------------------- 1 | 2 | 25 | 26 | 31 | 32 | 33 | 37 | 38 | 44 | -------------------------------------------------------------------------------- /settings.gradle.kts: -------------------------------------------------------------------------------- 1 | /* 2 | * MIT License 3 | * 4 | * Copyright (c) 2023 Autobenchmark Contributors 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | pluginManagement { 26 | repositories { 27 | google() 28 | mavenCentral() 29 | mavenLocal() 30 | gradlePluginPortal() 31 | } 32 | } 33 | dependencyResolutionManagement { 34 | repositories { 35 | google() 36 | mavenCentral() 37 | } 38 | } 39 | rootProject.name = "auto-benchmark" 40 | include(":sample") 41 | include(":benchmark") 42 | include(":baseline-profile") 43 | includeBuild("auto-benchmark-plugin") 44 | --------------------------------------------------------------------------------