OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include <cstdlib> | 5 #include <cstdlib> |
6 | 6 |
7 #include "vm/atomic.h" | 7 #include "vm/atomic.h" |
8 #include "vm/isolate.h" | 8 #include "vm/isolate.h" |
9 #include "vm/json_stream.h" | 9 #include "vm/json_stream.h" |
10 #include "vm/lockers.h" | 10 #include "vm/lockers.h" |
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 } | 372 } |
373 | 373 |
374 | 374 |
375 void TimelineEvent::End(const char* label, | 375 void TimelineEvent::End(const char* label, |
376 int64_t micros) { | 376 int64_t micros) { |
377 Init(kEnd, label); | 377 Init(kEnd, label); |
378 set_timestamp0(micros); | 378 set_timestamp0(micros); |
379 } | 379 } |
380 | 380 |
381 | 381 |
| 382 void TimelineEvent::Counter(const char* label, int64_t micros) { |
| 383 Init(kCounter, label); |
| 384 set_timestamp0(micros); |
| 385 } |
| 386 |
| 387 |
| 388 void TimelineEvent::Metadata(const char* label, int64_t micros) { |
| 389 Init(kMetadata, label); |
| 390 set_timestamp0(micros); |
| 391 } |
| 392 |
| 393 |
382 void TimelineEvent::CompleteWithPreSerializedJSON(const char* json) { | 394 void TimelineEvent::CompleteWithPreSerializedJSON(const char* json) { |
383 set_pre_serialized_json(true); | 395 set_pre_serialized_json(true); |
384 SetNumArguments(1); | 396 SetNumArguments(1); |
385 CopyArgument(0, "Dart", json); | 397 CopyArgument(0, "Dart", json); |
386 Complete(); | 398 Complete(); |
387 } | 399 } |
388 | 400 |
389 | 401 |
390 void TimelineEvent::SetNumArguments(intptr_t length) { | 402 void TimelineEvent::SetNumArguments(intptr_t length) { |
391 // Cannot call this twice. | 403 // Cannot call this twice. |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
570 case kAsyncInstant: { | 582 case kAsyncInstant: { |
571 obj.AddProperty("ph", "n"); | 583 obj.AddProperty("ph", "n"); |
572 obj.AddPropertyF("id", "%" Px64 "", AsyncId()); | 584 obj.AddPropertyF("id", "%" Px64 "", AsyncId()); |
573 } | 585 } |
574 break; | 586 break; |
575 case kAsyncEnd: { | 587 case kAsyncEnd: { |
576 obj.AddProperty("ph", "e"); | 588 obj.AddProperty("ph", "e"); |
577 obj.AddPropertyF("id", "%" Px64 "", AsyncId()); | 589 obj.AddPropertyF("id", "%" Px64 "", AsyncId()); |
578 } | 590 } |
579 break; | 591 break; |
| 592 case kMetadata: { |
| 593 obj.AddProperty("ph", "M"); |
| 594 } |
| 595 break; |
| 596 case kCounter: { |
| 597 obj.AddProperty("ph", "C"); |
| 598 } |
| 599 break; |
580 default: | 600 default: |
581 UNIMPLEMENTED(); | 601 UNIMPLEMENTED(); |
582 } | 602 } |
583 { | 603 { |
584 JSONObject args(&obj, "args"); | 604 JSONObject args(&obj, "args"); |
585 for (intptr_t i = 0; i < arguments_length_; i++) { | 605 for (intptr_t i = 0; i < arguments_length_; i++) { |
586 const TimelineEventArgument& arg = arguments_[i]; | 606 const TimelineEventArgument& arg = arguments_[i]; |
587 args.AddProperty(arg.name, arg.value); | 607 args.AddProperty(arg.name, arg.value); |
588 } | 608 } |
589 if (isolate_id_ != ILLEGAL_PORT) { | 609 if (isolate_id_ != ILLEGAL_PORT) { |
(...skipping 943 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1533 TimelineEventBlock* TimelineEventBlockIterator::Next() { | 1553 TimelineEventBlock* TimelineEventBlockIterator::Next() { |
1534 ASSERT(current_ != NULL); | 1554 ASSERT(current_ != NULL); |
1535 TimelineEventBlock* r = current_; | 1555 TimelineEventBlock* r = current_; |
1536 current_ = current_->next(); | 1556 current_ = current_->next(); |
1537 return r; | 1557 return r; |
1538 } | 1558 } |
1539 | 1559 |
1540 #endif // !PRODUCT | 1560 #endif // !PRODUCT |
1541 | 1561 |
1542 } // namespace dart | 1562 } // namespace dart |
OLD | NEW |