google / perfetto

Performance instrumentation and tracing for Android, Linux and Chrome (read-only mirror of https://android.googlesource.com/platform/external/perfetto/)
https://www.perfetto.dev
Apache License 2.0
2.86k stars 358 forks source link

Counter debug annotations and categories not taken into account #759

Closed facewindu closed 3 weeks ago

facewindu commented 7 months ago

I'm trying to set debug annotations and categories to some of my counter track events, like I'm doing with other type of track events. But they don't show up in the UI For simplicity, here sth close to what I do

TracePacket.newBuilder()
            .setTimestampClockId(CLOCK_ID)
            .setTimestamp(Duration.between(startTime.get(), when).toMillis())
            .setTrustedPacketSequenceId(TRUSTED_PACKET_SEQUENCE_ID)
            .setSequenceFlags(TracePacket.SequenceFlags.SEQ_NEEDS_INCREMENTAL_STATE.getNumber())
            .setTrackEvent(TrackEvent.newBuilder()
                .setTrackUuid(knownCounterUuid.get(counterType))
                .setType(Type.TYPE_COUNTER)
                .setCounterValue(value)
                .addDebugAnnotations(DebugAnnotation.newBuilder().setName("FOO").setStringValue("BAR").build())
                .addCategories("TOTO")
            )
            .build()

Is it expected ?

LalitMaganti commented 7 months ago

Seems like we don't parse debug annotations for counters ATM only for slices: https://cs.android.com/android/platform/superproject/main/+/main:external/perfetto/src/trace_processor/importers/proto/track_event_parser.cc;l=660?q=src%2Ftrace_processor%2Fimporters%2Fproto%2Ftrack_event_parser.cc

Would be something quite easy to fix, contributions welcome.

LalitMaganti commented 3 weeks ago

This has now been fixed as of https://github.com/google/perfetto/commit/f5c135505027a214a2f157b6fa761669925a390b