Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(328)

Side by Side Diff: runtime/vm/dart_api_impl.cc

Issue 1849643002: Add support for async, metadata, and counter timeline events to be reported by the embedder (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/include/dart_tools_api.h ('k') | runtime/vm/dart_api_impl_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 5929 matching lines...) Expand 10 before | Expand all | Expand 10 after
5940 if (StreamTraceEvents(consumer, user_data, &js)) { 5940 if (StreamTraceEvents(consumer, user_data, &js)) {
5941 success = true; 5941 success = true;
5942 } 5942 }
5943 FinishStreamToConsumer(consumer, user_data, "timeline"); 5943 FinishStreamToConsumer(consumer, user_data, "timeline");
5944 return success; 5944 return success;
5945 } 5945 }
5946 5946
5947 5947
5948 DART_EXPORT void Dart_TimelineEvent(const char* label, 5948 DART_EXPORT void Dart_TimelineEvent(const char* label,
5949 int64_t timestamp0, 5949 int64_t timestamp0,
5950 int64_t timestamp1, 5950 int64_t timestamp1_or_async_id,
5951 Dart_Timeline_Event_Type type, 5951 Dart_Timeline_Event_Type type,
5952 intptr_t argument_count, 5952 intptr_t argument_count,
5953 const char** argument_names, 5953 const char** argument_names,
5954 const char** argument_values) { 5954 const char** argument_values) {
5955 if (!FLAG_support_timeline) { 5955 if (!FLAG_support_timeline) {
5956 return; 5956 return;
5957 } 5957 }
5958 if (type < Dart_Timeline_Event_Begin) { 5958 if (type < Dart_Timeline_Event_Begin) {
5959 return; 5959 return;
5960 } 5960 }
5961 if (type > Dart_Timeline_Event_Duration) { 5961 if (type > Dart_Timeline_Event_Metadata) {
5962 return; 5962 return;
5963 } 5963 }
5964 TimelineStream* stream = Timeline::GetEmbedderStream(); 5964 TimelineStream* stream = Timeline::GetEmbedderStream();
5965 ASSERT(stream != NULL); 5965 ASSERT(stream != NULL);
5966 TimelineEvent* event = stream->StartEvent(); 5966 TimelineEvent* event = stream->StartEvent();
5967 if (event == NULL) { 5967 if (event == NULL) {
5968 return; 5968 return;
5969 } 5969 }
5970 switch (type) { 5970 switch (type) {
5971 case Dart_Timeline_Event_Begin: 5971 case Dart_Timeline_Event_Begin:
5972 event->Begin(label, timestamp0); 5972 event->Begin(label, timestamp0);
5973 break; 5973 break;
5974 case Dart_Timeline_Event_End: 5974 case Dart_Timeline_Event_End:
5975 event->End(label, timestamp0); 5975 event->End(label, timestamp0);
5976 break; 5976 break;
5977 case Dart_Timeline_Event_Instant: 5977 case Dart_Timeline_Event_Instant:
5978 event->Instant(label, timestamp0); 5978 event->Instant(label, timestamp0);
5979 break; 5979 break;
5980 case Dart_Timeline_Event_Duration: 5980 case Dart_Timeline_Event_Duration:
5981 event->Duration(label, timestamp0, timestamp1); 5981 event->Duration(label, timestamp0, timestamp1_or_async_id);
5982 break;
5983 case Dart_Timeline_Event_Async_Begin:
5984 event->AsyncBegin(label, timestamp1_or_async_id, timestamp0);
5985 break;
5986 case Dart_Timeline_Event_Async_End:
5987 event->AsyncEnd(label, timestamp1_or_async_id, timestamp0);
5988 break;
5989 case Dart_Timeline_Event_Async_Instant:
5990 event->AsyncInstant(label, timestamp1_or_async_id, timestamp0);
5991 break;
5992 case Dart_Timeline_Event_Counter:
5993 event->Counter(label, timestamp0);
5994 break;
5995 case Dart_Timeline_Event_Metadata:
5996 event->Metadata(label, timestamp0);
5982 break; 5997 break;
5983 default: 5998 default:
5984 FATAL("Unknown Dart_Timeline_Event_Type"); 5999 FATAL("Unknown Dart_Timeline_Event_Type");
5985 } 6000 }
5986 event->SetNumArguments(argument_count); 6001 event->SetNumArguments(argument_count);
5987 for (intptr_t i = 0; i < argument_count; i++) { 6002 for (intptr_t i = 0; i < argument_count; i++) {
5988 event->CopyArgument(i, argument_names[i], argument_values[i]); 6003 event->CopyArgument(i, argument_names[i], argument_values[i]);
5989 } 6004 }
5990 event->Complete(); 6005 event->Complete();
5991 } 6006 }
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
6198 return Api::Success(); 6213 return Api::Success();
6199 } 6214 }
6200 #endif // DART_PRECOMPILER 6215 #endif // DART_PRECOMPILER
6201 6216
6202 6217
6203 DART_EXPORT bool Dart_IsRunningPrecompiledCode() { 6218 DART_EXPORT bool Dart_IsRunningPrecompiledCode() {
6204 return Dart::IsRunningPrecompiledCode(); 6219 return Dart::IsRunningPrecompiledCode();
6205 } 6220 }
6206 6221
6207 } // namespace dart 6222 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/include/dart_tools_api.h ('k') | runtime/vm/dart_api_impl_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698