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 5556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5605 } | 5606 } |
5606 | 5607 |
5607 | 5608 |
5608 DART_EXPORT void Dart_RegisterRootServiceRequestCallback( | 5609 DART_EXPORT void Dart_RegisterRootServiceRequestCallback( |
5609 const char* name, | 5610 const char* name, |
5610 Dart_ServiceRequestCallback callback, | 5611 Dart_ServiceRequestCallback callback, |
5611 void* user_data) { | 5612 void* user_data) { |
5612 Service::RegisterRootEmbedderCallback(name, callback, user_data); | 5613 Service::RegisterRootEmbedderCallback(name, callback, user_data); |
5613 } | 5614 } |
5614 | 5615 |
5616 | |
5617 DART_EXPORT void Dart_TimelineDuration(const char* label, | |
5618 int64_t start_micros, | |
5619 int64_t end_micros) { | |
5620 Isolate* isolate = Isolate::Current(); | |
5621 CHECK_ISOLATE(isolate); | |
siva
2015/06/12 19:50:34
Normally we do a check of all arguments in the API
Cutch
2015/06/12 23:18:56
Done.
| |
5622 TimelineStream* stream = isolate->GetEmbedderStream(); | |
5623 ASSERT(stream != NULL); | |
5624 TimelineEvent* event = stream->RecordEvent(); | |
5625 if (event != NULL) { | |
5626 event->Duration(stream, label, start_micros, end_micros); | |
5627 } | |
5628 } | |
5629 | |
5630 | |
5631 DART_EXPORT void Dart_TimelineInstant(const char* label) { | |
5632 Isolate* isolate = Isolate::Current(); | |
5633 CHECK_ISOLATE(isolate); | |
siva
2015/06/12 19:50:34
Ditto comment about checking label parameter.
Cutch
2015/06/12 23:18:56
Done.
| |
5634 TimelineStream* stream = isolate->GetEmbedderStream(); | |
5635 ASSERT(stream != NULL); | |
5636 TimelineEvent* event = stream->RecordEvent(); | |
5637 if (event != NULL) { | |
5638 event->Instant(stream, label); | |
5639 } | |
5640 } | |
5641 | |
5642 | |
5643 DART_EXPORT int64_t Dart_TimelineAsyncBegin(const char* label) { | |
5644 Isolate* isolate = Isolate::Current(); | |
5645 CHECK_ISOLATE(isolate); | |
siva
2015/06/12 19:50:34
Ditto.
Cutch
2015/06/12 23:18:56
Done.
| |
5646 TimelineStream* stream = isolate->GetEmbedderStream(); | |
5647 ASSERT(stream != NULL); | |
5648 TimelineEvent* event = stream->RecordEvent(); | |
5649 if (event != NULL) { | |
5650 return event->AsyncBegin(stream, label); | |
5651 } | |
5652 return -1; | |
5653 } | |
5654 | |
5655 | |
5656 DART_EXPORT void Dart_TimelineAsyncInstant(const char* label, | |
5657 int64_t async_id) { | |
5658 if (async_id < 0) { | |
5659 return; | |
5660 } | |
siva
2015/06/12 19:50:34
Also doesn't async_id have to be a value that you
Cutch
2015/06/12 23:18:56
Not right now. I can start tracking open async ids
| |
5661 Isolate* isolate = Isolate::Current(); | |
5662 CHECK_ISOLATE(isolate); | |
5663 TimelineStream* stream = isolate->GetEmbedderStream(); | |
5664 ASSERT(stream != NULL); | |
5665 TimelineEvent* event = stream->RecordEvent(); | |
5666 if (event != NULL) { | |
5667 event->AsyncInstant(stream, label, async_id); | |
5668 } | |
5669 } | |
5670 | |
5671 | |
5672 DART_EXPORT void Dart_TimelineAsyncEnd(const char* label, int64_t async_id) { | |
5673 if (async_id < 0) { | |
5674 return; | |
5675 } | |
5676 Isolate* isolate = Isolate::Current(); | |
5677 CHECK_ISOLATE(isolate); | |
5678 TimelineStream* stream = isolate->GetEmbedderStream(); | |
5679 ASSERT(stream != NULL); | |
5680 TimelineEvent* event = stream->RecordEvent(); | |
5681 if (event != NULL) { | |
5682 event->AsyncEnd(stream, label, async_id); | |
5683 } | |
5684 } | |
5685 | |
5615 } // namespace dart | 5686 } // namespace dart |
OLD | NEW |