Clarify in comment Perfetto binary size flags.

It's not obvious from code how the simple false value reduces the binary
size. Adds a comment to explain how it works and a warning about
changing the flag value.

Bug: 272207884
Test: It's a comment
Change-Id: I5ea733ef879e8e6ea1a2a6bfb3aa22b1fbedd6da
This commit is contained in:
Ryan Zuklie
2023-04-07 09:27:11 -07:00
parent e2a1dc74f4
commit dce85ffe78

View File

@@ -101,6 +101,11 @@ void NetworkTraceHandler::RegisterDataSource() {
void NetworkTraceHandler::InitPerfettoTracing() { void NetworkTraceHandler::InitPerfettoTracing() {
perfetto::TracingInitArgs args = {}; perfetto::TracingInitArgs args = {};
args.backends |= perfetto::kSystemBackend; args.backends |= perfetto::kSystemBackend;
// The following line disables the Perfetto system consumer. Perfetto inlines
// the call to `Initialize` which allows the compiler to see that the branch
// with the SystemConsumerTracingBackend is not used. With LTO enabled, this
// strips the Perfetto consumer code and reduces the size of this binary by
// around 270KB total. Be careful when changing this value.
args.enable_system_consumer = false; args.enable_system_consumer = false;
perfetto::Tracing::Initialize(args); perfetto::Tracing::Initialize(args);
NetworkTraceHandler::RegisterDataSource(); NetworkTraceHandler::RegisterDataSource();