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 5612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5661 } | 5662 } |
5662 | 5663 |
5663 | 5664 |
5664 DART_EXPORT void Dart_RegisterRootServiceRequestCallback( | 5665 DART_EXPORT void Dart_RegisterRootServiceRequestCallback( |
5665 const char* name, | 5666 const char* name, |
5666 Dart_ServiceRequestCallback callback, | 5667 Dart_ServiceRequestCallback callback, |
5667 void* user_data) { | 5668 void* user_data) { |
5668 Service::RegisterRootEmbedderCallback(name, callback, user_data); | 5669 Service::RegisterRootEmbedderCallback(name, callback, user_data); |
5669 } | 5670 } |
5670 | 5671 |
5672 | |
5673 DART_EXPORT Dart_Handle Dart_TimelineDuration(const char* label, | |
5674 int64_t start_micros, | |
5675 int64_t end_micros) { | |
5676 Isolate* isolate = Isolate::Current(); | |
5677 CHECK_ISOLATE(isolate); | |
5678 if (label == NULL) { | |
5679 const char* msg = "%s: label cannot be null"; | |
5680 return Api::NewError(msg, CURRENT_FUNC); | |
5681 } | |
5682 if (start_micros > end_micros) { | |
5683 const char* msg = "%s: start_micros must be <= end_micros"; | |
5684 return Api::NewError(msg, CURRENT_FUNC); | |
5685 } | |
5686 TimelineStream* stream = isolate->GetEmbedderStream(); | |
5687 ASSERT(stream != NULL); | |
5688 TimelineEvent* event = stream->RecordEvent(); | |
5689 if (event != NULL) { | |
5690 event->Duration(stream, label, start_micros, end_micros); | |
5691 } | |
5692 return Api::Success(); | |
5693 } | |
5694 | |
5695 | |
5696 DART_EXPORT Dart_Handle Dart_TimelineInstant(const char* label) { | |
5697 Isolate* isolate = Isolate::Current(); | |
5698 CHECK_ISOLATE(isolate); | |
5699 if (label == NULL) { | |
5700 const char* msg = "%s: label cannot be null"; | |
5701 return Api::NewError(msg, CURRENT_FUNC); | |
5702 } | |
5703 TimelineStream* stream = isolate->GetEmbedderStream(); | |
5704 ASSERT(stream != NULL); | |
5705 TimelineEvent* event = stream->RecordEvent(); | |
5706 if (event != NULL) { | |
5707 event->Instant(stream, label); | |
5708 } | |
5709 return Api::Success(); | |
5710 } | |
5711 | |
5712 | |
5713 DART_EXPORT int64_t Dart_TimelineAsyncBegin(const char* label) { | |
5714 Isolate* isolate = Isolate::Current(); | |
5715 CHECK_ISOLATE(isolate); | |
5716 if (label == NULL) { | |
5717 FATAL1("%s: label cannot be null", CURRENT_FUNC); | |
5718 } | |
siva
2015/06/16 15:42:31
Instead of FATALing out here maybe you could chang
Cutch
2015/06/16 17:08:17
Done.
| |
5719 TimelineStream* stream = isolate->GetEmbedderStream(); | |
5720 ASSERT(stream != NULL); | |
5721 TimelineEvent* event = stream->RecordEvent(); | |
5722 if (event != NULL) { | |
5723 return event->AsyncBegin(stream, label); | |
5724 } | |
5725 return -1; | |
5726 } | |
5727 | |
5728 | |
5729 DART_EXPORT void Dart_TimelineAsyncInstant(const char* label, | |
5730 int64_t async_id) { | |
5731 if (async_id < 0) { | |
5732 return; | |
5733 } | |
5734 Isolate* isolate = Isolate::Current(); | |
5735 CHECK_ISOLATE(isolate); | |
5736 if (label == NULL) { | |
5737 FATAL1("%s: label cannot be null", CURRENT_FUNC); | |
5738 } | |
siva
2015/06/16 15:42:31
Ditto.
Cutch
2015/06/16 17:08:17
Done.
| |
5739 TimelineStream* stream = isolate->GetEmbedderStream(); | |
5740 ASSERT(stream != NULL); | |
5741 TimelineEvent* event = stream->RecordEvent(); | |
5742 if (event != NULL) { | |
5743 event->AsyncInstant(stream, label, async_id); | |
5744 } | |
5745 } | |
5746 | |
5747 | |
5748 DART_EXPORT void Dart_TimelineAsyncEnd(const char* label, int64_t async_id) { | |
5749 if (async_id < 0) { | |
5750 return; | |
5751 } | |
siva
2015/06/16 15:42:31
Ditto.
Cutch
2015/06/16 17:08:17
Done.
| |
5752 Isolate* isolate = Isolate::Current(); | |
5753 CHECK_ISOLATE(isolate); | |
5754 if (label == NULL) { | |
5755 FATAL1("%s: label cannot be null", CURRENT_FUNC); | |
5756 } | |
siva
2015/06/16 15:42:31
Ditto.
Cutch
2015/06/16 17:08:17
Done.
| |
5757 TimelineStream* stream = isolate->GetEmbedderStream(); | |
5758 ASSERT(stream != NULL); | |
5759 TimelineEvent* event = stream->RecordEvent(); | |
5760 if (event != NULL) { | |
5761 event->AsyncEnd(stream, label, async_id); | |
5762 } | |
5763 } | |
5764 | |
5671 } // namespace dart | 5765 } // namespace dart |
OLD | NEW |