-
Notifications
You must be signed in to change notification settings - Fork 246
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Split unified benchmark module to individual library benchmark modules (
#2139) * Split benchmark module to individual benchmarks in particular library modules * Removed benchmark module * Updated kokoro script to run benchmarks * spotless apply * Review comment changes
- Loading branch information
Showing
23 changed files
with
227 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Android FHIR SDK Engine Benchmark module | ||
|
||
Contains test cases that evaluate the performance of individual tasks executed for the first time directly on hardware. | ||
|
||
The test cases are designed to run in sequence of their alphabetic order to make sure larger tasks do not build cache for smaller ones. Their class names are prefixed by an extra letter to inform their position relative to others in the list. | ||
|
||
# How to run the benchmark | ||
|
||
In Android Studio, set your build variants to `release` and run your benchmark as you would any `@Test` using the gutter action next to your test class or method. | ||
|
||
![gutter test action](https://developer.android.com/static/topic/performance/images/benchmark_images/microbenchmark_run.png) | ||
|
||
The results will be similar to this: | ||
``` | ||
1,297,374 ns 5345 allocs trace EngineDatabaseBenchmark.createAndGet | ||
1,114,474,793 ns 4922289 allocs trace FhirSyncWorkerBenchmark.oneTimeSync_50patients | ||
15,251,125 ns 100542 allocs trace FhirSyncWorkerBenchmark.oneTimeSync_1patient | ||
179,806,709 ns 986017 allocs trace FhirSyncWorkerBenchmark.oneTimeSync_10patients | ||
1,451,758 ns 11883 allocs trace GzipUploadInterceptorBenchmark.upload_10patientsWithGzip | ||
1,537,559 ns 11829 allocs trace GzipUploadInterceptorBenchmark.upload_10patientsWithoutGzip | ||
73,640,833 ns 1074360 allocs trace GzipUploadInterceptorBenchmark.upload_1000patientsWithGzip | ||
7,493,642 ns 108428 allocs trace GzipUploadInterceptorBenchmark.upload_100patientsWithoutGzip | ||
7,799,264 ns 108465 allocs trace GzipUploadInterceptorBenchmark.upload_100patientsWithGzip | ||
71,189,333 ns 1074466 allocs trace GzipUploadInterceptorBenchmark.upload_1000patientsWithoutGzip | ||
``` | ||
|
||
Alternatively, from the command line, run the connectedCheck to run all of the tests from specified Gradle module: | ||
|
||
```bash | ||
./gradlew :engine:benchmark:connectedReleaseAndroidTest | ||
``` | ||
|
||
In this case, results will be saved to the `outputs/androidTest-results/connected/<device>/test-result.pb`. To visualize on Android Studio, click Run / Import Tests From File and find the `.pb` file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
import Dependencies.forceHapiVersion | ||
import Dependencies.forceJacksonVersion | ||
import Dependencies.removeIncompatibleDependencies | ||
|
||
plugins { | ||
id(Plugins.BuildPlugins.androidLib) | ||
id(Plugins.BuildPlugins.kotlinAndroid) | ||
id(Plugins.BuildPlugins.benchmark) | ||
} | ||
|
||
android { | ||
namespace = "com.google.android.fhir.benchmark" | ||
compileSdk = Sdk.compileSdk | ||
defaultConfig { | ||
minSdk = Sdk.minSdk | ||
testInstrumentationRunner = Dependencies.androidBenchmarkRunner | ||
} | ||
|
||
testBuildType = "release" | ||
buildTypes { release {} } | ||
packaging { | ||
resources.excludes.addAll( | ||
listOf( | ||
"license.html", | ||
"META-INF/ASL2.0", | ||
"META-INF/ASL-2.0.txt", | ||
"META-INF/DEPENDENCIES", | ||
"META-INF/LGPL-3.0.txt", | ||
"META-INF/LICENSE", | ||
"META-INF/LICENSE.txt", | ||
"META-INF/license.txt", | ||
"META-INF/license.html", | ||
"META-INF/LICENSE.md", | ||
"META-INF/NOTICE", | ||
"META-INF/NOTICE.txt", | ||
"META-INF/NOTICE.md", | ||
"META-INF/notice.txt", | ||
"META-INF/LGPL-3.0.txt", | ||
"META-INF/sun-jaxb.episode", | ||
"META-INF/*.kotlin_module", | ||
"readme.html", | ||
) | ||
) | ||
} | ||
kotlin { jvmToolchain(11) } | ||
compileOptions { | ||
sourceCompatibility = javaVersion | ||
targetCompatibility = javaVersion | ||
} | ||
} | ||
|
||
afterEvaluate { configureFirebaseTestLabForMicroBenchmark() } | ||
|
||
configurations { | ||
all { | ||
removeIncompatibleDependencies() | ||
forceHapiVersion() | ||
forceJacksonVersion() | ||
} | ||
} | ||
|
||
dependencies { | ||
androidTestImplementation(Dependencies.AndroidxTest.benchmarkJunit) | ||
androidTestImplementation(Dependencies.AndroidxTest.extJunit) | ||
androidTestImplementation(Dependencies.AndroidxTest.runner) | ||
androidTestImplementation(Dependencies.Cql.engineJackson) | ||
androidTestImplementation(Dependencies.Cql.evaluator) | ||
androidTestImplementation(Dependencies.Cql.evaluatorBuilder) | ||
androidTestImplementation(Dependencies.junit) | ||
androidTestImplementation(Dependencies.Kotlin.kotlinCoroutinesAndroid) | ||
androidTestImplementation(Dependencies.truth) | ||
androidTestImplementation(Dependencies.Androidx.workRuntimeKtx) | ||
androidTestImplementation(Dependencies.AndroidxTest.workTestingRuntimeKtx) | ||
androidTestImplementation(Dependencies.mockWebServer) | ||
androidTestImplementation(Dependencies.Retrofit.coreRetrofit) | ||
|
||
androidTestImplementation(project(":engine")) | ||
// for test json files only | ||
androidTestImplementation(project(":workflow-testing")) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<manifest /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Add project specific ProGuard rules here. | ||
# You can control the set of applied configuration files using the | ||
# proguardFiles setting in build.gradle. | ||
# | ||
# For more details, see | ||
# http:https://developer.android.com/guide/developing/tools/proguard.html | ||
|
||
# If your project uses WebView with JS, uncomment the following | ||
# and specify the fully qualified class name to the JavaScript interface | ||
# class: | ||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview { | ||
# public *; | ||
#} | ||
|
||
# Uncomment this to preserve the line number information for | ||
# debugging stack traces. | ||
#-keepattributes SourceFile,LineNumberTable | ||
|
||
# If you keep the line number information, uncomment this to | ||
# hide the original source file name. | ||
#-renamesourcefileattribute SourceFile | ||
|
||
-dontobfuscate | ||
|
||
-ignorewarnings | ||
|
||
-keepattributes *Annotation* | ||
|
||
-dontnote junit.framework.** | ||
-dontnote junit.runner.** | ||
|
||
-dontwarn androidx.test.** | ||
-dontwarn org.junit.** | ||
-dontwarn org.hamcrest.** | ||
-dontwarn com.squareup.javawriter.JavaWriter | ||
|
||
-keepclasseswithmembers @org.junit.runner.RunWith public class * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<manifest | ||
xmlns:android="http:https://schemas.android.com/apk/res/android" | ||
xmlns:tools="http:https://schemas.android.com/tools" | ||
> | ||
|
||
<!-- | ||
Important: disable debugging for accurate performance results | ||
In a com.android.library project, this flag must be disabled from this | ||
manifest, as it is not possible to override this flag from Gradle. | ||
--> | ||
<application | ||
android:debuggable="false" | ||
tools:ignore="HardcodedDebugMode" | ||
tools:replace="android:debuggable" | ||
android:usesCleartextTraffic="true" | ||
android:requestLegacyExternalStorage="true" | ||
> | ||
<profileable android:shell="true" /> | ||
</application> | ||
<uses-permission android:name="android.permission.INTERNET" /> | ||
</manifest> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.