Add priority boost support for Perfetto.#2065
Merged
Conversation
This is part 2. DNS. Priority boost: scoped_sched_boost. This is part 1.
primiano
requested changes
Jul 8, 2025
Member
primiano
left a comment
There was a problem hiding this comment.
You reintroduced again a whole lotta complexity, which is what I tried to avoid, even showing you the code in dev/primiano/prioboost
I am not having this. please rewrite this CL without having all this complexity.
We are not wiritng a generalized library for os scheduling. we are writing a tiny class for boosting the priority.
Your test doesn't warrant all those classes. You are making the code more bug prone and harder to read for a test.
If you want to test without having CI capabilities, then add a tiny struct, which has IDENTICAL signatures to sched_getscheduler, so you can mock them in the test.
protos/perfetto/config/priority_boost/priority_boost_config.proto
Outdated
Show resolved
Hide resolved
Add second data source.
primiano
approved these changes
Jul 9, 2025
Also add comment to explain why we need it.
Reset the 'SchedOsHooks' back to the system. This is needed when running multiple tests in one process.
olehkuznetsov
pushed a commit
to olehkuznetsov/perfetto
that referenced
this pull request
Mar 12, 2026
This CL adds a support to boost priority for the `traced` and
`traced_probes` processes.
When staring a tracing session it is now possible to configure the
scheduling policy
and priority that should be used during the tracing session recording.
We have a separate configuration options for the `traced` process (in
`trace_config.proto`)
and for the `traced_probes` process (in `data_source_config.proto`).
Priority boost requires the process to have a `SYS_NICE` capability, so
in this PR we also
update the `perfetto.rc` file to enable this capability for `traced` and
`traced_probes`
system daemons started by Android.
Tested:
To locally test Android Integration you need to do the follows:
1. Pull this branch into the `external/perfetto` android subproject.
2. Build the entire Android system, for the `perfetto.rc` and the
perfetto system code to be
build as part of the Android image.
3. Flush the devices with the built system (or start the clutterfish
emulator)
4. Run the integration test on the device with atest: `atest
perfetto_integrationtests:PerfettoPriorityBoostIntegrationTest`
To locally test the priority boost workflow without Android integration
you can run
`out/Default/perfetto_integrationtests
--gtest_filter="*PerfettoPriorityBoostIntegrationTest*"`.
To run priority boost unit tests you can run
` out/Default/perfetto_unittests '--gtest_filter=*ScopedSchedBoost*'`
Bug: b/423561591
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.
This CL adds a support to boost priority for the
tracedandtraced_probesprocesses.When staring a tracing session it is now possible to configure the scheduling policy
and priority that should be used during the tracing session recording.
We have a separate configuration options for the
tracedprocess (intrace_config.proto)and for the
traced_probesprocess (indata_source_config.proto).Priority boost requires the process to have a
SYS_NICEcapability, so in this PR we alsoupdate the
perfetto.rcfile to enable this capability fortracedandtraced_probessystem daemons started by Android.
Tested:
To locally test Android Integration you need to do the follows:
external/perfettoandroid subproject.perfetto.rcand the perfetto system code to bebuild as part of the Android image.
atest perfetto_integrationtests:PerfettoPriorityBoostIntegrationTestTo locally test the priority boost workflow without Android integration you can run
out/Default/perfetto_integrationtests --gtest_filter="*PerfettoPriorityBoostIntegrationTest*".To run priority boost unit tests you can run
out/Default/perfetto_unittests '--gtest_filter=*ScopedSchedBoost*'Bug: b/423561591