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

Side by Side Diff: runtime/lib/timeline.cc

Issue 1811613002: Timeline API fixes for Flutter (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 9 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/compiler.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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 "vm/bootstrap_natives.h" 5 #include "vm/bootstrap_natives.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 8
9 #include "vm/native_entry.h" 9 #include "vm/native_entry.h"
10 #include "vm/object.h" 10 #include "vm/object.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 GET_NON_NULL_NATIVE_ARGUMENT(String, phase, arguments->NativeArgAt(2)); 46 GET_NON_NULL_NATIVE_ARGUMENT(String, phase, arguments->NativeArgAt(2));
47 GET_NON_NULL_NATIVE_ARGUMENT(String, category, arguments->NativeArgAt(3)); 47 GET_NON_NULL_NATIVE_ARGUMENT(String, category, arguments->NativeArgAt(3));
48 GET_NON_NULL_NATIVE_ARGUMENT(String, name, arguments->NativeArgAt(4)); 48 GET_NON_NULL_NATIVE_ARGUMENT(String, name, arguments->NativeArgAt(4));
49 GET_NON_NULL_NATIVE_ARGUMENT(String, args, arguments->NativeArgAt(5)); 49 GET_NON_NULL_NATIVE_ARGUMENT(String, args, arguments->NativeArgAt(5));
50 50
51 TimelineEventRecorder* recorder = Timeline::recorder(); 51 TimelineEventRecorder* recorder = Timeline::recorder();
52 if (recorder == NULL) { 52 if (recorder == NULL) {
53 return Object::null(); 53 return Object::null();
54 } 54 }
55 55
56 TimelineEvent* event = isolate->GetDartStream()->StartEvent(); 56 TimelineEvent* event = Timeline::GetDartStream()->StartEvent();
57 if (event == NULL) { 57 if (event == NULL) {
58 // Stream was turned off. 58 // Stream was turned off.
59 return Object::null(); 59 return Object::null();
60 } 60 }
61 61
62 int64_t pid = OS::ProcessId(); 62 int64_t pid = OS::ProcessId();
63 OSThread* os_thread = thread->os_thread(); 63 OSThread* os_thread = thread->os_thread();
64 ASSERT(os_thread != NULL); 64 ASSERT(os_thread != NULL);
65 int64_t tid = OSThread::ThreadIdToIntPtr(os_thread->trace_id()); 65 int64_t tid = OSThread::ThreadIdToIntPtr(os_thread->trace_id());
66 // Convert phase to a C string and perform a sanity check. 66 // Convert phase to a C string and perform a sanity check.
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 GET_NON_NULL_NATIVE_ARGUMENT(Integer, end, arguments->NativeArgAt(1)); 111 GET_NON_NULL_NATIVE_ARGUMENT(Integer, end, arguments->NativeArgAt(1));
112 GET_NON_NULL_NATIVE_ARGUMENT(String, category, arguments->NativeArgAt(2)); 112 GET_NON_NULL_NATIVE_ARGUMENT(String, category, arguments->NativeArgAt(2));
113 GET_NON_NULL_NATIVE_ARGUMENT(String, name, arguments->NativeArgAt(3)); 113 GET_NON_NULL_NATIVE_ARGUMENT(String, name, arguments->NativeArgAt(3));
114 GET_NON_NULL_NATIVE_ARGUMENT(String, args, arguments->NativeArgAt(4)); 114 GET_NON_NULL_NATIVE_ARGUMENT(String, args, arguments->NativeArgAt(4));
115 115
116 TimelineEventRecorder* recorder = Timeline::recorder(); 116 TimelineEventRecorder* recorder = Timeline::recorder();
117 if (recorder == NULL) { 117 if (recorder == NULL) {
118 return Object::null(); 118 return Object::null();
119 } 119 }
120 120
121 TimelineEvent* event = isolate->GetDartStream()->StartEvent(); 121 TimelineEvent* event = Timeline::GetDartStream()->StartEvent();
122 if (event == NULL) { 122 if (event == NULL) {
123 // Stream was turned off. 123 // Stream was turned off.
124 return Object::null(); 124 return Object::null();
125 } 125 }
126 126
127 int64_t duration = end.AsInt64Value() - start.AsInt64Value(); 127 int64_t duration = end.AsInt64Value() - start.AsInt64Value();
128 int64_t pid = OS::ProcessId(); 128 int64_t pid = OS::ProcessId();
129 OSThread* os_thread = thread->os_thread(); 129 OSThread* os_thread = thread->os_thread();
130 ASSERT(os_thread != NULL); 130 ASSERT(os_thread != NULL);
131 int64_t tid = OSThread::ThreadIdToIntPtr(os_thread->trace_id()); 131 int64_t tid = OSThread::ThreadIdToIntPtr(os_thread->trace_id());
(...skipping 24 matching lines...) Expand all
156 GET_NON_NULL_NATIVE_ARGUMENT(Integer, start, arguments->NativeArgAt(0)); 156 GET_NON_NULL_NATIVE_ARGUMENT(Integer, start, arguments->NativeArgAt(0));
157 GET_NON_NULL_NATIVE_ARGUMENT(String, category, arguments->NativeArgAt(1)); 157 GET_NON_NULL_NATIVE_ARGUMENT(String, category, arguments->NativeArgAt(1));
158 GET_NON_NULL_NATIVE_ARGUMENT(String, name, arguments->NativeArgAt(2)); 158 GET_NON_NULL_NATIVE_ARGUMENT(String, name, arguments->NativeArgAt(2));
159 GET_NON_NULL_NATIVE_ARGUMENT(String, args, arguments->NativeArgAt(3)); 159 GET_NON_NULL_NATIVE_ARGUMENT(String, args, arguments->NativeArgAt(3));
160 160
161 TimelineEventRecorder* recorder = Timeline::recorder(); 161 TimelineEventRecorder* recorder = Timeline::recorder();
162 if (recorder == NULL) { 162 if (recorder == NULL) {
163 return Object::null(); 163 return Object::null();
164 } 164 }
165 165
166 TimelineEvent* event = isolate->GetDartStream()->StartEvent(); 166 TimelineEvent* event = Timeline::GetDartStream()->StartEvent();
167 if (event == NULL) { 167 if (event == NULL) {
168 // Stream was turned off. 168 // Stream was turned off.
169 return Object::null(); 169 return Object::null();
170 } 170 }
171 171
172 int64_t pid = OS::ProcessId(); 172 int64_t pid = OS::ProcessId();
173 OSThread* os_thread = thread->os_thread(); 173 OSThread* os_thread = thread->os_thread();
174 ASSERT(os_thread != NULL); 174 ASSERT(os_thread != NULL);
175 int64_t tid = OSThread::ThreadIdToIntPtr(os_thread->trace_id()); 175 int64_t tid = OSThread::ThreadIdToIntPtr(os_thread->trace_id());
176 176
177 char* json = OS::SCreate(zone, 177 char* json = OS::SCreate(zone,
178 "{\"name\":\"%s\",\"cat\":\"%s\",\"tid\":%" Pd64 ",\"pid\":%" Pd64 "," 178 "{\"name\":\"%s\",\"cat\":\"%s\",\"tid\":%" Pd64 ",\"pid\":%" Pd64 ","
179 "\"ts\":%" Pd64 ",\"ph\":\"I\",\"args\":%s}", 179 "\"ts\":%" Pd64 ",\"ph\":\"I\",\"args\":%s}",
180 name.ToCString(), 180 name.ToCString(),
181 category.ToCString(), 181 category.ToCString(),
182 tid, 182 tid,
183 pid, 183 pid,
184 start.AsInt64Value(), 184 start.AsInt64Value(),
185 args.ToCString()); 185 args.ToCString());
186 186
187 event->Instant("", start.AsInt64Value()); 187 event->Instant("", start.AsInt64Value());
188 // json was allocated in the zone and a copy will be stored in event. 188 // json was allocated in the zone and a copy will be stored in event.
189 event->CompleteWithPreSerializedJSON(json); 189 event->CompleteWithPreSerializedJSON(json);
190 190
191 return Object::null(); 191 return Object::null();
192 } 192 }
193 193
194 } // namespace dart 194 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/include/dart_tools_api.h ('k') | runtime/vm/compiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698