You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Enable --timeline_streams when running debug from IDE button #5724
@dcharkes I'm not sure I entirely understand the problem. You're right that we don't use the --observe flag specifically, we use --enable-vm-service and --pause_isolates_on_start (and maybe --write-service-info):
I'm not familiar with the link between these flags and the timeline events you're after though. Is --observe enabling some other flag that's required here?
I'm not very familiar with this flag does - is it reasonable for us to enable on every debug session (eg. doesn't have a big overheard)? Is there an equivalent for flutter that we should also add?
Just to make sure I understand correctly.. The request is that we add --timeline_streams=Dart,Embedder,GC,Microtask automatically in the dart run and dart test debug adapters:
Are those the correct defaults? Is the overhead of these low enough that having it enabled by default won't cause any problems?
I presume we should also only add this if there isn't an arg starting --timeline_streams in the existing args so that the user can still override it? If the user wanted to opt-out, is that possible? (does --timeline_streams= effectively disable this?)
(I'm not sure if you're the right person to answer these questions.. if not, maybe @bkonyi knows?)
changed the title [-]Enable `--observe` when running debug from IDE button[/-][+]Enable `--timeline_streams` when running debug from IDE button[/+]on Sep 30, 2025
Not sure how useful the compiler one is. It can be useful to see if something took long because Dart was compiling instead of your own written code. The Dart standalone embedder probably doesn't emit many useful timeline events. I think we can stick to the --observe defaults.
I presume we should also only add this if there isn't an arg starting --timeline_streams in the existing args
How do you provide existing args for pressing the "debug" text in the IDE?
Is the overhead of these low enough that having it enabled by default won't cause any problems?
My sense is that when you're running the debugger, the performance overhead should not be prohibitive. It would surprise me if that were to be the case and Flutter enables it by default. It could be that some users add many many timeline events, so theoretically it could be slow. (But then it should have shown up in Flutter debug mode already.)
How do you provide existing args for pressing the "debug" text in the IDE?
You would use a launch.json to create a launch configuration (with toolArgs or vmAdditionalArgs) and then use the templateFor field to specify a path for where it should be the default template. See https://dartcode.org/docs/launch-configuration/ for an example.
I'll look at adding the same defaults (or whether we could switch to --observe to avoid some duplication of the flags in the debug adapters.
How do you provide existing args for pressing the "debug" text in the IDE?
You would use a launch.json to create a launch configuration (with toolArgs or vmAdditionalArgs) and then use the templateFor field to specify a path for where it should be the default template. See https://dartcode.org/docs/launch-configuration/ for an example.
That only works for right? The doesn't respect such configurations, or does it?
I'll look at adding the same defaults (or whether we could switch to --observe to avoid some duplication of the flags in the debug adapters.
If you use templateFor, it does. Using templateFor says that this configuration should be used (maybe template would've been better as default or similar).
When you click Run/Debug CodeLens, we look whether there is a launch configuration that has templateFor: and a path that matches this file, and if so we use that instead of a default empty launch configuration.
Are those the correct defaults? Is the overhead of these low enough that having it enabled by default won't cause any problems?
Yes, these are the correct defaults. The Flutter engine enables these timeline streams by default, so it should be safe to do the same.
I presume we should also only add this if there isn't an arg starting --timeline_streams in the existing args so that the user can still override it? If the user wanted to opt-out, is that possible? (does --timeline_streams= effectively disable this?)
Yes, we should. There's no way to specify no timeline streams from the command line, but it is possible to disable them all through the VM service (we've never had a request to be able to disable all the timeline streams from the CLI).
Activity
DanTup commentedon Sep 25, 2025
@dcharkes I'm not sure I entirely understand the problem. You're right that we don't use the
--observeflag specifically, we use--enable-vm-serviceand--pause_isolates_on_start(and maybe--write-service-info):https://github.com/dart-lang/sdk/blob/97909b6bca4e06a9cfbd38e16c9297b15dab44af/pkg/dds/lib/src/dap/adapters/dart_test_adapter.dart#L80
I'm not familiar with the link between these flags and the timeline events you're after though. Is
--observeenabling some other flag that's required here?dcharkes commentedon Sep 25, 2025
@elliette suspects:
--timeline-streamsfrom the list inhttps://github.com/dart-lang/sdk/blob/d60c837c81e8e15c10ee97f44b10b8be8fe05d6a/pkg/dartdev/lib/src/commands/run.dart#L114-L161
DanTup commentedon Sep 25, 2025
I'm not very familiar with this flag does - is it reasonable for us to enable on every debug session (eg. doesn't have a big overheard)? Is there an equivalent for
flutterthat we should also add?dcharkes commentedon Sep 26, 2025
I'm thinking we're doing this by default in Flutter.
https://github.com/flutter/flutter/blob/53a33b74bca1c645b96bd404d5128b988a385c60/engine/src/flutter/runtime/dart_vm.cc#L93-L110
DanTup commentedon Sep 30, 2025
Just to make sure I understand correctly.. The request is that we add
--timeline_streams=Dart,Embedder,GC,Microtaskautomatically in thedart runanddart testdebug adapters:Are those the correct defaults? Is the overhead of these low enough that having it enabled by default won't cause any problems?
I presume we should also only add this if there isn't an arg starting
--timeline_streamsin the existing args so that the user can still override it? If the user wanted to opt-out, is that possible? (does--timeline_streams=effectively disable this?)(I'm not sure if you're the right person to answer these questions.. if not, maybe @bkonyi knows?)
[-]Enable `--observe` when running debug from IDE button[/-][+]Enable `--timeline_streams` when running debug from IDE button[/+]dcharkes commentedon Sep 30, 2025
For
--observethe list is:https://github.com/dart-lang/sdk/blob/d60c837c81e8e15c10ee97f44b10b8be8fe05d6a/pkg/dartdev/lib/src/commands/run.dart#L157-L158
Not sure how useful the compiler one is. It can be useful to see if something took long because Dart was compiling instead of your own written code. The Dart standalone embedder probably doesn't emit many useful timeline events. I think we can stick to the
--observedefaults.How do you provide existing args for pressing the "debug" text in the IDE?
My sense is that when you're running the debugger, the performance overhead should not be prohibitive. It would surprise me if that were to be the case and Flutter enables it by default. It could be that some users add many many timeline events, so theoretically it could be slow. (But then it should have shown up in Flutter debug mode already.)
DanTup commentedon Sep 30, 2025
You would use a
launch.jsonto create a launch configuration (withtoolArgsorvmAdditionalArgs) and then use thetemplateForfield to specify a path for where it should be the default template. See https://dartcode.org/docs/launch-configuration/ for an example.I'll look at adding the same defaults (or whether we could switch to
--observeto avoid some duplication of the flags in the debug adapters.dcharkes commentedon Sep 30, 2025
That only works for
right? The
doesn't respect such configurations, or does it?
🙏
DanTup commentedon Sep 30, 2025
If you use
templateFor, it does. UsingtemplateForsays that this configuration should be used (maybetemplatewould've been better asdefaultor similar).When you click Run/Debug CodeLens, we look whether there is a launch configuration that has
templateFor:and a path that matches this file, and if so we use that instead of a default empty launch configuration.bkonyi commentedon Oct 1, 2025
Yes, these are the correct defaults. The Flutter engine enables these timeline streams by default, so it should be safe to do the same.
Yes, we should. There's no way to specify no timeline streams from the command line, but it is possible to disable them all through the VM service (we've never had a request to be able to disable all the timeline streams from the CLI).
[dds/dap] Include --timeline-streams in VM args by default for debug …
DanTup commentedon Oct 7, 2025
Fixed by dart-lang/sdk@b2f0d0c. It's an SDK change, so will show up in an SDK update (and not a Dart-Code update).