sdk: honor TraceConfig.compression_type on the in-process backend#5862
sdk: honor TraceConfig.compression_type on the in-process backend#5862dreveman wants to merge 1 commit into
Conversation
🎨 Perfetto UI Builds
|
|
I think this is not as simple as this: we also need to do what I said in #3118 - basically define some new #defines you can add to the SDK enabling ZLIB in the amalgmated SDK (but you are responsible for making zlib available to us). |
Works fine for me as long as I build the SDK with the following and add zlib dependency to my target: I can work on adding a simpler flag to gen_amalgamated for this as a follow up if that's something we want? Either way, it would be nice to make this change so someone (like me) who is OK with maintaining a custom generated version of the SDK doesn't have to manually patch the code. |
|
Hmmmmm I thought the amalgamator stripped out the buildflags (at least that's what I say in the issue). I'm quite confused by this, will have to look into this a bit. |
Mirror what `src/traced/service/service.cc` does for the system backend: when the SDK is built with `enable_perfetto_zlib=true`, construct the in-process backend's TracingService with `init_opts.compressor_fn = &ZlibCompressFn` so that `TraceConfig.compression_type = COMPRESSION_TYPE_DEFLATE` actually takes effect. Without this, the in-process service is created with default `init_opts` (compressor_fn == nullptr) and the `compression_type` field on the TraceConfig is silently ignored — embedders writing a local `.pftrace` via `TracingSession::Setup(cfg, fd)` got an uncompressed file regardless of what they set in the config. The compressor is wired only when PERFETTO_ZLIB is enabled, matching the existing pattern in `service.cc:136-139`. No new public API; the behavior is opt-in via the TraceConfig field that already exists.
f8baa8c to
7094e2f
Compare
Mirror what
src/traced/service/service.ccdoes for the system backend: when the SDK is built withenable_perfetto_zlib=true, construct the in-process backend's TracingService withinit_opts.compressor_fn = &ZlibCompressFnso thatTraceConfig.compression_type = COMPRESSION_TYPE_DEFLATEactually takes effect. Without this, the in-process service is created with defaultinit_opts(compressor_fn == nullptr) and thecompression_typefield on the TraceConfig is silently ignored — embedders writing a local.pftraceviaTracingSession::Setup(cfg, fd)got an uncompressed file regardless of what they set in the config.The compressor is wired only when PERFETTO_ZLIB is enabled, matching the existing pattern in
service.cc:136-139. No new public API; the behavior is opt-in via the TraceConfig field that already exists.