dart-lang / sdk

The Dart SDK, including the VM, JS and Wasm compilers, analysis, core libraries, and more.
https://dart.dev
BSD 3-Clause "New" or "Revised" License
10.05k stars 1.55k forks source link

Dart code does not always appear in traces in devtools #55630

Open Hixie opened 4 months ago

Hixie commented 4 months ago

Code that's run from a microtask, a Timer, or pretty much anything that the Flutter framework doesn't itself already track using Timeline, does not appear in traces shown by the devtools. This leads to situations where really expensive code that takes more than a few milliseconds can cause jank that is near untraceable by looking at the timeline in devtools.

a-siva commented 3 months ago

@Hixie The CPU profile display on the timeline is turned off by default, would turning that on give you the information you need ?

a-siva commented 3 months ago

//cc @bkonyi @kenzieschmoll

kenzieschmoll commented 3 months ago

@Hixie are there any events in the timeline? A screenshot or a timeline trace you could add here could be helpful. Turning on the CPU samples in the timeline would give you an idea of what is going on on the CPU during your trace. This seems like a similar issue to https://github.com/flutter/devtools/issues/4479, where it is difficult to detect jank between frames because no frames show up as "red" or missing the budget when the jank happens between one frame ending and the next beginning.

a-siva commented 3 months ago

In the weekly triage meeting there was a comment that we have a timeline event called HandleMessage which is not enabled by default for Flutter, enabling this could potentially show more details.

Hixie commented 3 months ago

The test case I was using is the code at the top of https://github.com/flutter/flutter/issues/129894.

I don't really have any details beyond that.

bkonyi commented 3 months ago

Can you try enabling the Isolates timeline stream? This should make the HandleMessages events appear in the timeline.