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

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

Issue 1882313002: Copy event label. (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 | « no previous file | runtime/vm/timeline.h » ('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 5967 matching lines...) Expand 10 before | Expand all | Expand 10 after
5978 } 5978 }
5979 if (type > Dart_Timeline_Event_Counter) { 5979 if (type > Dart_Timeline_Event_Counter) {
5980 return; 5980 return;
5981 } 5981 }
5982 TimelineStream* stream = Timeline::GetEmbedderStream(); 5982 TimelineStream* stream = Timeline::GetEmbedderStream();
5983 ASSERT(stream != NULL); 5983 ASSERT(stream != NULL);
5984 TimelineEvent* event = stream->StartEvent(); 5984 TimelineEvent* event = stream->StartEvent();
5985 if (event == NULL) { 5985 if (event == NULL) {
5986 return; 5986 return;
5987 } 5987 }
5988 label = strdup(label);
5988 switch (type) { 5989 switch (type) {
5989 case Dart_Timeline_Event_Begin: 5990 case Dart_Timeline_Event_Begin:
5990 event->Begin(label, timestamp0); 5991 event->Begin(label, timestamp0);
5991 break; 5992 break;
5992 case Dart_Timeline_Event_End: 5993 case Dart_Timeline_Event_End:
5993 event->End(label, timestamp0); 5994 event->End(label, timestamp0);
5994 break; 5995 break;
5995 case Dart_Timeline_Event_Instant: 5996 case Dart_Timeline_Event_Instant:
5996 event->Instant(label, timestamp0); 5997 event->Instant(label, timestamp0);
5997 break; 5998 break;
5998 case Dart_Timeline_Event_Duration: 5999 case Dart_Timeline_Event_Duration:
5999 event->Duration(label, timestamp0, timestamp1_or_async_id); 6000 event->Duration(label, timestamp0, timestamp1_or_async_id);
6000 break; 6001 break;
6001 case Dart_Timeline_Event_Async_Begin: 6002 case Dart_Timeline_Event_Async_Begin:
6002 event->AsyncBegin(label, timestamp1_or_async_id, timestamp0); 6003 event->AsyncBegin(label, timestamp1_or_async_id, timestamp0);
6003 break; 6004 break;
6004 case Dart_Timeline_Event_Async_End: 6005 case Dart_Timeline_Event_Async_End:
6005 event->AsyncEnd(label, timestamp1_or_async_id, timestamp0); 6006 event->AsyncEnd(label, timestamp1_or_async_id, timestamp0);
6006 break; 6007 break;
6007 case Dart_Timeline_Event_Async_Instant: 6008 case Dart_Timeline_Event_Async_Instant:
6008 event->AsyncInstant(label, timestamp1_or_async_id, timestamp0); 6009 event->AsyncInstant(label, timestamp1_or_async_id, timestamp0);
6009 break; 6010 break;
6010 case Dart_Timeline_Event_Counter: 6011 case Dart_Timeline_Event_Counter:
6011 event->Counter(label, timestamp0); 6012 event->Counter(label, timestamp0);
6012 break; 6013 break;
6013 default: 6014 default:
6014 FATAL("Unknown Dart_Timeline_Event_Type"); 6015 FATAL("Unknown Dart_Timeline_Event_Type");
6015 } 6016 }
6017 event->set_owns_label(true);
6016 event->SetNumArguments(argument_count); 6018 event->SetNumArguments(argument_count);
6017 for (intptr_t i = 0; i < argument_count; i++) { 6019 for (intptr_t i = 0; i < argument_count; i++) {
6018 event->CopyArgument(i, argument_names[i], argument_values[i]); 6020 event->CopyArgument(i, argument_names[i], argument_values[i]);
6019 } 6021 }
6020 event->Complete(); 6022 event->Complete();
6021 } 6023 }
6022 6024
6023 6025
6024 DART_EXPORT void Dart_SetThreadName(const char* name) { 6026 DART_EXPORT void Dart_SetThreadName(const char* name) {
6025 OSThread* thread = OSThread::Current(); 6027 OSThread* thread = OSThread::Current();
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
6129 return Api::Success(); 6131 return Api::Success();
6130 } 6132 }
6131 #endif // DART_PRECOMPILER 6133 #endif // DART_PRECOMPILER
6132 6134
6133 6135
6134 DART_EXPORT bool Dart_IsRunningPrecompiledCode() { 6136 DART_EXPORT bool Dart_IsRunningPrecompiledCode() {
6135 return Dart::IsRunningPrecompiledCode(); 6137 return Dart::IsRunningPrecompiledCode();
6136 } 6138 }
6137 6139
6138 } // namespace dart 6140 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/timeline.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698