OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 "include/dart_api.h" | 5 #include "include/dart_api.h" |
6 #include "include/dart_mirrors_api.h" | 6 #include "include/dart_mirrors_api.h" |
7 #include "include/dart_native_api.h" | 7 #include "include/dart_native_api.h" |
8 | 8 |
9 #include "platform/assert.h" | 9 #include "platform/assert.h" |
10 #include "vm/class_finalizer.h" | 10 #include "vm/class_finalizer.h" |
(...skipping 5869 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5880 if (consumer == NULL) { | 5880 if (consumer == NULL) { |
5881 return false; | 5881 return false; |
5882 } | 5882 } |
5883 TimelineEventRecorder* timeline_recorder = Timeline::recorder(); | 5883 TimelineEventRecorder* timeline_recorder = Timeline::recorder(); |
5884 if (timeline_recorder == NULL) { | 5884 if (timeline_recorder == NULL) { |
5885 // Nothing has been recorded. | 5885 // Nothing has been recorded. |
5886 return false; | 5886 return false; |
5887 } | 5887 } |
5888 Thread* T = Thread::Current(); | 5888 Thread* T = Thread::Current(); |
5889 StackZone zone(T); | 5889 StackZone zone(T); |
5890 // Reclaim all blocks cached by isolate. | 5890 Timeline::ReclaimCachedBlocksFromThreads(); |
5891 Timeline::ReclaimIsolateBlocks(); | |
5892 JSONStream js; | 5891 JSONStream js; |
5893 IsolateTimelineEventFilter filter(isolate); | 5892 IsolateTimelineEventFilter filter(isolate); |
5894 timeline_recorder->PrintTraceEvent(&js, &filter); | 5893 timeline_recorder->PrintTraceEvent(&js, &filter); |
5895 const char* dart_events = | 5894 const char* dart_events = |
5896 DartTimelineEventIterator::PrintTraceEvents(timeline_recorder, | 5895 DartTimelineEventIterator::PrintTraceEvents(timeline_recorder, |
5897 zone.GetZone(), | 5896 zone.GetZone(), |
5898 isolate); | 5897 isolate); |
5899 return StreamTraceEvents(consumer, user_data, &js, dart_events); | 5898 return StreamTraceEvents(consumer, user_data, &js, dart_events); |
5900 } | 5899 } |
5901 | 5900 |
5902 | 5901 |
5903 DART_EXPORT bool Dart_GlobalTimelineGetTrace(Dart_StreamConsumer consumer, | 5902 DART_EXPORT bool Dart_GlobalTimelineGetTrace(Dart_StreamConsumer consumer, |
5904 void* user_data) { | 5903 void* user_data) { |
5905 if (consumer == NULL) { | 5904 if (consumer == NULL) { |
5906 return false; | 5905 return false; |
5907 } | 5906 } |
5908 TimelineEventRecorder* timeline_recorder = Timeline::recorder(); | 5907 TimelineEventRecorder* timeline_recorder = Timeline::recorder(); |
5909 if (timeline_recorder == NULL) { | 5908 if (timeline_recorder == NULL) { |
5910 // Nothing has been recorded. | 5909 // Nothing has been recorded. |
5911 return false; | 5910 return false; |
5912 } | 5911 } |
5913 Thread* T = Thread::Current(); | 5912 Thread* T = Thread::Current(); |
5914 StackZone zone(T); | 5913 StackZone zone(T); |
5915 // Reclaim all blocks cached in the system. | 5914 Timeline::ReclaimCachedBlocksFromThreads(); |
5916 Timeline::ReclaimAllBlocks(); | |
5917 JSONStream js; | 5915 JSONStream js; |
5918 TimelineEventFilter filter; | 5916 TimelineEventFilter filter; |
5919 timeline_recorder->PrintTraceEvent(&js, &filter); | 5917 timeline_recorder->PrintTraceEvent(&js, &filter); |
5920 const char* dart_events = | 5918 const char* dart_events = |
5921 DartTimelineEventIterator::PrintTraceEvents(timeline_recorder, | 5919 DartTimelineEventIterator::PrintTraceEvents(timeline_recorder, |
5922 zone.GetZone(), | 5920 zone.GetZone(), |
5923 NULL); | 5921 NULL); |
5924 return StreamTraceEvents(consumer, user_data, &js, dart_events); | 5922 return StreamTraceEvents(consumer, user_data, &js, dart_events); |
5925 } | 5923 } |
5926 | 5924 |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6089 ApiReallocate); | 6087 ApiReallocate); |
6090 writer.WriteFullSnapshot(); | 6088 writer.WriteFullSnapshot(); |
6091 *vm_isolate_snapshot_size = writer.VmIsolateSnapshotSize(); | 6089 *vm_isolate_snapshot_size = writer.VmIsolateSnapshotSize(); |
6092 *isolate_snapshot_size = writer.IsolateSnapshotSize(); | 6090 *isolate_snapshot_size = writer.IsolateSnapshotSize(); |
6093 *instructions_snapshot_size = writer.InstructionsSnapshotSize(); | 6091 *instructions_snapshot_size = writer.InstructionsSnapshotSize(); |
6094 | 6092 |
6095 return Api::Success(); | 6093 return Api::Success(); |
6096 } | 6094 } |
6097 | 6095 |
6098 } // namespace dart | 6096 } // namespace dart |
OLD | NEW |