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

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

Issue 2117593002: Fuchsia: Initial check-in. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Address comments Created 4 years, 5 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/bin/fuchsia_test.cc ('k') | runtime/platform/globals.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) 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 return Integer::New(OS::GetCurrentMonotonicMicros(), Heap::kNew); 47 return Integer::New(OS::GetCurrentMonotonicMicros(), Heap::kNew);
48 } 48 }
49 49
50 50
51 DEFINE_NATIVE_ENTRY(Timeline_getThreadCpuClock, 0) { 51 DEFINE_NATIVE_ENTRY(Timeline_getThreadCpuClock, 0) {
52 return Integer::New(OS::GetCurrentThreadCPUMicros(), Heap::kNew); 52 return Integer::New(OS::GetCurrentThreadCPUMicros(), Heap::kNew);
53 } 53 }
54 54
55 55
56 DEFINE_NATIVE_ENTRY(Timeline_reportTaskEvent, 6) { 56 DEFINE_NATIVE_ENTRY(Timeline_reportTaskEvent, 6) {
57 #ifndef PRODUCT
57 if (!FLAG_support_timeline) { 58 if (!FLAG_support_timeline) {
58 return Object::null(); 59 return Object::null();
59 } 60 }
60 GET_NON_NULL_NATIVE_ARGUMENT(Integer, start, arguments->NativeArgAt(0)); 61 GET_NON_NULL_NATIVE_ARGUMENT(Integer, start, arguments->NativeArgAt(0));
61 GET_NON_NULL_NATIVE_ARGUMENT(Integer, id, arguments->NativeArgAt(1)); 62 GET_NON_NULL_NATIVE_ARGUMENT(Integer, id, arguments->NativeArgAt(1));
62 GET_NON_NULL_NATIVE_ARGUMENT(String, phase, arguments->NativeArgAt(2)); 63 GET_NON_NULL_NATIVE_ARGUMENT(String, phase, arguments->NativeArgAt(2));
63 GET_NON_NULL_NATIVE_ARGUMENT(String, category, arguments->NativeArgAt(3)); 64 GET_NON_NULL_NATIVE_ARGUMENT(String, category, arguments->NativeArgAt(3));
64 GET_NON_NULL_NATIVE_ARGUMENT(String, name, arguments->NativeArgAt(4)); 65 GET_NON_NULL_NATIVE_ARGUMENT(String, name, arguments->NativeArgAt(4));
65 GET_NON_NULL_NATIVE_ARGUMENT(String, args, arguments->NativeArgAt(5)); 66 GET_NON_NULL_NATIVE_ARGUMENT(String, args, arguments->NativeArgAt(5));
66 67
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 break; 108 break;
108 case 'e': 109 case 'e':
109 event->AsyncEnd("", id.AsInt64Value(), start.AsInt64Value()); 110 event->AsyncEnd("", id.AsInt64Value(), start.AsInt64Value());
110 break; 111 break;
111 default: 112 default:
112 UNREACHABLE(); 113 UNREACHABLE();
113 } 114 }
114 115
115 // json was allocated in the zone and a copy will be stored in event. 116 // json was allocated in the zone and a copy will be stored in event.
116 event->CompleteWithPreSerializedJSON(json); 117 event->CompleteWithPreSerializedJSON(json);
117 118 #endif
118 return Object::null(); 119 return Object::null();
119 } 120 }
120 121
121 122
122 DEFINE_NATIVE_ENTRY(Timeline_reportCompleteEvent, 5) { 123 DEFINE_NATIVE_ENTRY(Timeline_reportCompleteEvent, 5) {
124 #ifndef PRODUCT
123 if (!FLAG_support_timeline) { 125 if (!FLAG_support_timeline) {
124 return Object::null(); 126 return Object::null();
125 } 127 }
126 GET_NON_NULL_NATIVE_ARGUMENT(Integer, start, arguments->NativeArgAt(0)); 128 GET_NON_NULL_NATIVE_ARGUMENT(Integer, start, arguments->NativeArgAt(0));
127 GET_NON_NULL_NATIVE_ARGUMENT(Integer, start_cpu, arguments->NativeArgAt(1)); 129 GET_NON_NULL_NATIVE_ARGUMENT(Integer, start_cpu, arguments->NativeArgAt(1));
128 GET_NON_NULL_NATIVE_ARGUMENT(String, category, arguments->NativeArgAt(2)); 130 GET_NON_NULL_NATIVE_ARGUMENT(String, category, arguments->NativeArgAt(2));
129 GET_NON_NULL_NATIVE_ARGUMENT(String, name, arguments->NativeArgAt(3)); 131 GET_NON_NULL_NATIVE_ARGUMENT(String, name, arguments->NativeArgAt(3));
130 GET_NON_NULL_NATIVE_ARGUMENT(String, args, arguments->NativeArgAt(4)); 132 GET_NON_NULL_NATIVE_ARGUMENT(String, args, arguments->NativeArgAt(4));
131 133
132 TimelineEventRecorder* recorder = Timeline::recorder(); 134 TimelineEventRecorder* recorder = Timeline::recorder();
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 } 180 }
179 ASSERT(json != NULL); 181 ASSERT(json != NULL);
180 182
181 event->Duration("", 183 event->Duration("",
182 start.AsInt64Value(), 184 start.AsInt64Value(),
183 end, 185 end,
184 start_cpu.AsInt64Value(), 186 start_cpu.AsInt64Value(),
185 end_cpu); 187 end_cpu);
186 // 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.
187 event->CompleteWithPreSerializedJSON(json); 189 event->CompleteWithPreSerializedJSON(json);
188 190 #endif
189 return Object::null(); 191 return Object::null();
190 } 192 }
191 193
192 194
193 DEFINE_NATIVE_ENTRY(Timeline_reportInstantEvent, 4) { 195 DEFINE_NATIVE_ENTRY(Timeline_reportInstantEvent, 4) {
196 #ifndef PRODUCT
194 if (!FLAG_support_timeline) { 197 if (!FLAG_support_timeline) {
195 return Object::null(); 198 return Object::null();
196 } 199 }
197 GET_NON_NULL_NATIVE_ARGUMENT(Integer, start, arguments->NativeArgAt(0)); 200 GET_NON_NULL_NATIVE_ARGUMENT(Integer, start, arguments->NativeArgAt(0));
198 GET_NON_NULL_NATIVE_ARGUMENT(String, category, arguments->NativeArgAt(1)); 201 GET_NON_NULL_NATIVE_ARGUMENT(String, category, arguments->NativeArgAt(1));
199 GET_NON_NULL_NATIVE_ARGUMENT(String, name, arguments->NativeArgAt(2)); 202 GET_NON_NULL_NATIVE_ARGUMENT(String, name, arguments->NativeArgAt(2));
200 GET_NON_NULL_NATIVE_ARGUMENT(String, args, arguments->NativeArgAt(3)); 203 GET_NON_NULL_NATIVE_ARGUMENT(String, args, arguments->NativeArgAt(3));
201 204
202 TimelineEventRecorder* recorder = Timeline::recorder(); 205 TimelineEventRecorder* recorder = Timeline::recorder();
203 if (recorder == NULL) { 206 if (recorder == NULL) {
(...skipping 17 matching lines...) Expand all
221 name.ToCString(), 224 name.ToCString(),
222 category.ToCString(), 225 category.ToCString(),
223 tid, 226 tid,
224 pid, 227 pid,
225 start.AsInt64Value(), 228 start.AsInt64Value(),
226 args.ToCString()); 229 args.ToCString());
227 230
228 event->Instant("", start.AsInt64Value()); 231 event->Instant("", start.AsInt64Value());
229 // json was allocated in the zone and a copy will be stored in event. 232 // json was allocated in the zone and a copy will be stored in event.
230 event->CompleteWithPreSerializedJSON(json); 233 event->CompleteWithPreSerializedJSON(json);
231 234 #endif
232 return Object::null(); 235 return Object::null();
233 } 236 }
234 237
235 } // namespace dart 238 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/bin/fuchsia_test.cc ('k') | runtime/platform/globals.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698