| 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 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 364 return; | 364 return; |
| 365 } | 365 } |
| 366 | 366 |
| 367 JSONStream js; | 367 JSONStream js; |
| 368 PrintJSON(&js); | 368 PrintJSON(&js); |
| 369 | 369 |
| 370 const char* format = "%s/dart-timeline-%" Pd "-%" Pd ".json"; | 370 const char* format = "%s/dart-timeline-%" Pd "-%" Pd ".json"; |
| 371 intptr_t pid = OS::ProcessId(); | 371 intptr_t pid = OS::ProcessId(); |
| 372 intptr_t len = OS::SNPrint(NULL, 0, format, | 372 intptr_t len = OS::SNPrint(NULL, 0, format, |
| 373 directory, pid, isolate->main_port()); | 373 directory, pid, isolate->main_port()); |
| 374 char* filename = isolate->current_zone()->Alloc<char>(len + 1); | 374 char* filename = Thread::Current()->zone()->Alloc<char>(len + 1); |
| 375 OS::SNPrint(filename, len + 1, format, | 375 OS::SNPrint(filename, len + 1, format, |
| 376 directory, pid, isolate->main_port()); | 376 directory, pid, isolate->main_port()); |
| 377 void* file = (*file_open)(filename, true); | 377 void* file = (*file_open)(filename, true); |
| 378 if (file == NULL) { | 378 if (file == NULL) { |
| 379 OS::Print("Failed to write timeline file: %s\n", filename); | 379 OS::Print("Failed to write timeline file: %s\n", filename); |
| 380 return; | 380 return; |
| 381 } | 381 } |
| 382 (*file_write)(js.buffer()->buf(), js.buffer()->length(), file); | 382 (*file_write)(js.buffer()->buf(), js.buffer()->length(), file); |
| 383 (*file_close)(file); | 383 (*file_close)(file); |
| 384 } | 384 } |
| (...skipping 123 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 |