Android
AuraScore 83/100

Android Macrobenchmark and Profile Guided Optimization Harness

Author a continuous performance benchmarking script that measures frame timing, memory churn, and baseline profile generation.

Use this template when delivering client performance engagements for critical Android applications. It generates automation to orchestrate Jetpack Macrobenchmark runs, profile compilation, and metric regression tracking.

Template

Role: Staff Android Performance Engineer specializing in runtime optimization and professional services client delivery.

Context

  • Client portfolio account: {{consultancy_client}}
  • Application module identifier: {{app_module_name}}
  • Benchmark iteration volume: {{benchmark_iteration_count}}
  • Test device serial ID: {{target_device_serial}}
  • Critical user workflow: {{critical_user_journey}}
  • Baseline profile destination: {{baseline_profile_path}}

Task

Generate an end-to-end Gradle Kotlin Script (KTS) and Shell execution pipeline that executes automated Jetpack Macrobenchmark tests on {{target_device_serial}}, evaluates frame render metrics (Jank and 99th percentile frame times) during {{critical_user_journey}}, compiles an optimized baseline profile to {{baseline_profile_path}}, and outputs performance regressions for {{consultancy_client}}.

Method

  1. Configure Android Gradle Plugin test task definitions for {{app_module_name}} with non-minified release configurations.
  2. Initialize ADB lock-clocks routines on {{target_device_serial}} to minimize thermal throttling skew.
  3. Execute the Jetpack Macrobenchmark suite with {{benchmark_iteration_count}} warmup and measurement iterations.
  4. Profile UI render metrics specifically capturing FrameTimingMetric and StartupTimingMetric during {{critical_user_journey}}.
  5. Extract raw Perfetto trace files and dump summary metrics to a consolidated CSV and JSON file.
  6. Generate an updated baseline profile file and copy it into {{baseline_profile_path}}.
  7. Evaluate metric deltas against historical thresholds and trigger exit code 1 if jank frames exceed 5%.

Constraints

  • MUST write valid Gradle KTS and Shell automation scripts with complete syntax.
  • MUST NOT use deprecated Android Performance Tuner APIs or unpinned benchmark plugin versions.
  • Baseline profile generation steps MUST strictly compile using dex2oat compilation modes (speed-profile).
  • Script MUST fail gracefully if {{target_device_serial}} is disconnected or unrooted for lock-clocks.

Output format

  • Section 1: Gradle KTS Benchmark Configuration Block (30-50 lines)
  • Section 2: Complete Shell Benchmark Orchestration Script (60-100 lines)
  • Section 3: Automated Metric Regression Parser Script (Python, 40-60 lines)
  • Section 4: CI/CD Pipeline Integration Steps (maximum 200 words)

Self-review

  • Confirm that {{consultancy_client}}, {{app_module_name}}, {{benchmark_iteration_count}}, {{target_device_serial}}, {{critical_user_journey}}, and {{baseline_profile_path}} are correctly referenced.
  • Validate that ADB thermal clock locking commands contain restoration fallback logic upon script termination.
  • Ensure Perfetto trace extraction paths handle spaces and special characters safely.
AuraScore breakdown
83/100Provisional
Instruction clarity15/15 · Strong

Explicit role, a named task, and discrete steps the model can follow.

Context architecture12/12 · Strong

Background, inputs and variables the model needs before it starts.

Constraint engineering12/12 · Strong

Hard boundaries — what the model must and must not do.

Output specification6/14 · Thin

A named, field-level shape for the response.

Reasoning structure10/10 · Strong

Ordered work items that force analysis before an answer.

Model compatibility10/10 · Strong

Length and structure that travel across frontier models.

Token efficiency5/10 · Thin

Signal density — instruction weight without padding.

Reusability7/7 · Strong

Documented variables so the scaffold adapts to new inputs.

Robustness5/5 · Strong

Quality bar, assumptions and behaviour when inputs are thin.

Observed performance1/5 · Thin

How much real usage the template has behind it.

developers
developers-android
professional-services
android
performance
macrobenchmark