Commit Graph

119 Commits

Author SHA1 Message Date
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
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
John McCutchan 2ff1c28978 Emit Timeline events for most Dart_API calls
- Remove --trace-api and related macros.
- Emit Timeline events on the API stream for Dart_API calls.

R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1526463005 .
2015-12-15 10:27:22 -08:00
John McCutchan cc9b72411d Add TimelineBeginEndScope helper class
- Refactor TimelineDurationScope into TimelineEventScope.
- Reintroduce TimelineDurationScope based on TimelineEventScope.
- Add TimelineBeginEndScope.

R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1529613002 .
2015-12-14 12:45:39 -08:00
Ivan Posva f887b03b5b - Assert that we do not hold the timeline lock while entering
potential safepoints.
- Enable timeline for existing test as a regression test.
- Fix allocation with timeline lock held during deoptimization to
  prevent deadlock.

BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1514653002 .
2015-12-09 13:41:42 -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 43b0ae00e7 Timeline service protocol support with Observatory UI
Service Protocol:
- _clearVMTimeline (clear timeline)
- _getVMTimeline (fetch timeline)
- _setVMTimelineFlag (control recording)
- _getVMTimelineFlag (...)
- _getVMTimeline service unit test

Observatory:
- timeline page with record on/off, clear timeline, and refresh buttons.
- trace-viewer based timeline view that runs in an iframe driven by a small javascript program

Misc:
- Fix default enable logic bugs
- Add 'Debugger Pause' timeline event
- Threads can have a name and that name will be displayed in Observatory
- Tighten up locking when printing JSON

R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1406413006 .
2015-11-10 08:02:22 -08:00
John McCutchan bb745e888e Fix build
BUG=

Review URL: https://codereview.chromium.org/1406093003 .
2015-10-20 09:39:22 -07: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 da946fbf99 Simplify timeline backend
Now that we have a central list of all threads that are interacting with the VM we can stop relying on the Isolate's thread registry to cache timeline blocks.

- Move from caching blocks in the Isolate's thread registry and caching them in the Thread directly.
- This allows cached blocks to have events from multiple isolates, increasing usage density and reducing the number of blocks being cached at any given time.
- We no longer need a distinct global block, this allows me to remove a bunch of dead code.

R=turnidge@google.com

Review URL: https://codereview.chromium.org/1402383003 .
2015-10-16 13:36:58 -07:00
John McCutchan fbcccc25a5 Hookup --complete-timeline flag
BUG=
R=zra@google.com

Review URL: https://codereview.chromium.org/1403273002 .
2015-10-15 10:03:50 -07:00
John McCutchan 9416219c28 Fix racey crash in TimelineDurationScope
BUG=
R=zra@google.com

Review URL: https://codereview.chromium.org/1402203003 .
2015-10-14 14:02:00 -07:00
John McCutchan 7137f9ef06 Stop holding onto TimelineEvents
Due to the need to reclaim TimelineEventBlocks from the system, it is not safe to hold onto a TimelineEvent other than briefly to fill it out.

- Switch TimelineDurationScope to emit two events (begin, end) instead of one duration event.
- When setting duration arguments, hold them in the TimelineDurationScope and then emit them with the end event.

The above two changes allows TimelineDurationScope to work without holding onto a TimelineEvent.

To stop the block from being reclaimed while we are filling out an event, calls to StartEvent return with a lock held that is unlocked when CompleteEvent is called.

- Update tests.

R=turnidge@google.com

Review URL: https://codereview.chromium.org/1395803002 .
2015-10-08 14:56:25 -07:00
John McCutchan 979b7868ca Add support to timeline for begin and end events
- Add support for begin and end even kinds.
- Update TimelineAnalysis to properly account for begin and end events as well as duration events.
- Add unit test for analysis of timelines with begin and end events.

R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1386263002 .
2015-10-07 14:11:44 -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
John McCutchan 3d0c4bf586 Make timeline use the same clock source as mojo's tracing infrastructure
- This ensures that we have consistent timestamps across processes.
- This is necessary to properly support mojo.
- Add new public API to query timeline clock.

R=rmacnak@google.com

Review URL: https://codereview.chromium.org//1367973004 .
2015-09-25 10:04:23 -07:00
John McCutchan 8685d2ebf5 Add OSThread::GetCurrentThreadTraceId and use it in the timeline implementation
- This ensures our trace-event thread ids match the thread ids used in Chromium's base.

R=rmacnak@google.com

Review URL: https://codereview.chromium.org//1368793002 .
2015-09-24 14:57:30 -07:00