Commit Graph

86 Commits

Author SHA1 Message Date
Ryan Macnak bfb9fae597 [vm] Don't keep events in memory when using systrace/traceutil.
Change-Id: Ic784e1f6c95d1c544958ec5510c168d3d58f50fb
Reviewed-on: https://dart-review.googlesource.com/48820
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
2018-04-02 18:34:35 +00:00
Ryan Macnak d9c3190e44 [vm] Remove some bin -> vm includes.
Change-Id: Id304de9618a299a201b946a901a54352772f56fb
Reviewed-on: https://dart-review.googlesource.com/48704
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-03-28 23:16:09 +00:00
Ryan Macnak 558a931409 [vm] Move some string utils from runtime/vm to runtime/platform.
Change-Id: I552086445a7e07792f9da85afa5edf23b6c450d5
Reviewed-on: https://dart-review.googlesource.com/44402
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-03-01 02:07:46 +00:00
Ryan Macnak b247090c9e [vm] Align old-space pages.
Allows quick access to the page header for any old-space object, which is a convenient place to keep forwarding information.

Also combine the reserve and commit operations of VirtualMemory.

Bug: https://github.com/dart-lang/sdk/issues/30978
Change-Id: Id3fe06932f7bef882bb1cc29d72441b0a3602eb6
Reviewed-on: https://dart-review.googlesource.com/17046
Reviewed-by: Erik Corry <erikcorry@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
2017-10-30 22:02:20 +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
Carlo Bernaschina 84b2323e6c Fix memory leak in TimelineEventArguments
TBR=zra@google.com

Change-Id: I0bc8d4da9d38e9deb459ffe7cce5703184546f62
Reviewed-on: https://dart-review.googlesource.com/4240
Reviewed-by: Carlo Bernaschina <cbernaschina@google.com>
2017-09-07 23:00:22 +00:00
Carlo Bernaschina 0e32851cfd Add Timeline Dashboard hidden page in Observatory
- Refactoring of the TimelinePage in order to remove the
  dependencies from the Service objects.
- Implemented TimelineRepository to abstract the communication layer
- Structured new TimelineDashboardPage with simplified UI and event
  filtering

The VM returns lists of events which are forwarded to Catapult.
Some events are white-listed for the common user.
Due to limitations in the way the events are generated the only way to
attach the white-list flag to the events is by adding an extra argument.
By setting the hash of timeline.html to #basic we inform JavaScript that
we require the activation of the filter which forwards just the events
white-listed to Captapult, while preserving all the others during
dumping operations.

See https://docs.google.com/document/d/1sDKI3ROYM1ORaKhelt063ayfveF_6WC8aq9MiqHjYBs/edit#

Change-Id: I38435d8d32f37305ce3c366daf55f82e8287959d
Reviewed-on: https://dart-review.googlesource.com/3346
Commit-Queue: Carlo Bernaschina <cbernaschina@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
2017-09-07 20:38:19 +00:00
Zachary Anderson 2109b248d3 Fixes build for uninitialized local variable.
Review-Url: https://codereview.chromium.org/2990023002 .
2017-07-31 08:42:13 -07: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
Ryan Macnak 00290c3813 Allocate the fixed-size timeline buffer with virtual memory instead of malloc.
Allows naming the memory region; removes some pressure from jemalloc.

R=zra@google.com

Review-Url: https://codereview.chromium.org/2984313002 .
2017-07-27 13:37:41 -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
Zach Anderson 412283a763 [Fuchsia] Switch to cwriter tracing API.
The cwriter API allows us to directly pass timestamps and
programmatically assemble arguments.

BUG=
R=zra@google.com

Review-Url: https://codereview.chromium.org/2981323002 .
2017-07-19 15:04: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
Ryan Macnak 5a02f3819b [vm] Support flow events in Dart_TimelineEvent.
Issue https://github.com/dart-lang/sdk/issues/30142

R=zra@google.com

Review-Url: https://codereview.chromium.org/2977663003 .
2017-07-12 10:18:10 -07:00
Zachary Anderson b3200f4664 [Fuchsia] Routes timeline events to Fuchsia's tracing app
This CL routes timeline events to Fuchsia's tracing app when the
following arguments are passed to the VM:

--systrace_timeline
--timeline_recorder=systrace
--timeline_streams=[some streams here]

I'll add these arguments to the Flutter engine for Fuchsia after this
CL lands.

TO-367

R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2977513002 .
2017-07-11 14:12:27 -07:00
Ryan Macnak 877284947b Rename TARGET_OS_* to HOST_OS_*.
Like HOST_ARCH_*, HOST_OS_* describes the OS the VM is running on, which may be different from the OS the VM is generating code for during AOT compilation.

Currently we conflate the two when emitting AOT as assembly, and we get away with it because Flutter only uses assembly for targeting iOS and one can only target iOS from a Mac, but we expect to use assembly for Android as well so native tools can unwind Dart frames.

R=zra@google.com

Review-Url: https://codereview.chromium.org/2750843003 .
2017-03-15 13:11:05 -07:00
Martin Kustermann dd91dd2319 VM: Free [TimelineEventBlock]s before shutting down
R=vegorov@google.com

Review-Url: https://codereview.chromium.org/2621163008 .
2017-01-12 14:02:00 +01:00
Zachary Anderson a1bcf051d8 clang-format runtime/vm
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/2481873005 .
2016-11-08 13:54:47 -08:00
John McCutchan 079ced0367 Fix Windows build
BUG=

Review URL: https://codereview.chromium.org/2323073002 .
2016-09-08 12:32:34 -07:00
John McCutchan ea535f2d9b Fix Mac build
BUG=

Review URL: https://codereview.chromium.org/2320183002 .
2016-09-08 11:32:38 -07:00
John McCutchan ed3f4f2dfe Record Timeline to Android Systrace
- [x] Add TimelineEventSystraceRecorder (enabled via --systrace_timeline or --timeline_recoder=systrace)
- [x] Support Begin, End, and Counter events
- [x] Unit test Systrace serialization

BUG=
R=chinmaygarde@google.com, rmacnak@google.com

Review URL: https://codereview.chromium.org/2315353004 .
2016-09-08 11:28:34 -07:00
Ryan Macnak d418dde65b Reduce copying in sending service responses.
Add missing safepoint transitions.

Issue #27092
Likely contributes to Issue #27010

dart2js hello
Peak RSS at first Observatory visit -> Peak RSS after visiting timeline (with endless recorder)
Before 215M -> 321M
After 182M -> 233M

R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/2254543006 .
2016-08-18 10:34:50 -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 d1d3ba587b Cleanup timeline stream enabled flag so that it can be easily tested from an intrinsic
- Drop no-longer used globally enabled stream flags. This leaves just one source of truth.
- Kill 'Enabled()' for 'enabled()'.
- Store pointer to Timeline::DartStream in Thread.
- Store enabled as an uintptr_t instead of a bool to make it easier for generated code to access.

R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1975203003 .
2016-05-16 10:30:48 -07:00
John McCutchan 6b270752f6 Only call OS::GetCurrentThreadCPUMicros when a TimelineDurationScope is enabled
OS::GetCurrentThreadCPUMicros is expensive on Mac.

Fixes #26423

R=iposva@google.com

Review URL: https://codereview.chromium.org/1975713003 .
2016-05-12 13:06:25 -07:00
John McCutchan db07faaa8c Improve Observatory Timeline UI
- [x] Remove Stop / Start buttons and replace with fine grained category control.
- [x] Restrict the cpu profile to the time span of the timeline.
- [x] Display recorder name.
- [x] Show a popup when fetching the timeline from the VM.
- [x] Show a popup when fetching the cpu profile(s) from the VM.

Fixes #26401
Fixes #26394

BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1972523003 .
2016-05-12 07:16:19 -07:00
John McCutchan 962be57551 Fix timeline time origin / extent printing with an empty timeline
BUG=

Review URL: https://codereview.chromium.org/1968683004 .
2016-05-11 15:34:15 -07:00
John McCutchan 234cb9cc03 Report 'timeOriginMicros' and 'timeExtentMicros' in Timeline and Profile service responses
These values will be used in the UI soon.

BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1964163002 .
2016-05-11 14:23:22 -07:00
John McCutchan f6b570aa2a Include thread CPU time in Timeline.
- [x] Refactor old OSThread interface for querying thread CPU time into OS::GetCurrentThreadCPUMicros.
- [x] Add data to TimelineEvent to track thread CPU time.
- [x] Include "tts" and "tdur" properties when converting the timeline to JSON

Fixes #26396

BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1960483002 .
2016-05-05 16:34:09 -07:00
John McCutchan ec1cb0c8f3 Fix --startup-timeline
BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1899273002 .
2016-04-19 10:41:45 -07:00
John McCutchan d17214fda0 Add --timeline-recorder= flag and fix --timeline-dir flag
- Add --timeline-recorder= flag to allow explicit control over the recorder used.
- Fix crash when using THR_Print early in VM startup.
- Fix crash when using --timeline-dir to dump timeline to disk.

R=hausner@google.com

Review URL: https://codereview.chromium.org/1897963002 .
2016-04-19 09:21:59 -07:00
Ryan Macnak 0555b799cd Timeline: Copy event labels of embedder events.
Fixes use-after-free of the label for the 'SkyActivity.onSkyReady' event.

BUG=
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/1882313002 .
2016-04-15 09:48:07 -07:00
John McCutchan 6302c1cc41 Add API to set thread name
BUG=
R=chinmaygarde@google.com, rmacnak@google.com

Review URL: https://codereview.chromium.org/1851953002 .
2016-04-04 07:12:57 -07:00
John McCutchan d8df41c483 Add support for async, metadata, and counter timeline events to be reported by the embedder
Fixes #26142

R=chinmaygarde@google.com

Review URL: https://codereview.chromium.org/1849643002 .
2016-03-30 16:45:46 -07:00
Ryan Macnak 1666393f89 Timeline: If the embedder stream is enabled at startup, invoke the embedder's callback to let it know.
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/1836303002 .
2016-03-29 13:22:36 -07:00
Ryan Macnak 1539647e4d Add a timeline recorder that drops new events after its buffer is full.
(With --complete-timeline, my iPod runs of memory processing the
timeline. With the ring recorder, the startup events have already been
bumped out by time I can connect to Observatory.)

BUG=
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/1834383002 .
2016-03-29 11:01:45 -07:00
Siva Annamalai f7d2b2e31e - Fix for issue 25950 (add registration of a thread exit callback)
- Moved some of the file and entropy callbacks to class Dart from
  class Isolate as they are not isolate specific.

R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/1807293002 .
2016-03-17 13:40:20 -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
John McCutchan 9bc7398eb8 Ensure embedder timeline callbacks are called for service protocol requests
BUG=
R=chinmaygarde@google.com, rmacnak@google.com

Review URL: https://codereview.chromium.org/1799933002 .
2016-03-15 07:59:04 -07:00
John McCutchan 53cae0aed9 Add ability for embedder to provide private timeline trace data
- Add three new embedder hooks registered with Dart_SetEmbedderTimelineCallbacks
  - Dart_EmbedderTimelineStartRecording
  - Dart_EmbedderTimelineStopRecording
  - Dart_EmbedderTimelineGetTimeline

- Add unit test for record start / stop notification.
- Add unit test for get timeline.

This should allow Flutter to remove their hacked up timeline service RPCs.

R=chinmaygarde@google.com, rmacnak@google.com

Review URL: https://codereview.chromium.org/1783953002 .
2016-03-10 13:32:48 -08:00
John McCutchan 32abe2ce55 Stream blocks of timeline events over the service protocol. Can be used to monitor long running programs without buffering all events inside the VM.
- Rename TimelineEventStreamingRecorder to TimelineEventCallbackRecorder. Note that this should only be used for tests.

- Add 'Timeline' service event stream.
- Send a 'TimelineEvents' event on the 'Timeline' stream whenever a TimelineEventBlock is finished and the 'Timeline' stream is subscribed to.

- Simple service protocol test.

R=turnidge@google.com

Review URL: https://codereview.chromium.org/1765563002 .
2016-03-04 12:30:50 -08:00
John McCutchan 87b1ead8f5 Fix windows build by not using strcasestr
- Also fix no_support_timeline test.

Review URL: https://codereview.chromium.org/1692743003 .
2016-02-12 14:02:09 -08:00
John McCutchan cda760915c Add fine grained command line and service protocol control over timeline streams recording
- Add --timeline-streams= flag which takes a comma separated list of streams to record.
- Send "availableStreams" and "recordedStreams" in the _getVMTimelineFlags RPC. Also include the type of recorder we are using.
- Enable setting of "recordedStreams" in the _setVMTimelineFlags RPC.

R=zra@google.com

Review URL: https://codereview.chromium.org/1690333002 .
2016-02-12 13:18:25 -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 d295b9c311 Remove many features when building product mode
Move all JSON printing code from object.cc to object_service.cc.

Not compiled in:

- Service protocol
- Debugger
- Debugger API
- JSONStream
- ObjectIdRing
- Profiler service
- Object JSON printing

Size of dart_bootstrap before: 5670365 bytes
Size of dart_bootstrap after: 5287631 bytes

Reduction in size: 382734 bytes.

R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1660063002 .
2016-02-05 09:55:51 -08:00
John McCutchan 33aaf940e5 Output TimelineEventBlocks in sorted order
- Before outputting to JSON sort TimelineEventBlocks by earliest event time.
- Output using sorted block order.
- Works around a bug in mojo (https://github.com/domokit/mojo/issues/649)

R=zra@google.com

Review URL: https://codereview.chromium.org/1657843003 .
2016-02-01 13:12:34 -08:00
John McCutchan c4bbf89fe1 Fix Timeline reporting crash when reusing timeline events with preserialized json
BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1644023003 .
2016-01-28 16:20:30 -08:00
John McCutchan e06ad0b01c Re-enable Dart_Api Timeline tracing
BUG=
R=fschneider@google.com

Review URL: https://codereview.chromium.org/1584003002 .
2016-01-15 13:38:02 -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