Skip to content

tp: stdlib: add track-event-based JobScheduler queries#5324

Open
sanath099 wants to merge 1 commit intomainfrom
dev/sanath099/dev/sanathku/jobscheduler-track-events
Open

tp: stdlib: add track-event-based JobScheduler queries#5324
sanath099 wants to merge 1 commit intomainfrom
dev/sanath099/dev/sanathku/jobscheduler-track-events

Conversation

@sanath099
Copy link
Copy Markdown
Contributor

Added a new module android.job_scheduler_states_track_events to provide JobScheduler state tracking derived from track events. This co-exists with the existing statsd-based android_job_scheduler_states module.

Changes:

  • Created android.job_scheduler_states_track_events module.
  • Implemented comprehensive state and reason mapping functions.
  • Added logic to carry forward requested_priority from SCHEDULED events.
  • Added diff tests using synthetic track event traces.
  • Retained existing statsd-based JobScheduler queries and tests.

Test: tools/diff_test_trace_processor.py ./out/dist/trace_processor_shell --name-filter '.job_scheduler.'

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

Added a new module `android.job_scheduler_states_track_events` to provide
JobScheduler state tracking derived from track events. This co-exists
with the existing statsd-based `android_job_scheduler_states` module.

Changes:
- Created `android.job_scheduler_states_track_events` module.
- Implemented comprehensive state and reason mapping functions.
- Added logic to carry forward requested_priority from SCHEDULED events.
- Added diff tests using synthetic track event traces.
- Retained existing statsd-based JobScheduler queries and tests.

Test: tools/diff_test_trace_processor.py ./out/dist/trace_processor_shell --name-filter '.*job_scheduler.*'
@sanath099 sanath099 requested a review from a team as a code owner March 27, 2026 20:33
@github-actions
Copy link
Copy Markdown

🎨 Perfetto UI Builds

-- limitations under the License.
--

-- Checks if a specific job state flag is set in the bitmask.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have to ask: do we have a reason for doing this in SQL instead of just doing this in C++? LIke this seems so much more more work and without all the benefits of type checking that you get from doing this in C++.

You would also be much more efficient: instea of first adding to args and then "reintrepreting" it in SQL, you could parse it correctly in C++ in the first palce.

Honestly just feels like a much better path honestly...

);

-- Extracts job scheduler arg from arg_set_id.
CREATE PERFETTO FUNCTION _android_js_extract_js_arg(
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels like a massive hack I'll be very honest.

FROM raw_job_states;

-- Create table with job execution intervals (state='STARTED').
CREATE PERFETTO TABLE _android_js_job_started AS
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

THis is honestly the only part I'd consider keeping in SQL. Everything else before this point feels like it should be in C++

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