-
Notifications
You must be signed in to change notification settings - Fork 578
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Revamp test harness for macrobenchmark tests #4071
Merged
Merged
Changes from 12 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
ef75e6a
wip
yifanyang 0848950
wip
yifanyang f1ed1e7
massive rename
yifanyang ce42733
fix
yifanyang ba12cd8
bla
yifanyang ae48f6f
todo
yifanyang 810cbbd
what
yifanyang 37b4103
wip
yifanyang 92970db
wip
yifanyang e348194
new
yifanyang f73bfc6
done
yifanyang 504db3c
fix
yifanyang fb143af
remove baseline
yifanyang File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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,117 @@ | ||
# Benchmark | ||
|
||
This directory contains the benchmark test apps used for measuring latency for | ||
initializing Firebase Android SDKs during app startup. | ||
|
||
## Test app configurations | ||
|
||
[config.yaml](config.yaml) contains a list of configuration blocks for | ||
building a macrobenchmark test app for each of the Firebase Android SDKs. | ||
If not all of them are required, comment out irrelevant ones for faster build | ||
and test time. | ||
|
||
**Note**: An empty Android app (named `baseline`) will be created during runtime | ||
for baseline comparison, even though it is not listed in | ||
[config.yaml](config.yaml). This app can also be used as a skeleton for | ||
setting up a more complex benchmark testing app. | ||
|
||
## Run benchmark tests | ||
|
||
### Prerequisite | ||
|
||
1. `fireci` CLI tool | ||
|
||
Refer to its [readme](../../ci/fireci/README.md) for how to install it. | ||
|
||
1. `google-services.json` | ||
|
||
Download it from the Firebase project | ||
[`fireescape-integ-tests`](https://firebase.corp.google.com/u/0/project/fireescape-integ-tests) | ||
to the directory `./template/app`. | ||
|
||
1. Authentication to Google Cloud | ||
|
||
Authentication is required by Google Cloud SDK and Google Cloud Storage | ||
client library used in the benchmark tests. | ||
|
||
One simple way is to configure it is to set an environment variable | ||
`GOOGLE_APPLICATION_CREDENTIALS` to a service account key file. However, | ||
please refer to the official Google Cloud | ||
[doc](https://cloud.google.com/docs/authentication) for full guidance on | ||
authentication. | ||
|
||
### Run benchmark tests locally | ||
|
||
1. Build all test apps by running below command in the root | ||
directory `firebase-android-sdk`: | ||
|
||
```shell | ||
fireci macrobenchmark --build-only | ||
``` | ||
|
||
1. [Connect an Android device to the computer](https://d.android.com/studio/run/device) | ||
|
||
1. Locate the temporary test apps directory from the log, for example: | ||
|
||
- on linux: `/tmp/benchmark-test-*/` | ||
- on macos: `/var/folders/**/benchmark-test-*/` | ||
|
||
1. Start the benchmark tests from CLI or Android Studio: | ||
|
||
- CLI | ||
|
||
Run below command in the above test app project directory | ||
|
||
``` | ||
./gradlew :macrobenchmark:connectedCheck | ||
``` | ||
|
||
- Android Studio | ||
|
||
1. Import the project (e.g. `**/benchmark-test-*/firestore`) into Android Studio | ||
1. Start the benchmark test by clicking gutter icons in the file `BenchmarkTest.kt` | ||
|
||
1. Inspect the benchmark test results: | ||
|
||
- CLI | ||
|
||
Result files are created in `<test-app-dir>/macrobenchmark/build/outputs/`: | ||
|
||
- `*-benchmarkData.json` contains metric aggregates | ||
- `*.perfetto-trace` are the raw trace files | ||
|
||
Additionally, upload `.perfetto-trace` files to | ||
[Perfetto Trace Viewer](https://ui.perfetto.dev/) to visualize all traces. | ||
|
||
- Android Studio | ||
|
||
Test results are displayed directly in the "Run" tool window, including | ||
|
||
- macrobenchmark built-in metrics | ||
- duration of custom traces | ||
- links to trace files that can be visualized within the IDE | ||
|
||
Alternatively, same set of result files are produced at the same output | ||
location as invoking tests from CLI, which can be used for inspection. | ||
|
||
### Run benchmark tests on Firebase Test Lab | ||
|
||
Build and run all tests on FTL by running below command in the root | ||
directory `firebase-android-sdk`: | ||
|
||
``` | ||
fireci macrobenchmark | ||
``` | ||
|
||
Alternatively, it is possible to build all test apps via steps described in | ||
[Running benchmark tests locally](#running-benchmark-tests-locally) | ||
and manually | ||
[run tests on FTL with `gcloud` CLI ](https://firebase.google.com/docs/test-lab/android/command-line#running_your_instrumentation_tests). | ||
|
||
Aggregated benchmark results are displayed in the log. The log also | ||
contains links to FTL result pages and result files on Google Cloud Storage. | ||
|
||
## Toolchains | ||
|
||
- Gradle 7.5.1 | ||
- Android Gradle Plugin 7.2.2 |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we are now measuring Firebase traces only, do we still need this baseline to be present?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense. Removed it and the reference to it in the README.