tp: rename blocking calls module and optimize for CUJs#6093
Open
gopi3587 wants to merge 3 commits into
Open
Conversation
Renames the standard library module to `android.blocking_calls_during_cujs` and the internal table to `_android_blocking_calls_during_cujs`. Restructures the stdlib table using strict CROSS JOIN top-down indexing to scope queries directly to process IDs with active CUJs. This completely bypasses unindexed scans over the global slice table. By traversing the join path from active processes down to individual track slices, the query optimizer can leverage the B-Tree indices on thread tracks and slice track IDs, providing massive reductions in slices evaluated and cutting query latency. Furthermore, this locks the optimal execution plan in-place, permanently preventing the SQLite query planner from degenerating into unindexed nested-loop cartesian scans, which previously caused severe wall-clock regressions on developer workstations. All baseline and optimized outputs remain character-for-character binary-identical (verified via host trace_processor_shell benchmark sweeps). Test: manual verification via trace_processor_shell benchmark sweeps Flag: EXEMPT METRICS Change-Id: I9306ec79ffafb81e51a36ddb64cf3d533b67dfca
🎨 Perfetto UI Builds
|
Member
|
Sorry but this is not the correct fix at all. The module was designed very intentionally to separately compute the blocking calls, the cujs and then a layer on top to compose them. This is because you can reason about blocking calls outside of CUJs perfectly fine. You are hardcoding a hack to some particular problem you're having rather than solving the problem more correctly in a general way. |
Author
|
Ack, working on the cleanup without impacting the existing tables and their dependencies. |
85666c7 to
9c159ad
Compare
Introduces a new standard library module `android.blocking_calls_during_cujs` (and table `_android_blocking_calls_during_cujs`) that optimizes blocking call extraction specifically for processes involved in active SystemUI CUJs. By pre-filtering by relevant UPIDs and enforcing a strict top-down indexed join sequence via `CROSS JOIN` (relevant_upids -> process -> thread -> thread_track -> slice), SQLite query execution plans are locked against optimizer regressions, permanently avoiding full scans of the global slice table. To preserve backward compatibility, the original standard library module `android.critical_blocking_calls` and the generic unaggregated metric `android_blocking_calls_unagg` remain completely unchanged and generic. Only the CUJ-scoped metrics are migrated to the optimized table. Optimization & Testing Summary: Performance and output correctness were validated using the large trace set and all 12 scenario traces. In all cases, outputs are 100% character-for-character identical to the baseline. 1. Large Trace (abc.perfetto-trace, 168MB) - Both Metrics Processed Together: - Baseline Time: 20.130s - Optimized Time: 10.500s - Speedup: 1.92x (47.84% total processing time saved) - Output Validation: 100% Match (SUCCESS) 2. Scenario Traces (Batch sweep, 12 traces, 450MB cumulative) - Both Metrics Together: - Total Baseline Time: 49.720s - Total Optimized Time: 27.519s - Cumulative Speedup: 1.81x (44.65% overall processing time saved) - Individual Trace Speedups: 1.48x to 2.03x - Output Validation: 100% Match across all 12 files (SUCCESS) Test: manual verification via trace_processor_shell benchmark sweeps Test: tools/check_sql_modules.py --check-includes
9c159ad to
460844a
Compare
gopi3587
commented
Jun 4, 2026
Author
gopi3587
left a comment
There was a problem hiding this comment.
Created a new blocking calls during CUJ's without impact the previous generic implementation.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Renames the standard library module to
android.blocking_calls_during_cujsand the internal table to_android_blocking_calls_during_cujs.Restructures the stdlib table using strict CROSS JOIN top-down indexing to scope queries directly to process IDs with active CUJs. This completely bypasses unindexed scans over the global slice table.
By traversing the join path from active processes down to individual track slices, the query optimizer can leverage the B-Tree indices on thread tracks and slice track IDs, providing massive reductions in slices evaluated and cutting query latency.
Furthermore, this locks the optimal execution plan in-place, permanently preventing the SQLite query planner from degenerating into unindexed nested-loop cartesian scans, which previously caused severe wall-clock regressions on developer workstations.
All baseline and optimized outputs remain character-for-character binary-identical (verified via host trace_processor_shell benchmark sweeps).
Test: manual verification via trace_processor_shell benchmark sweeps
Welcome to Perfetto!
Make sure your PR has a bug/issue attached or has at least
a clear description of the problem you are trying to fix.
For more details please see
https://perfetto.dev/docs/contributing/getting-started