| 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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 ISOLATE_TIMELINE_STREAM_LIST(ISOLATE_TIMELINE_STREAM_FLAG_DEFAULT) | 148 ISOLATE_TIMELINE_STREAM_LIST(ISOLATE_TIMELINE_STREAM_FLAG_DEFAULT) |
| 149 #undef ISOLATE_TIMELINE_STREAM_FLAG_DEFAULT | 149 #undef ISOLATE_TIMELINE_STREAM_FLAG_DEFAULT |
| 150 } | 150 } |
| 151 | 151 |
| 152 | 152 |
| 153 void Timeline::SetVMStreamEnabled(bool enabled) { | 153 void Timeline::SetVMStreamEnabled(bool enabled) { |
| 154 vm_stream_.set_enabled(enabled); | 154 vm_stream_.set_enabled(enabled); |
| 155 } | 155 } |
| 156 | 156 |
| 157 | 157 |
| 158 void Timeline::StreamStateChange(const char* stream_name, |
| 159 bool prev, |
| 160 bool curr) { |
| 161 if (prev == curr) { |
| 162 return; |
| 163 } |
| 164 if (strcmp(stream_name, "Embedder") == 0) { |
| 165 if (curr && (Timeline::get_start_recording_cb() != NULL)) { |
| 166 Timeline::get_start_recording_cb()(); |
| 167 } else if (!curr && (Timeline::get_stop_recording_cb() != NULL)) { |
| 168 Timeline::get_stop_recording_cb()(); |
| 169 } |
| 170 } |
| 171 } |
| 172 |
| 173 |
| 158 void Timeline::Shutdown() { | 174 void Timeline::Shutdown() { |
| 159 ASSERT(recorder_ != NULL); | 175 ASSERT(recorder_ != NULL); |
| 160 if (FLAG_timeline_dir != NULL) { | 176 if (FLAG_timeline_dir != NULL) { |
| 161 recorder_->WriteTo(FLAG_timeline_dir); | 177 recorder_->WriteTo(FLAG_timeline_dir); |
| 162 } | 178 } |
| 163 // Disable global streams. | 179 // Disable global streams. |
| 164 vm_stream_.set_enabled(false); | 180 vm_stream_.set_enabled(false); |
| 165 vm_api_stream_.set_enabled(false); | 181 vm_api_stream_.set_enabled(false); |
| 166 #define ISOLATE_TIMELINE_STREAM_DISABLE(name, not_used) \ | 182 #define ISOLATE_TIMELINE_STREAM_DISABLE(name, not_used) \ |
| 167 stream_##name##_enabled_ = false; | 183 stream_##name##_enabled_ = false; |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 } | 282 } |
| 267 ReclaimCachedBlocksFromThreads(); | 283 ReclaimCachedBlocksFromThreads(); |
| 268 recorder->Clear(); | 284 recorder->Clear(); |
| 269 } | 285 } |
| 270 | 286 |
| 271 | 287 |
| 272 TimelineEventRecorder* Timeline::recorder_ = NULL; | 288 TimelineEventRecorder* Timeline::recorder_ = NULL; |
| 273 TimelineStream Timeline::vm_stream_; | 289 TimelineStream Timeline::vm_stream_; |
| 274 TimelineStream Timeline::vm_api_stream_; | 290 TimelineStream Timeline::vm_api_stream_; |
| 275 MallocGrowableArray<char*>* Timeline::enabled_streams_ = NULL; | 291 MallocGrowableArray<char*>* Timeline::enabled_streams_ = NULL; |
| 292 Dart_EmbedderTimelineStartRecording Timeline::start_recording_cb_ = NULL; |
| 293 Dart_EmbedderTimelineStopRecording Timeline::stop_recording_cb_ = NULL; |
| 294 Dart_EmbedderTimelineGetTimeline Timeline::get_timeline_cb_ = NULL; |
| 276 | 295 |
| 277 #define ISOLATE_TIMELINE_STREAM_DEFINE_FLAG(name, enabled_by_default) \ | 296 #define ISOLATE_TIMELINE_STREAM_DEFINE_FLAG(name, enabled_by_default) \ |
| 278 bool Timeline::stream_##name##_enabled_ = enabled_by_default; | 297 bool Timeline::stream_##name##_enabled_ = enabled_by_default; |
| 279 ISOLATE_TIMELINE_STREAM_LIST(ISOLATE_TIMELINE_STREAM_DEFINE_FLAG) | 298 ISOLATE_TIMELINE_STREAM_LIST(ISOLATE_TIMELINE_STREAM_DEFINE_FLAG) |
| 280 #undef ISOLATE_TIMELINE_STREAM_DEFINE_FLAG | 299 #undef ISOLATE_TIMELINE_STREAM_DEFINE_FLAG |
| 281 | 300 |
| 282 TimelineEvent::TimelineEvent() | 301 TimelineEvent::TimelineEvent() |
| 283 : timestamp0_(0), | 302 : timestamp0_(0), |
| 284 timestamp1_(0), | 303 timestamp1_(0), |
| 285 arguments_(NULL), | 304 arguments_(NULL), |
| (...skipping 1237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1523 TimelineEventBlock* TimelineEventBlockIterator::Next() { | 1542 TimelineEventBlock* TimelineEventBlockIterator::Next() { |
| 1524 ASSERT(current_ != NULL); | 1543 ASSERT(current_ != NULL); |
| 1525 TimelineEventBlock* r = current_; | 1544 TimelineEventBlock* r = current_; |
| 1526 current_ = current_->next(); | 1545 current_ = current_->next(); |
| 1527 return r; | 1546 return r; |
| 1528 } | 1547 } |
| 1529 | 1548 |
| 1530 #endif // !PRODUCT | 1549 #endif // !PRODUCT |
| 1531 | 1550 |
| 1532 } // namespace dart | 1551 } // namespace dart |
| OLD | NEW |