Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(774)

Unified Diff: sdk/lib/developer/timeline.dart

Issue 1966833002: Dart Timeline improvements (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sdk/lib/developer/developer.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/developer/timeline.dart
diff --git a/sdk/lib/developer/timeline.dart b/sdk/lib/developer/timeline.dart
index 362832dad25a41f574d7613c49b9b8742e6d2b9b..77aeb24553206101f5fb4f72673a913392acaa48 100644
--- a/sdk/lib/developer/timeline.dart
+++ b/sdk/lib/developer/timeline.dart
@@ -4,6 +4,8 @@
part of dart.developer;
+final bool _isProduct = const bool.fromEnvironment("dart.vm.product");
rmacnak 2016/05/10 21:20:00 const bool _isProduct ...
Cutch 2016/05/10 21:30:19 Done.
+
typedef dynamic TimelineSyncFunction();
typedef Future TimelineAsyncFunction();
@@ -13,12 +15,15 @@ class Timeline {
/// a [Map] of [arguments]. This operation must be finished before
/// returning to the event queue.
static void startSync(String name, {Map arguments}) {
+ if (_isProduct) {
+ return;
+ }
if (name is! String) {
throw new ArgumentError.value(name,
'name',
'Must be a String');
}
- var block = new _SyncBlock._(name, _getTraceClock());
+ var block = new _SyncBlock._(name, _getTraceClock(), _getThreadCpuClock());
if (arguments is Map) {
block._appendArguments(arguments);
}
@@ -27,6 +32,9 @@ class Timeline {
/// Finish the last synchronous operation that was started.
static void finishSync() {
+ if (_isProduct) {
+ return;
+ }
if (_stack.length == 0) {
throw new StateError(
'Uneven calls to startSync and finishSync');
@@ -39,6 +47,9 @@ class Timeline {
/// Emit an instant event.
static void instantSync(String name, {Map arguments}) {
+ if (_isProduct) {
+ return;
+ }
if (name is! String) {
throw new ArgumentError.value(name,
'name',
@@ -101,6 +112,9 @@ class TimelineTask {
/// Start a synchronous operation within this task named [name].
/// Optionally takes a [Map] of [arguments].
void start(String name, {Map arguments}) {
+ if (_isProduct) {
+ return;
+ }
if (name is! String) {
throw new ArgumentError.value(name,
'name',
@@ -116,6 +130,9 @@ class TimelineTask {
/// Emit an instant event for this task.
void instant(String name, {Map arguments}) {
+ if (_isProduct) {
+ return;
+ }
if (name is! String) {
throw new ArgumentError.value(name,
'name',
@@ -135,6 +152,9 @@ class TimelineTask {
/// Finish the last synchronous operation that was started.
void finish() {
+ if (_isProduct) {
+ return;
+ }
if (_stack.length == 0) {
throw new StateError(
'Uneven calls to start and finish');
@@ -215,16 +235,19 @@ class _SyncBlock {
Map _arguments;
// The start time stamp.
final int _start;
+ // The start time stamp of the thread cpu clock.
+ final int _startCpu;
_SyncBlock._(this.name,
- this._start);
+ this._start,
+ this._startCpu);
/// Finish this block of time. At this point, this block can no longer be
/// used.
void finish() {
// Report event to runtime.
_reportCompleteEvent(_start,
- _getTraceClock(),
+ _startCpu,
category,
name,
_argumentsAsJson(_arguments));
@@ -261,6 +284,9 @@ external int _getNextAsyncId();
/// Returns the current value from the trace clock.
external int _getTraceClock();
+/// Returns the current value from the thread CPU usage clock.
+external int _getThreadCpuClock();
+
/// Returns the isolate's main port number.
external int _getIsolateNum();
@@ -274,7 +300,7 @@ external void _reportTaskEvent(int start,
/// Reports a complete synchronous event.
external void _reportCompleteEvent(int start,
- int end,
+ int startCpu,
String category,
String name,
String argumentsAsJson);
« no previous file with comments | « sdk/lib/developer/developer.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698