Giter VIP home page Giter VIP logo

Comments (4)

ddiproietto avatar ddiproietto commented on May 30, 2024

Unfortunately the textual dump of the Protobuf trace doesn't tell the whole story.

flow_ids type should be repeated fixed64 (https://cs.android.com/android/platform/superproject/main/+/main:external/perfetto/protos/perfetto/trace/track_event/track_event.proto;l=221;drc=ce102357934e8bf42dc2fcc8a0b145a4faed4a9d), but in your trace it's encoded as repeated fixed64 [packed=true].

Here's how we could fix this problem:

  1. How are you encoding your protobufs? Which library are you using? Are you using a library that only supports "proto3" (In proto3 repeated fields are encoded as packed by default)? Can you switch to a library that supports encoding repeated fields as non packed?
  2. As a workaround, you could reencode with protoc before passing it to ui.perfetto.dev. Here's a hacky way: protoc --decode=perfetto.protos.Trace -Iperfetto perfetto/protos/perfetto/trace/trace.proto < repro.pb | protoc --encode=perfetto.protos.Trace -Iperfetto perfetto/protos/perfetto/trace/trace.proto > repro2.pb, where perfetto is a directory where you have a checkout of the perfetto repo.
  3. Ideally ui.perfetto.dev should accept your trace. https://protobuf.dev/programming-guides/encoding/#packed says

Protocol buffer parsers must be able to parse repeated fields that were compiled as packed as if they were not packed, and vice versa.

Doing 3 requires a non trivial amount of work and I don't think fits nicely with the current parsing architecture, but I'm going to get @LalitMaganti comment on this.

from perfetto.

LalitMaganti avatar LalitMaganti commented on May 30, 2024

Doing 3 requires a non trivial amount of work and I don't think fits nicely with the current parsing architecture, but I'm going to get @LalitMaganti comment on this.

Yup agree with everything you say, you're absolutely right that if we follow the spec strictly, we would accept it. However,

  • that would introduce a slight slowdown everywhere we parse repeated scalar fields which is in quite a few places
  • it would add non-trivial complexity to the parsers

I would not do anything on our side for this issue.

from perfetto.

firebolt55439 avatar firebolt55439 commented on May 30, 2024

Thank you both for your help! I was using betterproto as the encoder -- I'll modify the generated bindings to ensure flow_ids are non-packed.

from perfetto.

ddiproietto avatar ddiproietto commented on May 30, 2024

Thank you both for your help! I was using betterproto as the encoder -- I'll modify the generated bindings to ensure flow_ids are non-packed.

Great!

from perfetto.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.