| OLD | NEW |
| 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 <cstdlib> | 5 #include <cstdlib> |
| 6 | 6 |
| 7 #include "vm/atomic.h" | 7 #include "vm/atomic.h" |
| 8 #include "vm/isolate.h" | 8 #include "vm/isolate.h" |
| 9 #include "vm/json_stream.h" | 9 #include "vm/json_stream.h" |
| 10 #include "vm/lockers.h" | 10 #include "vm/lockers.h" |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 | 253 |
| 254 void TimelineEvent::Duration(const char* label, | 254 void TimelineEvent::Duration(const char* label, |
| 255 int64_t start_micros, | 255 int64_t start_micros, |
| 256 int64_t end_micros) { | 256 int64_t end_micros) { |
| 257 Init(kDuration, label); | 257 Init(kDuration, label); |
| 258 timestamp0_ = start_micros; | 258 timestamp0_ = start_micros; |
| 259 timestamp1_ = end_micros; | 259 timestamp1_ = end_micros; |
| 260 } | 260 } |
| 261 | 261 |
| 262 | 262 |
| 263 void TimelineEvent::Begin(const char* label, |
| 264 int64_t micros) { |
| 265 Init(kBegin, label); |
| 266 timestamp0_ = micros; |
| 267 } |
| 268 |
| 269 |
| 270 void TimelineEvent::End(const char* label, |
| 271 int64_t micros) { |
| 272 Init(kEnd, label); |
| 273 timestamp0_ = micros; |
| 274 } |
| 275 |
| 276 |
| 263 void TimelineEvent::SetNumArguments(intptr_t length) { | 277 void TimelineEvent::SetNumArguments(intptr_t length) { |
| 264 // Cannot call this twice. | 278 // Cannot call this twice. |
| 265 ASSERT(arguments_ == NULL); | 279 ASSERT(arguments_ == NULL); |
| 266 ASSERT(arguments_length_ == 0); | 280 ASSERT(arguments_length_ == 0); |
| 267 arguments_length_ = length; | 281 arguments_length_ = length; |
| 268 arguments_ = reinterpret_cast<TimelineEventArgument*>( | 282 arguments_ = reinterpret_cast<TimelineEventArgument*>( |
| 269 calloc(sizeof(TimelineEventArgument), length)); | 283 calloc(sizeof(TimelineEventArgument), length)); |
| 270 } | 284 } |
| 271 | 285 |
| 272 | 286 |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 JSONObject obj(stream); | 365 JSONObject obj(stream); |
| 352 int64_t pid = OS::ProcessId(); | 366 int64_t pid = OS::ProcessId(); |
| 353 int64_t tid = OSThread::ThreadIdToIntPtr(thread_); | 367 int64_t tid = OSThread::ThreadIdToIntPtr(thread_); |
| 354 obj.AddProperty("name", label_); | 368 obj.AddProperty("name", label_); |
| 355 obj.AddProperty("cat", category_); | 369 obj.AddProperty("cat", category_); |
| 356 obj.AddProperty64("tid", tid); | 370 obj.AddProperty64("tid", tid); |
| 357 obj.AddProperty64("pid", pid); | 371 obj.AddProperty64("pid", pid); |
| 358 obj.AddPropertyTimeMicros("ts", TimeOrigin()); | 372 obj.AddPropertyTimeMicros("ts", TimeOrigin()); |
| 359 | 373 |
| 360 switch (event_type()) { | 374 switch (event_type()) { |
| 375 case kBegin: { |
| 376 obj.AddProperty("ph", "B"); |
| 377 } |
| 378 break; |
| 379 case kEnd: { |
| 380 obj.AddProperty("ph", "E"); |
| 381 } |
| 382 break; |
| 361 case kDuration: { | 383 case kDuration: { |
| 362 obj.AddProperty("ph", "X"); | 384 obj.AddProperty("ph", "X"); |
| 363 obj.AddPropertyTimeMicros("dur", TimeDuration()); | 385 obj.AddPropertyTimeMicros("dur", TimeDuration()); |
| 364 } | 386 } |
| 365 break; | 387 break; |
| 366 case kInstant: { | 388 case kInstant: { |
| 367 obj.AddProperty("ph", "i"); | 389 obj.AddProperty("ph", "i"); |
| 368 obj.AddProperty("s", "p"); | 390 obj.AddProperty("s", "p"); |
| 369 } | 391 } |
| 370 break; | 392 break; |
| (...skipping 880 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1251 // If an isolate was specified, skip events from other isolates. | 1273 // If an isolate was specified, skip events from other isolates. |
| 1252 continue; | 1274 continue; |
| 1253 } | 1275 } |
| 1254 ASSERT(event->event_as_json() != NULL); | 1276 ASSERT(event->event_as_json() != NULL); |
| 1255 result = zone->ConcatStrings(result, event->event_as_json()); | 1277 result = zone->ConcatStrings(result, event->event_as_json()); |
| 1256 } | 1278 } |
| 1257 return result; | 1279 return result; |
| 1258 } | 1280 } |
| 1259 | 1281 |
| 1260 } // namespace dart | 1282 } // namespace dart |
| OLD | NEW |