Skip to content

Commit 92970db

Browse files
committed
wip
1 parent 37b4103 commit 92970db

File tree

3 files changed

+61
-14
lines changed

3 files changed

+61
-14
lines changed

ci/fireci/fireciplugins/macrobenchmark.py

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
@click.option(
4242
'--build-only/--no-build-only',
4343
default=False,
44-
help='Whether to build tracing test apps only or to also submit to FTL afterwards'
44+
help='Whether to only build tracing test apps or to also run them on FTL afterwards'
4545
)
4646
@ci_command()
4747
def macrobenchmark(build_only):
@@ -62,12 +62,18 @@ async def _launch_macrobenchmark_test(build_only):
6262
_logger.info(f'Processed yaml configurations: {config}')
6363

6464
tests = [MacrobenchmarkTest(app, artifact_versions, os.getcwd(), test_dir) for app in config['test-apps']]
65-
_logger.info(f'Building {len(tests)} macrobenchmark tests...')
6665

67-
if build_only:
68-
await asyncio.gather(*[x.run_build_only() for x in tests])
69-
else:
70-
results = await asyncio.gather(*[x.run() for x in tests], return_exceptions=True)
66+
_logger.info(f'Building {len(tests)} macrobenchmark test apps...')
67+
# TODO(yifany): investigate why it runs significantly slower
68+
# - on corp workstations than M1 macbook pro
69+
# - with gradle 7.5.1 than gradle 6.9.2
70+
# await asyncio.gather(*[x.build() for x in tests])
71+
for test in tests:
72+
await test.build()
73+
74+
if not build_only:
75+
_logger.info(f'Submitting {len(tests)} tests to Firebase Test Lab...')
76+
results = await asyncio.gather(*[x.test() for x in tests], return_exceptions=True)
7177
await _post_processing(results)
7278

7379
_logger.info('Macrobenchmark test finished.')
@@ -152,18 +158,16 @@ def __init__(
152158
self.test_results_dir = str(uuid.uuid4())
153159
self.gcs_client = storage.Client()
154160

155-
async def run(self):
156-
"""Starts the workflow of src creation, apks assembly, FTL testing and results upload."""
161+
async def build(self):
162+
"""Creates test app project and assembles app and test apks."""
157163
await self._create_benchmark_projects()
158164
await self._assemble_benchmark_apks()
165+
166+
async def test(self):
167+
"""Runs benchmark tests on FTL and fetches FTL results from GCS."""
159168
await self._execute_benchmark_tests()
160169
return await self._aggregate_benchmark_results()
161170

162-
async def run_build_only(self):
163-
"""Populate test app src and assemble apks."""
164-
await self._create_benchmark_projects()
165-
await self._assemble_benchmark_apks()
166-
167171
async def _create_benchmark_projects(self):
168172
app_name = self.test_app_config['name']
169173
self.logger.info(f'Creating test app "{app_name}"...')
@@ -176,6 +180,7 @@ async def _create_benchmark_projects(self):
176180
renderer = pystache.Renderer()
177181
mustaches = glob.glob('**/*.mustache', recursive=True)
178182
for mustache in mustaches:
183+
self.logger.info(f'Processing mustache template: {mustache}...')
179184
result = renderer.render_path(mustache, mustache_context)
180185
original_name = mustache.removesuffix('.mustache')
181186
with open(original_name, 'w') as file:

health-metrics/README.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,14 @@ Refer to [README.md](apk-size/README.md) in the subdirectory `apk-size` for more
1212

1313
## App startup time
1414

15-
**TODO(yifany)**: Add more details once the measurement tools and infrastructure is ready.
15+
Firebase runs during different
16+
[app lifecycle](https://d.android.com/guide/components/activities/process-lifecycle)
17+
phases, and contributes to the overall
18+
[app startup time](https://d.android.com/topic/performance/vitals/launch-time)
19+
in many ways.
20+
21+
We are currently using
22+
[benchmarking](https://d.android.com/topic/performance/benchmarking/benchmarking-overview)
23+
and [tracing](https://d.android.com/topic/performance/tracing) to measure its
24+
latency impact. Refer to [README.md](benchmark/README.md) in the subdirectory
25+
`benchmark` for more details.

health-metrics/benchmark/README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Benchmark
2+
3+
This directory contains the benchmark test apps used for measuring latency for
4+
different Firebase Android SDKs during app startup.
5+
6+
## Usage
7+
8+
### Prerequisite
9+
10+
- `fireci` CLI tool
11+
12+
Refer to the [readme](../../ci/fireci/README.md) for how to install it.
13+
14+
- `google-services.json`
15+
16+
Download it from Firebase project
17+
[`fireescape-integ-tests`](https://firebase.corp.google.com/u/0/project/fireescape-integ-tests)
18+
to the directory `firebase-android-sdk/health-metrics/benchmark/template/app`.
19+
20+
### Running benchmark tests locally
21+
22+
1. Under the root directory `firebase-android-sdk`, run
23+
24+
```
25+
fireci macrobenchmark --build-only
26+
```
27+
28+
to create all benchmark test apps based on the [configuration](config.yaml).
29+
30+
1. [Connect an Android device to the computer](https://d.android.com/studio/run/device)
31+
32+
1.

0 commit comments

Comments
 (0)