| 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 "lib/stacktrace.h" | 10 #include "lib/stacktrace.h" |
| (...skipping 5988 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5999 FATAL("Unknown Dart_Timeline_Event_Type"); | 5999 FATAL("Unknown Dart_Timeline_Event_Type"); |
| 6000 } | 6000 } |
| 6001 event->SetNumArguments(argument_count); | 6001 event->SetNumArguments(argument_count); |
| 6002 for (intptr_t i = 0; i < argument_count; i++) { | 6002 for (intptr_t i = 0; i < argument_count; i++) { |
| 6003 event->CopyArgument(i, argument_names[i], argument_values[i]); | 6003 event->CopyArgument(i, argument_names[i], argument_values[i]); |
| 6004 } | 6004 } |
| 6005 event->Complete(); | 6005 event->Complete(); |
| 6006 } | 6006 } |
| 6007 | 6007 |
| 6008 | 6008 |
| 6009 DART_EXPORT void Dart_TimelineDuration(const char* label, | |
| 6010 int64_t start_micros, | |
| 6011 int64_t end_micros) { | |
| 6012 if (!FLAG_support_timeline) { | |
| 6013 return; | |
| 6014 } | |
| 6015 if (start_micros > end_micros) { | |
| 6016 FATAL1("%s: start_micros must be <= end_micros", CURRENT_FUNC); | |
| 6017 } | |
| 6018 if (label == NULL) { | |
| 6019 return; | |
| 6020 } | |
| 6021 TimelineStream* stream = Timeline::GetEmbedderStream(); | |
| 6022 ASSERT(stream != NULL); | |
| 6023 TimelineEvent* event = stream->StartEvent(); | |
| 6024 if (event != NULL) { | |
| 6025 event->Duration(label, start_micros, end_micros); | |
| 6026 event->Complete(); | |
| 6027 } | |
| 6028 } | |
| 6029 | |
| 6030 | |
| 6031 DART_EXPORT void Dart_TimelineInstant(const char* label) { | |
| 6032 if (!FLAG_support_timeline) { | |
| 6033 return; | |
| 6034 } | |
| 6035 if (label == NULL) { | |
| 6036 return; | |
| 6037 } | |
| 6038 TimelineStream* stream = Timeline::GetEmbedderStream(); | |
| 6039 ASSERT(stream != NULL); | |
| 6040 TimelineEvent* event = stream->StartEvent(); | |
| 6041 if (event != NULL) { | |
| 6042 event->Instant(label); | |
| 6043 event->Complete(); | |
| 6044 } | |
| 6045 return; | |
| 6046 } | |
| 6047 | |
| 6048 | |
| 6049 DART_EXPORT void Dart_TimelineAsyncBegin(const char* label, | |
| 6050 int64_t* async_id) { | |
| 6051 if (!FLAG_support_timeline) { | |
| 6052 return; | |
| 6053 } | |
| 6054 if (label == NULL) { | |
| 6055 return; | |
| 6056 } | |
| 6057 if (async_id == NULL) { | |
| 6058 return; | |
| 6059 } | |
| 6060 *async_id = -1; | |
| 6061 TimelineStream* stream = Timeline::GetEmbedderStream(); | |
| 6062 ASSERT(stream != NULL); | |
| 6063 TimelineEvent* event = stream->StartEvent(); | |
| 6064 if (event != NULL) { | |
| 6065 TimelineEventRecorder* recorder = Timeline::recorder(); | |
| 6066 ASSERT(recorder != NULL); | |
| 6067 *async_id = recorder->GetNextAsyncId(); | |
| 6068 event->AsyncBegin(label, *async_id); | |
| 6069 event->Complete(); | |
| 6070 } | |
| 6071 return; | |
| 6072 } | |
| 6073 | |
| 6074 | |
| 6075 DART_EXPORT void Dart_TimelineAsyncInstant(const char* label, | |
| 6076 int64_t async_id) { | |
| 6077 if (!FLAG_support_timeline) { | |
| 6078 return; | |
| 6079 } | |
| 6080 if (async_id < 0) { | |
| 6081 return; | |
| 6082 } | |
| 6083 if (label == NULL) { | |
| 6084 return; | |
| 6085 } | |
| 6086 TimelineStream* stream = Timeline::GetEmbedderStream(); | |
| 6087 ASSERT(stream != NULL); | |
| 6088 TimelineEvent* event = stream->StartEvent(); | |
| 6089 if (event != NULL) { | |
| 6090 event->AsyncInstant(label, async_id); | |
| 6091 event->Complete(); | |
| 6092 } | |
| 6093 return; | |
| 6094 } | |
| 6095 | |
| 6096 | |
| 6097 DART_EXPORT void Dart_TimelineAsyncEnd(const char* label, | |
| 6098 int64_t async_id) { | |
| 6099 if (!FLAG_support_timeline) { | |
| 6100 return; | |
| 6101 } | |
| 6102 if (async_id < 0) { | |
| 6103 return; | |
| 6104 } | |
| 6105 if (label == NULL) { | |
| 6106 return; | |
| 6107 } | |
| 6108 TimelineStream* stream = Timeline::GetEmbedderStream(); | |
| 6109 ASSERT(stream != NULL); | |
| 6110 TimelineEvent* event = stream->StartEvent(); | |
| 6111 if (event != NULL) { | |
| 6112 event->AsyncEnd(label, async_id); | |
| 6113 event->Complete(); | |
| 6114 } | |
| 6115 return; | |
| 6116 } | |
| 6117 | |
| 6118 // The precompiler is included in dart_bootstrap and dart_noopt, and | 6009 // The precompiler is included in dart_bootstrap and dart_noopt, and |
| 6119 // excluded from dart and dart_precompiled_runtime. | 6010 // excluded from dart and dart_precompiled_runtime. |
| 6120 #if !defined(DART_PRECOMPILER) | 6011 #if !defined(DART_PRECOMPILER) |
| 6121 | 6012 |
| 6122 DART_EXPORT Dart_Handle Dart_Precompile( | 6013 DART_EXPORT Dart_Handle Dart_Precompile( |
| 6123 Dart_QualifiedFunctionName entry_points[], | 6014 Dart_QualifiedFunctionName entry_points[], |
| 6124 bool reset_fields) { | 6015 bool reset_fields) { |
| 6125 UNREACHABLE(); | 6016 UNREACHABLE(); |
| 6126 return 0; | 6017 return 0; |
| 6127 } | 6018 } |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6213 return Api::Success(); | 6104 return Api::Success(); |
| 6214 } | 6105 } |
| 6215 #endif // DART_PRECOMPILER | 6106 #endif // DART_PRECOMPILER |
| 6216 | 6107 |
| 6217 | 6108 |
| 6218 DART_EXPORT bool Dart_IsRunningPrecompiledCode() { | 6109 DART_EXPORT bool Dart_IsRunningPrecompiledCode() { |
| 6219 return Dart::IsRunningPrecompiledCode(); | 6110 return Dart::IsRunningPrecompiledCode(); |
| 6220 } | 6111 } |
| 6221 | 6112 |
| 6222 } // namespace dart | 6113 } // namespace dart |
| OLD | NEW |