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/isolate.h" | 7 #include "vm/isolate.h" |
8 #include "vm/json_stream.h" | 8 #include "vm/json_stream.h" |
9 #include "vm/object.h" | 9 #include "vm/object.h" |
10 #include "vm/thread.h" | 10 #include "vm/thread.h" |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 | 190 |
191 | 191 |
192 void TimelineEvent::PrintJSON(JSONStream* stream) const { | 192 void TimelineEvent::PrintJSON(JSONStream* stream) const { |
193 JSONObject obj(stream); | 193 JSONObject obj(stream); |
194 int64_t pid = GetPid(Isolate::Current()); | 194 int64_t pid = GetPid(Isolate::Current()); |
195 int64_t tid = GetTid(thread_); | 195 int64_t tid = GetTid(thread_); |
196 obj.AddProperty("name", label_); | 196 obj.AddProperty("name", label_); |
197 obj.AddProperty("cat", stream_->name()); | 197 obj.AddProperty("cat", stream_->name()); |
198 obj.AddProperty64("tid", tid); | 198 obj.AddProperty64("tid", tid); |
199 obj.AddProperty64("pid", pid); | 199 obj.AddProperty64("pid", pid); |
200 obj.AddProperty("ts", static_cast<double>(TimeOrigin())); | 200 obj.AddPropertyTimeMillis("ts", TimeOrigin()); |
201 | 201 |
202 switch (event_type()) { | 202 switch (event_type()) { |
203 case kDuration: { | 203 case kDuration: { |
204 obj.AddProperty("ph", "X"); | 204 obj.AddProperty("ph", "X"); |
205 obj.AddProperty("dur", static_cast<double>(TimeDuration())); | 205 obj.AddPropertyTimeMillis("dur", TimeDuration()); |
206 } | 206 } |
207 break; | 207 break; |
208 case kInstant: { | 208 case kInstant: { |
209 obj.AddProperty("ph", "i"); | 209 obj.AddProperty("ph", "i"); |
210 obj.AddProperty("s", "p"); | 210 obj.AddProperty("s", "p"); |
211 } | 211 } |
212 break; | 212 break; |
213 case kAsyncBegin: { | 213 case kAsyncBegin: { |
214 obj.AddProperty("ph", "b"); | 214 obj.AddProperty("ph", "b"); |
215 obj.AddPropertyF("id", "%" Px64 "", AsyncId()); | 215 obj.AddPropertyF("id", "%" Px64 "", AsyncId()); |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
508 return event; | 508 return event; |
509 } | 509 } |
510 | 510 |
511 | 511 |
512 void TimelineEventStreamingRecorder::CompleteEvent(TimelineEvent* event) { | 512 void TimelineEventStreamingRecorder::CompleteEvent(TimelineEvent* event) { |
513 StreamEvent(event); | 513 StreamEvent(event); |
514 delete event; | 514 delete event; |
515 } | 515 } |
516 | 516 |
517 } // namespace dart | 517 } // namespace dart |
OLD | NEW |