OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 "include/dart_api.h" | 5 #include "include/dart_api.h" |
6 #include "include/dart_mirrors_api.h" | 6 #include "include/dart_mirrors_api.h" |
7 #include "include/dart_native_api.h" | 7 #include "include/dart_native_api.h" |
8 | 8 |
9 #include "platform/assert.h" | 9 #include "platform/assert.h" |
10 #include "vm/class_finalizer.h" | 10 #include "vm/class_finalizer.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 #include "vm/port.h" | 29 #include "vm/port.h" |
30 #include "vm/profiler.h" | 30 #include "vm/profiler.h" |
31 #include "vm/resolver.h" | 31 #include "vm/resolver.h" |
32 #include "vm/reusable_handles.h" | 32 #include "vm/reusable_handles.h" |
33 #include "vm/service_event.h" | 33 #include "vm/service_event.h" |
34 #include "vm/service_isolate.h" | 34 #include "vm/service_isolate.h" |
35 #include "vm/service.h" | 35 #include "vm/service.h" |
36 #include "vm/stack_frame.h" | 36 #include "vm/stack_frame.h" |
37 #include "vm/symbols.h" | 37 #include "vm/symbols.h" |
38 #include "vm/tags.h" | 38 #include "vm/tags.h" |
| 39 #include "vm/timeline.h" |
39 #include "vm/timer.h" | 40 #include "vm/timer.h" |
40 #include "vm/unicode.h" | 41 #include "vm/unicode.h" |
41 #include "vm/verifier.h" | 42 #include "vm/verifier.h" |
42 #include "vm/version.h" | 43 #include "vm/version.h" |
43 | 44 |
44 namespace dart { | 45 namespace dart { |
45 | 46 |
46 DECLARE_FLAG(bool, load_deferred_eagerly); | 47 DECLARE_FLAG(bool, load_deferred_eagerly); |
47 DECLARE_FLAG(bool, print_class_table); | 48 DECLARE_FLAG(bool, print_class_table); |
48 DECLARE_FLAG(bool, verify_handles); | 49 DECLARE_FLAG(bool, verify_handles); |
(...skipping 5617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5666 } | 5667 } |
5667 | 5668 |
5668 | 5669 |
5669 DART_EXPORT void Dart_RegisterRootServiceRequestCallback( | 5670 DART_EXPORT void Dart_RegisterRootServiceRequestCallback( |
5670 const char* name, | 5671 const char* name, |
5671 Dart_ServiceRequestCallback callback, | 5672 Dart_ServiceRequestCallback callback, |
5672 void* user_data) { | 5673 void* user_data) { |
5673 Service::RegisterRootEmbedderCallback(name, callback, user_data); | 5674 Service::RegisterRootEmbedderCallback(name, callback, user_data); |
5674 } | 5675 } |
5675 | 5676 |
| 5677 |
| 5678 DART_EXPORT Dart_Handle Dart_TimelineDuration(const char* label, |
| 5679 int64_t start_micros, |
| 5680 int64_t end_micros) { |
| 5681 Isolate* isolate = Isolate::Current(); |
| 5682 CHECK_ISOLATE(isolate); |
| 5683 if (label == NULL) { |
| 5684 RETURN_NULL_ERROR(label); |
| 5685 } |
| 5686 if (start_micros > end_micros) { |
| 5687 const char* msg = "%s: start_micros must be <= end_micros"; |
| 5688 return Api::NewError(msg, CURRENT_FUNC); |
| 5689 } |
| 5690 TimelineStream* stream = isolate->GetEmbedderStream(); |
| 5691 ASSERT(stream != NULL); |
| 5692 TimelineEvent* event = stream->RecordEvent(); |
| 5693 if (event != NULL) { |
| 5694 event->Duration(stream, label, start_micros, end_micros); |
| 5695 } |
| 5696 return Api::Success(); |
| 5697 } |
| 5698 |
| 5699 |
| 5700 DART_EXPORT Dart_Handle Dart_TimelineInstant(const char* label) { |
| 5701 Isolate* isolate = Isolate::Current(); |
| 5702 CHECK_ISOLATE(isolate); |
| 5703 if (label == NULL) { |
| 5704 RETURN_NULL_ERROR(label); |
| 5705 } |
| 5706 TimelineStream* stream = isolate->GetEmbedderStream(); |
| 5707 ASSERT(stream != NULL); |
| 5708 TimelineEvent* event = stream->RecordEvent(); |
| 5709 if (event != NULL) { |
| 5710 event->Instant(stream, label); |
| 5711 } |
| 5712 return Api::Success(); |
| 5713 } |
| 5714 |
| 5715 |
| 5716 DART_EXPORT Dart_Handle Dart_TimelineAsyncBegin(const char* label, |
| 5717 int64_t* async_id) { |
| 5718 Isolate* isolate = Isolate::Current(); |
| 5719 CHECK_ISOLATE(isolate); |
| 5720 if (label == NULL) { |
| 5721 RETURN_NULL_ERROR(label); |
| 5722 } |
| 5723 if (async_id == NULL) { |
| 5724 RETURN_NULL_ERROR(async_id); |
| 5725 } |
| 5726 *async_id = -1; |
| 5727 TimelineStream* stream = isolate->GetEmbedderStream(); |
| 5728 ASSERT(stream != NULL); |
| 5729 TimelineEvent* event = stream->RecordEvent(); |
| 5730 if (event != NULL) { |
| 5731 *async_id = event->AsyncBegin(stream, label); |
| 5732 } |
| 5733 return Api::Success(); |
| 5734 } |
| 5735 |
| 5736 |
| 5737 DART_EXPORT Dart_Handle Dart_TimelineAsyncInstant(const char* label, |
| 5738 int64_t async_id) { |
| 5739 if (async_id < 0) { |
| 5740 return Api::Success(); |
| 5741 } |
| 5742 Isolate* isolate = Isolate::Current(); |
| 5743 CHECK_ISOLATE(isolate); |
| 5744 if (label == NULL) { |
| 5745 RETURN_NULL_ERROR(label); |
| 5746 } |
| 5747 TimelineStream* stream = isolate->GetEmbedderStream(); |
| 5748 ASSERT(stream != NULL); |
| 5749 TimelineEvent* event = stream->RecordEvent(); |
| 5750 if (event != NULL) { |
| 5751 event->AsyncInstant(stream, label, async_id); |
| 5752 } |
| 5753 return Api::Success(); |
| 5754 } |
| 5755 |
| 5756 |
| 5757 DART_EXPORT Dart_Handle Dart_TimelineAsyncEnd(const char* label, |
| 5758 int64_t async_id) { |
| 5759 if (async_id < 0) { |
| 5760 return Api::Success(); |
| 5761 } |
| 5762 Isolate* isolate = Isolate::Current(); |
| 5763 CHECK_ISOLATE(isolate); |
| 5764 if (label == NULL) { |
| 5765 RETURN_NULL_ERROR(label); |
| 5766 } |
| 5767 TimelineStream* stream = isolate->GetEmbedderStream(); |
| 5768 ASSERT(stream != NULL); |
| 5769 TimelineEvent* event = stream->RecordEvent(); |
| 5770 if (event != NULL) { |
| 5771 event->AsyncEnd(stream, label, async_id); |
| 5772 } |
| 5773 return Api::Success(); |
| 5774 } |
| 5775 |
5676 } // namespace dart | 5776 } // namespace dart |
OLD | NEW |