Commit graph

41 commits

Author SHA1 Message Date
Siva Annamalai a7107fdd95 Fix some comments.
BUG=

Review URL: https://codereview.chromium.org/2499763002 .
2016-11-11 15:38:55 -08:00
Johnni Winther 8be67929a2 Fix import in sdk/lib/developer
This broke dart2js/analyze_api_test

Review URL: https://codereview.chromium.org/2464083002 .
2016-11-01 12:31:12 +01:00
John McCutchan a0d9975af4 Fix analyzer bots
BUG=

Review URL: https://codereview.chromium.org/2467613002 .
2016-10-31 13:24:39 -07:00
John McCutchan 63e4f69e5e Provide an API to dart:developer to control the web server hosting the Service Protocol
- [x] Add `ServiceProtocolnfo` class to dart:developer.
- [x] Add `Service` class to dart:developer.
- [x] Add `Service.getInfo` static method to dart:developer.
- [x] Add `Service.controlWebServer` static method to dart:developer.

API:

```dart

/// Information about the service protocol.
class ServiceProtocolInfo {
  /// The major version of the protocol.
  final int majorVersion;
  /// The minor version of the protocol.
  final int minorVersion;
  /// The Uri to access the service. If the web server is not running, this
  /// will be null.
  final Uri serverUri;
}

/// Access information about the service protocol and control the web server.
class Service {
  /// Get information about the service protocol.
  static Future<ServiceProtocolInfo> getInfo();

  /// Control the web server that the service protocol is accessed through.
  static Future<ServiceProtocolInfo> controlWebServer({bool enable: false});
}
```

... and add a randomly generated authentication token path prefix that must be passed in to access the service protocol.

Old base url:

Observatory listening on http://127.0.0.1:54804/

New base url:

Observatory listening on http://127.0.0.1:54804/<token>/

For example:

Observatory listening on http://127.0.0.1:54804/PTwjm8Ii8qg=/

Many tools will need to be updated.

Fixes #23320

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

Review URL: https://codereview.chromium.org/2438613002 .
2016-10-31 12:32:23 -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
Seth Ladd a875749e82 add library-level docs to help with importing 2016-04-25 12:41:24 -07:00
John McCutchan 6c33c4b1be Avoid an empty Map allocation in the dart:developer Timelnie API
BUG=
R=fschneider@google.com

Review URL: https://codereview.chromium.org/1888813002 .
2016-04-19 12:29:43 -07:00
John McCutchan 0c11088761 Introduce dart_sdk_lib_copy and make all sdk lib gypi files regular
- rename sdk/lib/io/iolib_sources.gypi to sdk/lib/io/io_sources.gypi so that io is regular with respect to the other sdk libraries.
- Lint sdk/lib/*/*_sources.gypi
- Add dart_sdk_lib_copy gn template.

Related https://github.com/flutter/flutter/issues/1712

R=zra@google.com

Review URL: https://codereview.chromium.org/1692603002 .
2016-02-11 14:23:22 -08:00
John McCutchan 657a3b759d Document ServiceExtensionResponse
Fixes #25758

R=nweiz@google.com

Review URL: https://codereview.chromium.org/1685703005 .
2016-02-10 14:47:36 -08:00
John McCutchan b9b0649b9c dart:developer service extension fixes
Fixes #25724
Fixes Florian Loitsch's emailed request (get rid of k prefix on constants).

- Rename ServiceExtensionResponse constants to not have a 'k' prefix.
- Provide more explanation on how to invoke service extensions (they require an 'isolateId' parameter).
- Require extension method names to begin with "ext." and recommend the template: "ext.package.command" to avoid conflicts with other packages.

R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1680593004 .
2016-02-10 08:54:51 -08:00
John McCutchan d187d4745e Support narrowing a cpu profile to a given time window
- Add optional 'timeOriginMicros' and 'timeExtentMicros' parameters to all CPU profile service protocol RPCs.
- Add test to verify that time filtering works.

R=asiva@google.com

Review URL: https://codereview.chromium.org/1541893002 .
2015-12-21 14:07:49 -08:00
John McCutchan 89c49b9e87 Add dart:developer.postEvent for posting events to the service protocol from Dart code
- Add dart:developer.postEvent for posting events to the service protocol.
- Add 'Extension' service protocol event stream.
- Unit test.
- Update service.md

- Bug fix for logging stream.

R=turnidge@google.com

Review URL: https://codereview.chromium.org/1537523002 .
2015-12-17 09:34:52 -08:00
John McCutchan f3ee772308 Provide list of service protocol extensions in isolate and emit an event when one is registered.
- Doc improvements.
- Type annotation improvements.
- Isolate includes list of currently registered extensions.
- New event kind on isolate stream emitted whenever an extension is registered (IsolateServiceExtensionRegistered).

Fixes https://dartbug.com/25208
Fixes https://dartbug.com/25257

R=turnidge@google.com

Review URL: https://codereview.chromium.org/1527793004 .
2015-12-16 13:49:37 -08:00
John McCutchan a1ed9c6d17 Remove public dart:isolate dependency from dart:developer
- Move code from sdk/lib into runtime/lib.
- Remove dependency on dart:isolate from dart:developer.

R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1522203002 .
2015-12-14 13:26:05 -08:00
John McCutchan 5725b0a0a0 Fast path Dart Timeline events with no arguments to avoid calling JSON.encode
BUG=
R=zra@google.com

Review URL: https://codereview.chromium.org/1441683005 .
2015-11-13 07:47:22 -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 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 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 364f6ac601 Fix error caught by analyzer
BUG=

Review URL: https://codereview.chromium.org/1371353003 .
2015-10-01 10:50:22 -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
keertip 578f3df71c fix comment - add whitespace
BUG=
R=sethladd@google.com

Review URL: https://codereview.chromium.org//1343173004 .
2015-09-21 13:03:01 -07:00
John McCutchan 7052bd6bed Rework service extensions to be safe
- When scheduling a service extension to be invoked, store the closure in an array held in the isolate.
- At the tail of IsolateMessageHandler::HandleMessage, invoke all pending service extension closures.

R=iposva@google.com, turnidge@google.com

Review URL: https://codereview.chromium.org//1299493007 .
2015-08-27 11:23:39 -07:00
Ryan Macnak 360b40a599 Update return type of dart2js patch of dart:developer.log.
Review URL: https://codereview.chromium.org//1302823002 .
2015-08-19 13:42:53 -07:00
Seth Ladd 41e670f913 add void to dart:developer log
BUG=
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org//1295803004 .
2015-08-19 13:01:29 -07:00
John McCutchan 590557dfd0 When no service response is requested, send null back to the service isolate so it can cleanup
BUG=
R=turnidge@google.com

Review URL: https://codereview.chromium.org//1285673003 .
2015-08-11 07:13:09 -07:00
John McCutchan 5f02eb3c62 Move service extension handler execution to a timer
R=iposva@google.com

Review URL: https://codereview.chromium.org//1282883003 .
2015-08-10 14:56:43 -07:00
John McCutchan 0f13b9c931 Allow Dart code to register service protocol handlers
- Add 'registerExtension' to dart:developer
- A service protocol handler must implement ServiceExtensionHandler
- Service extensions can report result OR error code / message

R=turnidge@google.com

Review URL: https://codereview.chromium.org//1270103002 .
2015-08-06 16:20:56 -07:00
John McCutchan a2757141b0 Make dart:developer log more user friendly
- Make required arguments required.
- Validate required arguments in Dart before calling native.
- timestamp is now a DateTime.
- level has a default (ALL).
- sequence number is last + 1 if not provided.

R=lrn@google.com

Review URL: https://codereview.chromium.org//1266053003 .
2015-08-04 07:12:39 -07:00
John McCutchan 7640cf4b85 Fix test failure
patch from issue 1271693003 at patchset 20001 (http://crrev.com/1271693003#ps20001)

Review URL: https://codereview.chromium.org//1270953003 .
2015-08-04 07:05:34 -07:00
William Hesse bdda0eff52 Revert "Change msg to message in debugger function."
This reverts commit 2ae214316c.

BUG=

Review URL: https://codereview.chromium.org//1261203005 .
2015-08-04 15:22:47 +02:00
Lasse R.H. Nielsen 2ae214316c Change msg to message in debugger function.
BUG=23949
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org//1271693003 .
2015-08-04 14:58:13 +02:00
John McCutchan bfd2d4ed2a Refactor dart:developer log to use named parameters
BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org//1247803002 .
2015-07-21 10:01:37 -07:00
John McCutchan f818f9dc0f Support piping log data over the service protocol
BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org//1241683005 .
2015-07-21 07:54:46 -07:00
Seth Ladd 41ed922e4f add one-liner docs to dart:developer
BUG=
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org//1229173002 .
2015-07-09 15:35:04 -07:00
John McCutchan 6e42aec4f6 Deprecate 'dart:profiler' and move functionality to 'dart:developer'
R=sgjesse@google.com

Review URL: https://codereview.chromium.org//1133713006
2015-05-18 11:31:20 -07:00
johnmccutchan@google.com f01c1490f7 Revert 45783
BUG=

Review URL: https://codereview.chromium.org//1138993005

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45784 260f80e4-7a28-3924-810f-c04153c831b5
2015-05-14 00:32:32 +00:00
johnmccutchan@google.com 95515238cc Move 'dart:profiler' contents into 'dart:developer' and remove 'dart:profiler'
BUG=
R=iposva@google.com

Review URL: https://codereview.chromium.org//1139503002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45783 260f80e4-7a28-3924-810f-c04153c831b5
2015-05-13 23:48:04 +00:00
rmacnak@google.com 016214f002 Add Debugger.inspect. 1976 here we come!
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org//1132153002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45664 260f80e4-7a28-3924-810f-c04153c831b5
2015-05-08 22:18:43 +00:00
johnmccutchan@google.com 1f851efdbb Rename 'dart:debugger' to 'dart:developer'
- Rename 'dart:debugger' to 'dart:developer'
- Make 'breakHere' and 'breakHereIf' top level functions.

R=iposva@google.com

Review URL: https://codereview.chromium.org//1132113002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45658 260f80e4-7a28-3924-810f-c04153c831b5
2015-05-08 21:24:57 +00:00