| OLD | NEW |
| 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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 "platform/globals.h" | 5 #include "platform/globals.h" |
| 6 #if defined(HOST_OS_FUCHSIA) && !defined(PRODUCT) | 6 #if defined(HOST_OS_FUCHSIA) && !defined(PRODUCT) |
| 7 | 7 |
| 8 #include "apps/tracing/lib/trace/cwriter.h" | 8 #include "apps/tracing/lib/trace/cwriter.h" |
| 9 #include "apps/tracing/lib/trace/event.h" | 9 #include "apps/tracing/lib/trace/event.h" |
| 10 #include "vm/object.h" | 10 #include "vm/object.h" |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 const char* args) { | 181 const char* args) { |
| 182 const int64_t end = OS::GetCurrentMonotonicMicros(); | 182 const int64_t end = OS::GetCurrentMonotonicMicros(); |
| 183 const int64_t end_cpu = OS::GetCurrentThreadCPUMicros(); | 183 const int64_t end_cpu = OS::GetCurrentThreadCPUMicros(); |
| 184 event->Duration(strdup(name), start, end, start_cpu, end_cpu); | 184 event->Duration(strdup(name), start, end, start_cpu, end_cpu); |
| 185 event->set_owns_label(true); | 185 event->set_owns_label(true); |
| 186 event->SetNumArguments(1); | 186 event->SetNumArguments(1); |
| 187 event->CopyArgument(0, "args", args); | 187 event->CopyArgument(0, "args", args); |
| 188 event->Complete(); | 188 event->Complete(); |
| 189 } | 189 } |
| 190 | 190 |
| 191 void DartTimelineEventHelpers::ReportFlowEvent(Thread* thread, |
| 192 Zone* zone, |
| 193 TimelineEvent* event, |
| 194 int64_t start, |
| 195 int64_t start_cpu, |
| 196 const char* category, |
| 197 const char* name, |
| 198 int64_t type, |
| 199 int64_t flow_id, |
| 200 const char* args) { |
| 201 char* name_string = strdup(name); |
| 202 ASSERT((type >= 0) && (type <= 2)); |
| 203 switch (type) { |
| 204 case 0: |
| 205 event->FlowBegin(name_string, flow_id, start); |
| 206 break; |
| 207 case 1: |
| 208 event->FlowStep(name_string, flow_id, start); |
| 209 break; |
| 210 case 2: |
| 211 event->FlowEnd(name_string, flow_id, start); |
| 212 break; |
| 213 default: |
| 214 UNREACHABLE(); |
| 215 break; |
| 216 } |
| 217 event->set_owns_label(true); |
| 218 event->SetNumArguments(1); |
| 219 event->CopyArgument(0, "args", args); |
| 220 event->Complete(); |
| 221 } |
| 222 |
| 191 void DartTimelineEventHelpers::ReportInstantEvent(Thread* thread, | 223 void DartTimelineEventHelpers::ReportInstantEvent(Thread* thread, |
| 192 Zone* zone, | 224 Zone* zone, |
| 193 TimelineEvent* event, | 225 TimelineEvent* event, |
| 194 int64_t start, | 226 int64_t start, |
| 195 const char* category, | 227 const char* category, |
| 196 const char* name, | 228 const char* name, |
| 197 const char* args) { | 229 const char* args) { |
| 198 event->Instant(strdup(name), start); | 230 event->Instant(strdup(name), start); |
| 199 event->set_owns_label(true); | 231 event->set_owns_label(true); |
| 200 event->SetNumArguments(1); | 232 event->SetNumArguments(1); |
| 201 event->CopyArgument(0, "args", args); | 233 event->CopyArgument(0, "args", args); |
| 202 event->Complete(); | 234 event->Complete(); |
| 203 } | 235 } |
| 204 | 236 |
| 205 } // namespace dart | 237 } // namespace dart |
| 206 | 238 |
| 207 #endif // defined(HOST_OS_FUCHSIA) && !defined(PRODUCT) | 239 #endif // defined(HOST_OS_FUCHSIA) && !defined(PRODUCT) |
| OLD | NEW |