-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update Java to 17 and add sample benchmark, cleanup (#23)
- Loading branch information
1 parent
3ef034b
commit 2f3aa6e
Showing
23 changed files
with
217 additions
and
289 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -1 +1,3 @@ | ||
/build | ||
/build | ||
*.keystore | ||
!debug.keystore |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
plugins { | ||
id 'com.android.test' | ||
id 'org.jetbrains.kotlin.android' | ||
} | ||
|
||
android { | ||
namespace 'dev.varshakulkarni.benchmark' | ||
compileSdk 33 | ||
|
||
compileOptions { | ||
sourceCompatibility = JavaVersion.VERSION_17 | ||
targetCompatibility = JavaVersion.VERSION_17 | ||
} | ||
|
||
kotlinOptions { | ||
jvmTarget = "17" | ||
} | ||
|
||
defaultConfig { | ||
minSdk 24 | ||
targetSdk 33 | ||
|
||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" | ||
} | ||
|
||
buildTypes { | ||
// This benchmark buildType is used for benchmarking, and should function like your | ||
// release build (for example, with minification on). It's signed with a debug key | ||
// for easy local/CI testing. | ||
benchmark { | ||
debuggable = true | ||
signingConfig = debug.signingConfig | ||
matchingFallbacks = ["release"] | ||
} | ||
} | ||
|
||
targetProjectPath = ":app" | ||
experimentalProperties["android.experimental.self-instrumenting"] = true | ||
} | ||
|
||
dependencies { | ||
implementation 'androidx.test.ext:junit:1.1.5' | ||
implementation 'androidx.test.espresso:espresso-core:3.4.0' | ||
implementation 'androidx.test.uiautomator:uiautomator:2.2.0' | ||
implementation 'androidx.benchmark:benchmark-macro-junit4:1.1.0-beta05' | ||
} | ||
|
||
androidComponents { | ||
beforeVariants(selector().all()) { | ||
enabled = buildType == "benchmark" | ||
} | ||
} |
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,7 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"> | ||
|
||
<queries> | ||
<package android:name="dev.varshakulkarni.moviehangman" /> | ||
</queries> | ||
</manifest> |
53 changes: 53 additions & 0 deletions
53
benchmark/src/main/java/dev/varshakulkarni/benchmark/ExampleStartupBenchmark.kt
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,53 @@ | ||
/* | ||
* Copyright 2023 Varsha Kulkarni | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package dev.varshakulkarni.benchmark | ||
|
||
import androidx.benchmark.macro.StartupMode | ||
import androidx.benchmark.macro.StartupTimingMetric | ||
import androidx.benchmark.macro.junit4.MacrobenchmarkRule | ||
import androidx.test.ext.junit.runners.AndroidJUnit4 | ||
import org.junit.Rule | ||
import org.junit.Test | ||
import org.junit.runner.RunWith | ||
|
||
/** | ||
* This is an example startup benchmark. | ||
* | ||
* It navigates to the device's home screen, and launches the default activity. | ||
* | ||
* Before running this benchmark: | ||
* 1) switch your app's active build variant in the Studio (affects Studio runs only) | ||
* 2) add `<profileable android:shell="true" />` to your app's manifest, within the `<application>` tag | ||
* | ||
* Run this benchmark from Studio to see startup measurements, and captured system traces | ||
* for investigating your app's performance. | ||
*/ | ||
@RunWith(AndroidJUnit4::class) | ||
class ExampleStartupBenchmark { | ||
@get:Rule | ||
val benchmarkRule = MacrobenchmarkRule() | ||
|
||
@Test | ||
fun startup() = benchmarkRule.measureRepeated( | ||
packageName = "dev.varshakulkarni.moviehangman", | ||
metrics = listOf(StartupTimingMetric()), | ||
iterations = 5, | ||
startupMode = StartupMode.COLD | ||
) { | ||
pressHome() | ||
startActivityAndWait() | ||
} | ||
} |
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
Binary file not shown.
Binary file not shown.
Oops, something went wrong.