[VM/Timeline] Add Microtask stream

TEST=runtime/vm/dart_api_impl_test.cc

Change-Id: Icb078489f3600ac0fb8b314ca3bf748f482a687e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/422860
Reviewed-by: Ben Konyi <bkonyi@google.com>
This commit is contained in:
Derek Xu
2025-04-22 07:42:27 -07:00
committed by Commit Queue
parent cdab11ca77
commit 75311aefa8
13 changed files with 22 additions and 14 deletions
+3 -2
View File
@@ -153,8 +153,9 @@ class RunCommand extends DartdevCommand {
'timeline-streams', 'timeline-streams',
help: 'Enables recording for specific timeline streams.\n' help: 'Enables recording for specific timeline streams.\n'
'Valid streams include: all, API, Compiler, CompilerVerbose, Dart, ' 'Valid streams include: all, API, Compiler, CompilerVerbose, Dart, '
'Debugger, Embedder, GC, Isolate, VM.\n' 'Debugger, Embedder, GC, Isolate, Microtask, VM.\n'
'Defaults to "Compiler, Dart, GC" when --observe is provided.', 'Defaults to "Compiler, Dart, GC, Microtask" when --observe is '
'provided.',
valueHelp: 'str1, str2, ...', valueHelp: 'str1, str2, ...',
hide: !verbose, hide: !verbose,
); );
+1 -1
View File
@@ -1 +1 @@
version=4.17 version=4.18
+1 -1
View File
@@ -27,7 +27,7 @@ export 'snapshot_graph.dart'
HeapSnapshotObjectNoData, HeapSnapshotObjectNoData,
HeapSnapshotObjectNullData; HeapSnapshotObjectNullData;
const String vmServiceVersion = '4.17.0'; const String vmServiceVersion = '4.18.0';
/// @optional /// @optional
const String optional = 'optional'; const String optional = 'optional';
@@ -17,7 +17,7 @@ import 'service_extension_registry.dart';
export 'service_extension_registry.dart' show ServiceExtensionRegistry; export 'service_extension_registry.dart' show ServiceExtensionRegistry;
const String vmServiceVersion = '4.17.0'; const String vmServiceVersion = '4.18.0';
/// A class representation of the Dart VM Service Protocol. /// A class representation of the Dart VM Service Protocol.
abstract interface class VmServiceInterface { abstract interface class VmServiceInterface {
+3 -3
View File
@@ -168,7 +168,7 @@ void Options::PrintUsage() {
" --pause-isolates-on-exit\n" " --pause-isolates-on-exit\n"
" --pause-isolates-on-unhandled-exceptions\n" " --pause-isolates-on-unhandled-exceptions\n"
" --warn-on-pause-with-no-debugger\n" " --warn-on-pause-with-no-debugger\n"
" --timeline-streams=\"Compiler, Dart, GC\"\n" " --timeline-streams=\"Compiler, Dart, GC, Microtask\"\n"
" This set is subject to change.\n" " This set is subject to change.\n"
" Please see these options (--help --verbose) for further documentation.\n" " Please see these options (--help --verbose) for further documentation.\n"
"--write-service-info=<file_uri>\n" "--write-service-info=<file_uri>\n"
@@ -210,7 +210,7 @@ void Options::PrintUsage() {
" --pause-isolates-on-exit\n" " --pause-isolates-on-exit\n"
" --pause-isolates-on-unhandled-exceptions\n" " --pause-isolates-on-unhandled-exceptions\n"
" --warn-on-pause-with-no-debugger\n" " --warn-on-pause-with-no-debugger\n"
" --timeline-streams=\"Compiler, Dart, GC\"\n" " --timeline-streams=\"Compiler, Dart, GC, Microtask\"\n"
" This set is subject to change.\n" " This set is subject to change.\n"
" Please see these options for further documentation.\n" " Please see these options for further documentation.\n"
#endif // !defined(PRODUCT) #endif // !defined(PRODUCT)
@@ -456,7 +456,7 @@ bool Options::ProcessObserveOption(const char* arg,
vm_options->AddArgument("--pause-isolates-on-unhandled-exceptions"); vm_options->AddArgument("--pause-isolates-on-unhandled-exceptions");
vm_options->AddArgument("--profiler"); vm_options->AddArgument("--profiler");
vm_options->AddArgument("--warn-on-pause-with-no-debugger"); vm_options->AddArgument("--warn-on-pause-with-no-debugger");
vm_options->AddArgument("--timeline-streams=\"Compiler,Dart,GC\""); vm_options->AddArgument("--timeline-streams=\"Compiler,Dart,GC,Microtask\"");
#if !defined(DART_PRECOMPILED_RUNTIME) #if !defined(DART_PRECOMPILED_RUNTIME)
dfe()->set_use_incremental_compiler(true); dfe()->set_use_incremental_compiler(true);
#endif // !defined(DART_PRECOMPILED_RUNTIME) #endif // !defined(DART_PRECOMPILED_RUNTIME)
+2 -1
View File
@@ -33,6 +33,7 @@ Streams, also called categories, are sets of events whose recordering can be ena
| `Embedder` | Events created by `Dart_RecordTimelineEvent`. | | `Embedder` | Events created by `Dart_RecordTimelineEvent`. |
| `GC` | Events related to garbage collection or heap iteration. | | `GC` | Events related to garbage collection or heap iteration. |
| `Isolate` | Isolate or isolate group lifecycle events such as startup or shutdown. | | `Isolate` | Isolate or isolate group lifecycle events such as startup or shutdown. |
| `Microtask` | Events representing `dart:async` microtasks. This stream only contains events when the VM is started with the `--profile-microtasks` flag. |
| `VM` | VM lifecycle events such a startup or shutdown. | | `VM` | VM lifecycle events such a startup or shutdown. |
The set of enabled streams can be selected with the `timeline_streams` flag. E.g., `--timeline_stream=VM,Isolate,GC,Dart` or `--timeline_streams=All`. The set of enabled streams can be selected with the `timeline_streams` flag. E.g., `--timeline_stream=VM,Isolate,GC,Dart` or `--timeline_streams=All`.
@@ -45,7 +46,7 @@ There are also some convenience flags:
| Flag | Expansion | | Flag | Expansion |
| ---- | --------- | | ---- | --------- |
|`--timeline_streams=All` | `--timeline_streams=API,Compiler,CompilerVerbose,Dart,Debugger,Embedder,GC,Isolate,VM` | |`--timeline_streams=All` | `--timeline_streams=API,Compiler,CompilerVerbose,Dart,Debugger,Embedder,GC,Isolate,Microtask,VM` |
| `--complete_timeline` | `--timeline_recorder=endless --timeline_streams=All` | | `--complete_timeline` | `--timeline_recorder=endless --timeline_streams=All` |
| `--startup_timeline` | `--timeline_recorder=startup --timeline_streams=All` | | `--startup_timeline` | `--timeline_recorder=startup --timeline_streams=All` |
+1
View File
@@ -300,6 +300,7 @@ DART_EXPORT bool Dart_IsReloading();
* "Embedder" - Execution of Dart embedder code * "Embedder" - Execution of Dart embedder code
* "GC" - Execution of Dart Garbage Collector * "GC" - Execution of Dart Garbage Collector
* "Isolate" - Dart Isolate lifecycle execution * "Isolate" - Dart Isolate lifecycle execution
* "Microtask" - Execution of Dart microtasks
* "VM" - Execution in Dart VM runtime code * "VM" - Execution in Dart VM runtime code
* "" - None * "" - None
* *
@@ -12,7 +12,7 @@ var tests = <VMTest>[
final result = await vm.invokeRpcNoUpgrade('getVersion', {}); final result = await vm.invokeRpcNoUpgrade('getVersion', {});
expect(result['type'], 'Version'); expect(result['type'], 'Version');
expect(result['major'], 4); expect(result['major'], 4);
expect(result['minor'], 17); expect(result['minor'], 18);
expect(result['_privateMajor'], 0); expect(result['_privateMajor'], 0);
expect(result['_privateMinor'], 0); expect(result['_privateMinor'], 0);
}, },
+3
View File
@@ -10140,6 +10140,7 @@ TEST_CASE(DartAPI_TimelineCategories) {
EXPECT_NOTSUBSTRING("Debugger", js_str); EXPECT_NOTSUBSTRING("Debugger", js_str);
EXPECT_NOTSUBSTRING("Embedder", js_str); EXPECT_NOTSUBSTRING("Embedder", js_str);
EXPECT_NOTSUBSTRING("Isolate", js_str); EXPECT_NOTSUBSTRING("Isolate", js_str);
EXPECT_NOTSUBSTRING("Microtask", js_str);
EXPECT_NOTSUBSTRING("VM", js_str); EXPECT_NOTSUBSTRING("VM", js_str);
} }
@@ -10158,6 +10159,7 @@ TEST_CASE(DartAPI_TimelineCategories) {
EXPECT_NOTSUBSTRING("Debugger", js_str); EXPECT_NOTSUBSTRING("Debugger", js_str);
EXPECT_NOTSUBSTRING("Embedder", js_str); EXPECT_NOTSUBSTRING("Embedder", js_str);
EXPECT_SUBSTRING("Isolate", js_str); EXPECT_SUBSTRING("Isolate", js_str);
EXPECT_NOTSUBSTRING("Microtask", js_str);
EXPECT_NOTSUBSTRING("VM", js_str); EXPECT_NOTSUBSTRING("VM", js_str);
} }
@@ -10176,6 +10178,7 @@ TEST_CASE(DartAPI_TimelineCategories) {
EXPECT_NOTSUBSTRING("Debugger", js_str); EXPECT_NOTSUBSTRING("Debugger", js_str);
EXPECT_NOTSUBSTRING("Embedder", js_str); EXPECT_NOTSUBSTRING("Embedder", js_str);
EXPECT_NOTSUBSTRING("Isolate", js_str); EXPECT_NOTSUBSTRING("Isolate", js_str);
EXPECT_NOTSUBSTRING("Microtask", js_str);
EXPECT_NOTSUBSTRING("VM", js_str); EXPECT_NOTSUBSTRING("VM", js_str);
} }
} }
+1 -1
View File
@@ -19,7 +19,7 @@
namespace dart { namespace dart {
#define SERVICE_PROTOCOL_MAJOR_VERSION 4 #define SERVICE_PROTOCOL_MAJOR_VERSION 4
#define SERVICE_PROTOCOL_MINOR_VERSION 17 #define SERVICE_PROTOCOL_MINOR_VERSION 18
class Array; class Array;
class EmbedderServiceHandler; class EmbedderServiceHandler;
+3 -2
View File
@@ -1,8 +1,8 @@
# Dart VM Service Protocol 4.17 # Dart VM Service Protocol 4.18
> Please post feedback to the [observatory-discuss group][discuss-list] > Please post feedback to the [observatory-discuss group][discuss-list]
This document describes of _version 4.16_ of the Dart VM Service Protocol. This This document describes of _version 4.18_ of the Dart VM Service Protocol. This
protocol is used to communicate with a running Dart Virtual Machine. protocol is used to communicate with a running Dart Virtual Machine.
To use the Service Protocol, start the VM with the *--observe* flag. To use the Service Protocol, start the VM with the *--observe* flag.
@@ -4994,5 +4994,6 @@ version | comments
4.15 | Added `closureReceiver` property to `@Instance` and `Instance`. 4.15 | Added `closureReceiver` property to `@Instance` and `Instance`.
4.16 | Added `reloadFailureReason` property to `Event`. Added `createIdZone`, `deleteIdZone`, and `invalidateIdZone` RPCs. Added optional `idZoneId` parameter to `evaluate`, `evaluateInFrame`, `getInboundReferences`, `getInstances`, `getInstancesAsList`, `getObject`, `getRetainingPath`, `getStack`, and `invoke` RPCs. 4.16 | Added `reloadFailureReason` property to `Event`. Added `createIdZone`, `deleteIdZone`, and `invalidateIdZone` RPCs. Added optional `idZoneId` parameter to `evaluate`, `evaluateInFrame`, `getInboundReferences`, `getInstances`, `getInstancesAsList`, `getObject`, `getRetainingPath`, `getStack`, and `invoke` RPCs.
4.17 | Added `Timer` stream, added `TimerSignificantlyOverdue` event kind, and added `details` property to `Event`. 4.17 | Added `Timer` stream, added `TimerSignificantlyOverdue` event kind, and added `details` property to `Event`.
4.18 | Added `Microtask` timeline stream.
[discuss-list]: https://groups.google.com/a/dartlang.org/forum/#!forum/observatory-discuss [discuss-list]: https://groups.google.com/a/dartlang.org/forum/#!forum/observatory-discuss
+1 -1
View File
@@ -77,7 +77,7 @@ DEFINE_FLAG(charp,
nullptr, nullptr,
"Comma separated list of timeline streams to record. " "Comma separated list of timeline streams to record. "
"Valid values: all, API, Compiler, CompilerVerbose, Dart, " "Valid values: all, API, Compiler, CompilerVerbose, Dart, "
"Debugger, Embedder, GC, Isolate, and VM."); "Debugger, Embedder, GC, Isolate, Microtask, and VM.");
DEFINE_FLAG(charp, DEFINE_FLAG(charp,
timeline_recorder, timeline_recorder,
DEFAULT_TIMELINE_RECORDER, DEFAULT_TIMELINE_RECORDER,
+1
View File
@@ -78,6 +78,7 @@ class Zone;
V(Embedder, "dart:embedder", true) \ V(Embedder, "dart:embedder", true) \
V(GC, "dart:gc", true) \ V(GC, "dart:gc", true) \
V(Isolate, "dart:isolate", true) \ V(Isolate, "dart:isolate", true) \
V(Microtask, "dart:microtask", true) \
V(VM, "dart:vm", true) V(VM, "dart:vm", true)
#endif // defined(SUPPORT_TIMELINE) #endif // defined(SUPPORT_TIMELINE)