-
Notifications
You must be signed in to change notification settings - Fork 273
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
Add doc for android startup scenario local testing. #4664
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
081ab90
Add doc for android startup scenario local testing
LoopedBard3 68eb904
Fix incorrect path.
LoopedBard3 3038ee9
Clean up no longer necessary pathing for android docs.
LoopedBard3 f0b7cc6
Add comment on the .NET Core version necessary to have.
LoopedBard3 847f4b8
Add the prereq of having an Android Device.
LoopedBard3 c72d44a
Update android startup doc per feedback and added note on --use-fully…
LoopedBard3 a1bc126
Add a new scenario folder named genericandroidstartup and updated the…
LoopedBard3 bb29a98
Updates per feedback. Removed --unzip pre.py as it shouldn't be neede…
LoopedBard3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
|
||
# Android Startup Test | ||
|
||
## Prereqs | ||
|
||
- Ensure `python` is installed and available. Any currently supported `python` 3.* version should work. Downloads are available at https://www.python.org/downloads/. | ||
- Ensure `dotnet` is installed and available with the `dotnet` command for easy xharness installation. Any supported .NET Core version should work. [Dotnet Download](https://dotnet.microsoft.com/en-us/download) or [Daily Dotnet Download](https://github.com/dotnet/sdk/blob/main/documentation/package-table.md). | ||
- Ensure `xharness` is installed and available with the `xharness` command. The current version in use can be found in the `eng/performance/maui_scenarios_android.proj` file at line 7 (under the tag `MicrosoftDotNetXHarnessCLIVersion`), although any recent version should work. [XHarness Install Instructions](https://github.com/dotnet/xharness?tab=readme-ov-file#installation-and-usage). | ||
- Have an Android app APK available for testing. | ||
- Have an Android Device (with developer mode enabled) or emulator connected to computer, and viewable with `xharness android device` or `xharness android adb -- devices -l`. | ||
|
||
## Steps | ||
|
||
1. Initialize the environment (note the . for bash): | ||
|
||
```sh | ||
cd src/scenarios | ||
. ./init.sh # or `.\init.ps1` on Windows. Can specify custom dotnet install with -dotnetdir <dir>, but dotnet install should not impact Android Startup testing itself. | ||
``` | ||
|
||
2. Navigate to the `genericandroidstartup` scenario directory: | ||
|
||
```sh | ||
cd genericandroidstartup | ||
``` | ||
|
||
3. Copy the APK into the `genericandroidstartup` directory. | ||
4. Run the test: | ||
|
||
```sh | ||
python test.py devicestartup --device-type android --package-path <path-to-apk> --package-name <apk-package-name> [--disable-animations] [--use-fully-drawn-time --fully-drawn-extra-delay <delay-in-sec>] | ||
``` | ||
|
||
* Refer to the [Notes](./android-startup-scenarios.md#notes) below about specifying --use-fully-drawn-time --fully-drawn-extra-delay parameters. | ||
|
||
5. Read the output: | ||
|
||
During the running of the test you will see the loop of the activity being started to get the startup times. | ||
Once the testing is completed, you will see output similar to the following: | ||
|
||
```txt | ||
[2025/01/29 11:15:44][INFO] Found Value (ms): 713 | ||
[2025/01/29 11:15:44][INFO] Found Value (ms): 715 | ||
[2025/01/29 11:15:44][INFO] Found Value (ms): 728 | ||
[2025/01/29 11:15:44][INFO] Found Value (ms): 716 | ||
[2025/01/29 11:15:44][INFO] Found Value (ms): 715 | ||
[2025/01/29 11:15:44][INFO] Found Value (ms): 734 | ||
[2025/01/29 11:15:44][INFO] Found Value (ms): 716 | ||
[2025/01/29 11:15:44][INFO] Found Value (ms): 718 | ||
[2025/01/29 11:15:44][INFO] Found Value (ms): 713 | ||
[2025/01/29 11:15:44][INFO] Found Value (ms): 706 | ||
[2025/01/29 11:15:44][INFO] Device Startup - Maui Android Default NoAnimation | ||
[2025/01/29 11:15:44][INFO] Metric |Average |Min |Max | ||
[2025/01/29 11:15:44][INFO] ----------------|---------------|---------------|--------------- | ||
[2025/01/29 11:15:44][INFO] Generic Startup |717.400 ms |706.000 ms |734.000 ms | ||
``` | ||
|
||
The Found Value's are the individual test run startup times with the overall stats at the bottom. The stats provided include the following startup stats: average, minimum, and maximum times. | ||
|
||
## Notes | ||
|
||
- Specific example command such as when using the runtime android example app: `python test.py devicestartup --device-type android --package-path HelloAndroid.apk --package-name net.dot.HelloAndroid`. | ||
- Other example commands and additional logic can be found in the `maui_scenarios_android.proj` and `runner.py` files in the `performance` repository. | ||
- If using `[--use-fully-drawn-time --fully-drawn-extra-delay <delay in sec>]` arguments, the Android app must have reportFullyDrawn() called on a ComponentActivity. Reference: https://developer.android.com/topic/performance/vitals/launch-time#retrieve-TTFD. |
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,7 @@ | ||
''' | ||
post cleanup script | ||
''' | ||
|
||
from shared.postcommands import clean_directories | ||
|
||
clean_directories() |
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 @@ | ||
''' | ||
pre-command | ||
''' | ||
import sys | ||
import os | ||
from zipfile import ZipFile | ||
from performance.logger import setup_loggers, getLogger | ||
from shutil import copyfile | ||
from shared.precommands import PreCommands | ||
from shared.const import PUBDIR | ||
from argparse import ArgumentParser | ||
|
||
setup_loggers(True) | ||
|
||
parser = ArgumentParser() | ||
parser.add_argument( | ||
'--apk-name', | ||
dest='apk', | ||
required=True, | ||
type=str, | ||
help='Name of the APK to setup (with .apk)') | ||
args = parser.parse_args() | ||
|
||
if not os.path.exists(PUBDIR): | ||
os.mkdir(PUBDIR) | ||
apkname = args.apk | ||
if not os.path.exists(apkname): | ||
getLogger().error('Cannot find %s' % (apkname)) | ||
exit(-1) | ||
else: | ||
copyfile(apkname, os.path.join(PUBDIR, apkname)) | ||
|
||
|
||
|
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,12 @@ | ||
''' | ||
C# Console app | ||
''' | ||
from shared.runner import TestTraits, Runner | ||
|
||
EXENAME = 'GenericAndroidStartup' | ||
|
||
if __name__ == "__main__": | ||
traits = TestTraits(exename=EXENAME, | ||
guiapp='false', | ||
) | ||
Runner(traits).run() |
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.
Maybe add information about where the results of the performance test can be found or an example of what the output should look like.
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.
Added section on this.