Commit graph

37 commits

Author SHA1 Message Date
Derek Xu 193c4ccbb9 [VM/Timeline] Store an array of flow IDs in each dart::TimelineEvent
instead of just one ID

Sometimes the Flutter Engine is associating events with multiple flows,
this change is needed to allow events to be associated with multiple
flows in a Perfetto-format trace.

TEST=Checked the flow events reported through dart:developer still
looked correct when retrieved in Perfetto traces.

Change-Id: I2901ffde5e8b984abb1e924e014722bb0568f6d3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/305801
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
2023-05-26 13:08:27 +00:00
Derek Xu afa3594ca1 [VM/Timeline] Support flow events in the Perfetto file recorder
This supports flow events reported through dart:developer, but does not
support ones reported with Dart_TimelineEvent in dart_tools_api.h. That
will have to be supported in a future CL.

TEST=CI, manually verifying that flow arrows appeared on flow events in
the trace viewer for traces recorded with our Perfetto recorder

Change-Id: Ic75a8ce277b436a609c027c2c0d4e94b51031aa7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280740
Reviewed-by: Stephen Adams <sra@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
2023-04-20 16:42:23 +00:00
Ryan Macnak 4176d8a02c [vm] Update NULL to nullptr in runtime/lib.
TEST=build
Change-Id: I883dd0516519b175eb15b530776499248a3e0759
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/292061
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2023-03-30 19:28:28 +00:00
Ryan Macnak e5fc6d652b [vm] Don't pass and copy unused category string when recording timeline events.
TEST=ci
Change-Id: I53b60a977c2b33d29a0ca685120044ba208d3ae4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/258321
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-09-08 22:02:46 +00:00
Ryan Macnak 2d13b205d7 Reland "[vm] Generate event ids for synchronous begin and end events."
Fix transposed id and timestamp.

TEST=Instruments, ci
Bug: https://github.com/dart-lang/sdk/issues/49178
Change-Id: I2c2650f28050b179d26e1269729727f58201a8a8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251581
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2022-07-22 19:13:47 +00:00
Gary Qian 03e5f9f941 Revert "Reland "[vm] Generate event ids for synchronous begin and end events.""
This reverts commit 05e5664ad6.

Reason for revert: Blocking Flutter engine -> framework roll, https://github.com/flutter/flutter/pull/107653/checks?check_run_id=7341814911

Invalid argument(s): durations is empty!
package:flutter_driver/src/driver/timeline_summary.dart 414:7   TimelineSummary._averageInMillis
package:flutter_driver/src/driver/timeline_summary.dart 72:12   TimelineSummary.computeAverageFrameRasterizerTimeMillis
package:flutter_driver/src/driver/timeline_summary.dart 232:47  TimelineSummary.summaryJson


Original change's description:
> Reland "[vm] Generate event ids for synchronous begin and end events."
>
> TEST=Instruments
> Bug: https://github.com/dart-lang/sdk/issues/49178
> Change-Id: I5ecb76e468d32e120de338e802ec313a7f50a49c
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251144
> Commit-Queue: Ryan Macnak <rmacnak@google.com>
> Reviewed-by: Siva Annamalai <asiva@google.com>

TBR=rmacnak@google.com,asiva@google.com

Change-Id: I52fffe00ec141a486241fa8719d4cf12df168384
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: https://github.com/dart-lang/sdk/issues/49178
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251561
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2022-07-14 17:21:25 +00:00
Ryan Macnak 05e5664ad6 Reland "[vm] Generate event ids for synchronous begin and end events."
TEST=Instruments
Bug: https://github.com/dart-lang/sdk/issues/49178
Change-Id: I5ecb76e468d32e120de338e802ec313a7f50a49c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251144
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2022-07-13 21:59:33 +00:00
Zach Anderson d7df61e042 Revert "[vm] Generate event ids for synchronous begin and end events."
This reverts commit 7fe44864d6.

Reason for revert: https://github.com/flutter/flutter/issues/106957

Original change's description:
> [vm] Generate event ids for synchronous begin and end events.
>
> os_signposts needs explicit ids to match begin and end events, whereas all other trace systems do this implicitly.
>
> TEST=Instruments
> Bug: https://github.com/dart-lang/sdk/issues/49178
> Change-Id: Ifeeaa1dfe823a0d5668f48b8c584f8bdeef23212
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249951
> Reviewed-by: Siva Annamalai <asiva@google.com>
> Commit-Queue: Ryan Macnak <rmacnak@google.com>

TBR=rmacnak@google.com,asiva@google.com

Change-Id: Id86959d08b5352b5446b6f294a8302b88b4fa0c8
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: https://github.com/dart-lang/sdk/issues/49178
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250403
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Liam Appelbe <liama@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Liam Appelbe <liama@google.com>
2022-07-01 16:08:40 +00:00
Ryan Macnak 7fe44864d6 [vm] Generate event ids for synchronous begin and end events.
os_signposts needs explicit ids to match begin and end events, whereas all other trace systems do this implicitly.

TEST=Instruments
Bug: https://github.com/dart-lang/sdk/issues/49178
Change-Id: Ifeeaa1dfe823a0d5668f48b8c584f8bdeef23212
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249951
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-06-30 16:48:36 +00:00
Ryan Macnak b1c09ecd8f [vm] Make naming more consistent when converting between handles, tagged and untagged pointers.
Currently we have things called XPtr which are not what you get from ptr().

Old world:
handle->raw() returns RawObject* (tagged)
raw_obj->ptr() returns RawObject* (untagged)

After 6fe15f6df9:
handle->raw() returns ObjectPtr
obj_ptr->ptr() returns ObjectLayout*

New world:
handle->ptr() returns ObjectPtr
obj_ptr->untag() returns UntaggedObject*

TEST=ci
Change-Id: I6c7f34014cf20737607caaf84979838300d12df2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149367
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2021-01-15 23:32:02 +00:00
Ryan Macnak 5804537b83 [vm, timeline] Following switch from Duration events to Begin-End event pairs, avoid separate native call transitions to query the monotonic and thread clocks.
Bug: https://github.com/dart-lang/sdk/issues/39727
Change-Id: Ie38947c63845f13d660cb4a367681fed31796473
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128564
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2020-01-02 23:13:06 +00:00
Ryan Macnak 06a1e6e9e3 [vm] Enable timeline on Fuchsia even in product mode.
On Fuchsia, the timeline is accessed without involving the service isolate or vm-service.

Change-Id: Ia0d4e1ca252604e8fcef466a31e3d2a8b0912251
Reviewed-on: https://dart-review.googlesource.com/c/90100
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-01-18 00:06:10 +00:00
Ryan Macnak 07f95e7761 Revert "[vm] Enable timeline on Fuchsia even in product mode."
This reverts commit 3f7b371f2c.

Reason for revert: Some modes failing to find new constant?

Original change's description:
> [vm] Enable timeline on Fuchsia even in product mode.
> 
> On Fuchsia, the timeline is accessed without involving the service isolate or vm-service.
> 
> Change-Id: I0d2351dcadcfc47835732235e1b8fafa8212f883
> Reviewed-on: https://dart-review.googlesource.com/c/89880
> Reviewed-by: Zach Anderson <zra@google.com>
> Commit-Queue: Ryan Macnak <rmacnak@google.com>

TBR=rmacnak@google.com,alexmarkov@google.com,zra@google.com,asiva@google.com

Change-Id: Ic03a78d14821e0361d54587f1f7510bc9ebfef1c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/89942
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-01-17 00:39:39 +00:00
Ryan Macnak 3f7b371f2c [vm] Enable timeline on Fuchsia even in product mode.
On Fuchsia, the timeline is accessed without involving the service isolate or vm-service.

Change-Id: I0d2351dcadcfc47835732235e1b8fafa8212f883
Reviewed-on: https://dart-review.googlesource.com/c/89880
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-01-16 22:55:51 +00:00
Daco Harkes 14ff2110ce [vm] refactor native entry and native entry type arguments
Change-Id: I03efbbf4340de1c8f23c60854ed991671ca2b647
Reviewed-on: https://dart-review.googlesource.com/c/87077
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Samir Jindel <sjindel@google.com>
2018-12-13 19:29:26 +00:00
Ryan Macnak 3d21a46b72 Limit preserialized JSON for timeline events from Dart code to the arguments.
Avoids string copies in C++ and map copies in Dart.

Also remove some vestiages of removed feature that allowed an embedder to add pre-encoded events to the timeline.

Change-Id: I962a67093ba461c991d9169b0391c44af1d489db
Bug: https://github.com/dart-lang/sdk/issues/30787
Reviewed-on: https://dart-review.googlesource.com/6762
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
2017-09-19 23:29:55 +00:00
Zachary Anderson 633ed4cf83 [corelib] dart:developer timeline flow events
This change adds an API to dart:developer Timeline for
adding flow events to the timeline. For details see the
changes in:

sdk/lib/developer/timeline.dart

R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2985253002 .
2017-07-31 07:46:52 -07:00
Zachary Anderson 350ad3a4dc Special-case Timeline.{start,finish}Sync for Fuchsia
R=asiva@google.com

Review-Url: https://codereview.chromium.org/2984603002 .
2017-07-21 08:06:36 -07:00
Zachary Anderson 6cd8a79078 VM: Re-format to use at most one newline between functions
R=asiva@google.com

Review-Url: https://codereview.chromium.org/2974233002 .
2017-07-13 08:08:37 -07:00
Zachary Anderson 2e4dfd3a2d clang-format runtime/lib
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/2468093007 .
2016-11-04 12:14:41 -07:00
Siva Annamalai 06a3687ec3 More #ifndef PRODUCT changes.
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/2156443002 .
2016-07-14 18:27:55 -07:00
Zachary Anderson a503570e3a Fuchsia: Initial check-in.
Instructions to build and run are in README.fuchsia.

R=asiva@google.com

Review URL: https://codereview.chromium.org/2117593002 .
2016-07-01 12:42:05 -07:00
John McCutchan 84e1fe5cb5 Add an intrinsified early out path for Dart timeline calls
BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1985813002 .
2016-05-17 09:45:28 -07:00
John McCutchan 62f9135490 Dart Timeline improvements
- [x] Add _getThreadCpuClock to dart:developer.
- [x] Report CPU usage for Dart synchronous timeline blocks.
- [x] GetEnvironmentValue for 'dart.vm.product' will return "true" or "false" depending on whether or not we are running in product mode.
- [x] Early out of Dart timeline calls if we are running in product mode.

R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1966833002 .
2016-05-10 14:31:33 -07:00
John McCutchan c65114b6b4 Timeline API fixes for Flutter
API changes:

- Remove isolate specific Timeline APIs.
- Remove Dart_EmbedderTimelineGetTimeline callback.
- Add Dart_TimelineEvent so that arbitrary trace events can be added.

Internal changes:

- Remove isolate specific streams which were never used or controllable from outside the VM.

R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1811613002 .
2016-03-16 12:18:46 -07:00
Regis Crelier bb649318e4 Remove support for Javascript warnings in the VM.
This cl is a clone of cl https://codereview.chromium.org/1683363002/ deleted by
accident. Already LGTM'ed.

Review URL: https://codereview.chromium.org/1690903003 .
2016-02-11 09:16:06 -08:00
John McCutchan e2e7af1229 Remove more feature in product mode
- Remove Timeline.
- Remove more vmservice code.
- Remove AST printing.
- Remove IL printing.
- Remove profiler.
- Remove thread interrupter.
- Remove disassembler.
- Remove Library::CheckFunctionFingerprints.

- Update test status files for product mode.

Size of dart_bootstrap before: 5287631
Size of dart_bootstrap after: 5112783

Reduction in size: 174848 bytes.

Total reduction in size (382734 + 174848): 557582 bytes.

R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1678203002 .
2016-02-09 08:45:32 -08:00
John McCutchan c580f7f393 Don't conflate Timeline serialized json with event type
- Makes event setup (event type, timestamps, etc) regular.
- Allows any event type to have pre-serialized JSON.

R=asiva@google.com

Review URL: https://codereview.chromium.org/1554623003 .
2015-12-30 12:48:23 -08:00
John McCutchan ccfd7a8c08 Handle duration events when filtering the timeline for a time range
BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org/1545853002 .
2015-12-28 14:49:06 -08:00
John McCutchan bedd2cbf25 Support narrowing a timeline to a given time window
- Assign correct timestamps for timeline events from Dart code.
- Support optional 'timeOriginMicros' and 'timeExtentMicros' to _getVMTimeline service RPC.
- Relax time extent check in profiler.

R=asiva@google.com

Review URL: https://codereview.chromium.org/1533323004 .
2015-12-22 09:18:45 -08:00
Ryan Macnak c99df050b1 Use a monotonic clock in the implementation of Stopwatch.
Rename OS::GetCurrentTraceMicros() to OS::GetCurrentMonotonicMicros().

BUG=http://dartbug.com/477
BUG=http://dartbug.com/12383
R=iposva@google.com

Review URL: https://codereview.chromium.org/1504523002 .
2015-12-08 10:12:05 -08:00
Siva Annamalai 9e19d236ca - Add an OSThread structure which is the generic TLS structure for all C++
fields in a thread (i.e fields that are not Dart VM related)
- Split the Thread structure to be a pure Dart per thread structure and add
  a pointer to os_thread which points to the OSThread structure
- Change Schedule/UnSchedule to set the Dart Thread structure as the TLS of
  the thread when it is inside the Dart world and reset the TLS back to the
  OSThread strcuture when is exits the Dart World.
- Moved the stack_base and few stack size related functions to OSThread from Isolate

R=johnmccutchan@google.com, zra@google.com

Review URL: https://codereview.chromium.org/1439483003 .
2015-11-19 13:45:10 -08:00
John McCutchan 291befa1cd Redo TimelineTask API
A TimelineTask represents an asynchronous track of operations on the timeline.

The old API allowed multiple isolates to emit events simultaneously on the same task or to start / finish events in any order. This isn't supported by our UI and probably many other tools that consume trace-event.

With this change, operations within a TimelineTask must complete in the reverse order of their start calls (aka a stack). You can pass a TimelineTask from one isolate to another but you must first complete all open operations before passing it.

Example:

var task = new TimelineTask();

task.start('Some phase');
await someFuture;
task.finish();

Also: Add support for instant events.

R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1412183008 .
2015-11-11 10:59:38 -08:00
John McCutchan f55de246ec More timeline cleanups
- Blocks are associated with threads and not isolates.
- Fix isolate filters when iterating over blocks and events.
- Always add the isolateNumber argument when serializing events.
- Add new (kSerializedJSON) EventType for events already serialized to JSON.
- Have events coming from Dart code use the standard event structure w/ type = kSerializedJSON.
- Remove now unused DartTimelineEvent and machinary.
- Dart and C++ events now use the same structures and system.

R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1411783004 .
2015-10-20 09:14:23 -07:00
John McCutchan 1a0066816d Add support for emitting asynchronous timeline events from Dart code
BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1397823002 .
2015-10-09 10:21:02 -07:00
John McCutchan 7b01e5fa11 Fix Mac dartium build
BUG=

Review URL: https://codereview.chromium.org/1380103006 .
2015-10-01 11:26:41 -07:00
John McCutchan 03b41129a2 Add Timeline to dart:developer
- This CL only adds support for synchronous blocks of time. A follow up CL will add asynchronous blocks of time.
- Reports true thread id to tracing system. This is an improvement over Mojo's tracing helper.
- Dart events are included in individual isolate traces and global traces obtained via the embedders API.
- Dart events are included in the write to disk path (--timeline_dir).

R=rmacnak@google.com

Review URL: https://codereview.chromium.org//1377663002 .
2015-10-01 09:30:47 -07:00