Skip to content

Add granular tracing and benchmark for Feature Combination Queries#1

Open
temcguir wants to merge 14 commits into
Zeronfinity:tahsinm/cxfg-adoptionfrom
google:feature/fcq-benchmarks
Open

Add granular tracing and benchmark for Feature Combination Queries#1
temcguir wants to merge 14 commits into
Zeronfinity:tahsinm/cxfg-adoptionfrom
google:feature/fcq-benchmarks

Conversation

@temcguir
Copy link
Copy Markdown

@temcguir temcguir commented Apr 29, 2026

Description

This PR builds on top of google#456 to introduce granular tracing and a dedicated macrobenchmark for the new CameraX Feature Groups API integration.

The goal of this PR is to provide objective performance metrics on the overhead of executing isGroupingSupported during camera session initialization, enabling data-driven architectural decisions regarding persistent caching.

Key Changes

  • Granular Tracing (core:camera): Added androidx.tracing.traceAsync and trace markers to FeatureGroupHandler.kt and CameraSession.kt. This allows us to isolate the latency of specific pipeline components (e.g., JCA:CreatePreviewUseCase, JCA:FCQValidation).
  • Macrobenchmark (benchmark): Added FeatureGroupQueryBenchmark.kt to capture and aggregate (Mode.Sum) the total initialization tax caused by sequential feature group queries.
  • Benchmark Reliability:
    • Fixed existing flakiness in StartupBenchmark and FirstFrameBenchmark by replacing the internal am start -W (which fails on Compose UI rendering detection) with native Context.startActivity and explicit UiAutomator readiness checks.
    • Added reportFullyDrawn() to MainActivity.kt's first frame callback to ensure Android correctly registers the TTFF (Time to First Frame).
    • Updated Permissions.kt to grant necessary Android 13+ media permissions, preventing benchmarks from hanging on permission dialogs.

Related PR

Testing Performed

  • Verified that FeatureGroupQueryBenchmark successfully runs and outputs Perfetto traces with the isolated JCA and FCQ latency metrics.
  • Verified FirstFrameBenchmark and StartupBenchmark now pass reliably on physical devices.

@Zeronfinity Zeronfinity force-pushed the tahsinm/cxfg-adoption branch 2 times, most recently from d6e92b2 to 68e0d56 Compare May 20, 2026 05:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants