perfetto: Perfetto UI: Chrome async events not shown

In catapult’s trace viewer, Chrome trace async events (such as blink user timing measurements created with performance.measure()) are shown in a dedicated “Ungrouped Measure” category in the process, alongside threads.

These measurements don’t seem to be shown in any way in Perfetto UI, and they also aren’t discoverable through search.

When falling back to the catapult ui in the Perfetto sidebar, these events don’t show either. Re-loading the trace from its original JSON in catapult does show the events, however.

Is this intentional? Is there any way I can help surfacing these events?

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 3
  • Comments: 25 (1 by maintainers)

Most upvoted comments

Where is the proto format documented? We currently generate JSON files in our application, that we used to use the old Catapult viewer to display, but apparently that is deprecated and broken now, and from what you’re saying Perfetto is never going to fully support the JSON format. I’m completely new to Perfetto, so I might be missing something very obvious, but so far I’ve been unable to find any documentation of what file format we should generate if we want Perfetto to be able to display it. Is there any kind of migration guide for the many applications that used to generate JSON expecting to use the Catapult viewer to display them?

Hi! Thanks for the bug report 👍

It looks like the issue is these events are reported with phase b:

{"args":{"state":"silent"},"cat":"toplevel","id2":{"local":"0x7fbbc001b138"},"name":"RendererAudioState","ph":"b","pid":31089,"scope":"toplevel","tid":775,"ts":16760681614},
{"args":{"state":"renderer_backgrounded"},"cat":"toplevel","id2":{"local":"0x7fbbc001af78"},"name":"RendererPriority","ph":"b","pid":31089,"scope":"toplevel","tid":775,"ts":16760681617},
{"args":{"state":"hidden"},"cat":"toplevel","id2":{"local":"0x7fbbc001af20"},"name":"RendererVisibility","ph":"b","pid":31089,"scope":"toplevel","tid":775,"ts":16760681619},
{"args":{"state":"extension"},"cat":"toplevel","id2":{"local":"0x7fcec30194b8"},"name":"RendererProcessType","ph":"b","pid":31044,"scope":"toplevel","tid":775,"ts":16760681710},
{"args":{"state":"silent"},"cat":"toplevel","id2":{"local":"0x7fcec3019138"},"name":"RendererAudioState","ph":"b","pid":31044,"scope":"toplevel","tid":775,"ts":16760681714},
{"args":{"state":"renderer_foregrounded"},"cat":"toplevel","id2":{"local":"0x7fcec3018f78"},"name":"RendererPriority","ph":"b","pid":31044,"scope":"toplevel","tid":775,"ts":16760681717},

(so nestable begin and friends: https://docs.google.com/document/d/1CvAClvFfyA5R-PhYUmn5OOQtYMH4h6I0nSsKchNAySU/preview#heading=h.puwqg050lyuy)

And we don’t currently parse that at all for json traces: https://github.com/google/perfetto/blob/master/src/trace_processor/importers/json/json_trace_parser.cc#L124

@betasheet Did I get that right and do you know if anyone is interested in adding support for that on the Chrome side? I think it should be reasonably easy to plumb in similar way to Android async events (e.g. https://github.com/google/perfetto/blob/master/src/trace_processor/importers/systrace/systrace_parser.cc#L163).

I wonder if this is a bug/missing feature in the Perfetto UI. It’s possible this doesn’t yet work for children of thread tracks. Does it work with children of process tracks? That is:

packet {
  timestamp: 0
  track_descriptor {
    uuid: 1000
    process {
      pid: 81351
      process_name: "example0"
    }
  }
}
packet {
  timestamp: 0
  track_descriptor {
    uuid: 1001
    parent_uuid: 1000
    name: "example0_async"
  }
}
packet {
  timestamp: 0
  track_descriptor {
    uuid: 1002
    parent_uuid: 1000
    name: "example0_async"
  }
}