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 #ifndef VM_TIMELINE_H_ | 5 #ifndef VM_TIMELINE_H_ |
6 #define VM_TIMELINE_H_ | 6 #define VM_TIMELINE_H_ |
7 | 7 |
8 #include "include/dart_tools_api.h" | 8 #include "include/dart_tools_api.h" |
9 | 9 |
10 #include "vm/allocation.h" | 10 #include "vm/allocation.h" |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 } | 279 } |
280 return true; | 280 return true; |
281 } | 281 } |
282 } | 282 } |
283 | 283 |
284 bool Within(int64_t time_origin_micros, | 284 bool Within(int64_t time_origin_micros, |
285 int64_t time_extent_micros); | 285 int64_t time_extent_micros); |
286 | 286 |
287 const char* GetSerializedJSON() const; | 287 const char* GetSerializedJSON() const; |
288 | 288 |
| 289 void set_owns_label(bool owns_label) { |
| 290 state_ = OwnsLabelBit::update(owns_label, state_); |
| 291 } |
| 292 |
289 private: | 293 private: |
290 void FreeArguments(); | 294 void FreeArguments(); |
291 | 295 |
292 void StreamInit(TimelineStream* stream); | 296 void StreamInit(TimelineStream* stream); |
293 void Init(EventType event_type, const char* label); | 297 void Init(EventType event_type, const char* label); |
294 | 298 |
295 void set_event_type(EventType event_type) { | 299 void set_event_type(EventType event_type) { |
296 // We only reserve 4 bits to hold the event type. | 300 // We only reserve 4 bits to hold the event type. |
297 COMPILE_ASSERT(kNumEventTypes < 16); | 301 COMPILE_ASSERT(kNumEventTypes < 16); |
298 state_ = EventTypeField::update(event_type, state_); | 302 state_ = EventTypeField::update(event_type, state_); |
299 } | 303 } |
300 | 304 |
301 void set_timestamp0(int64_t value) { | 305 void set_timestamp0(int64_t value) { |
302 ASSERT(timestamp0_ == 0); | 306 ASSERT(timestamp0_ == 0); |
303 timestamp0_ = value; | 307 timestamp0_ = value; |
304 } | 308 } |
305 void set_timestamp1(int64_t value) { | 309 void set_timestamp1(int64_t value) { |
306 ASSERT(timestamp1_ == 0); | 310 ASSERT(timestamp1_ == 0); |
307 timestamp1_ = value; | 311 timestamp1_ = value; |
308 } | 312 } |
309 | 313 |
310 bool pre_serialized_json() const { | 314 bool pre_serialized_json() const { |
311 return PreSerializedJSON::decode(state_); | 315 return PreSerializedJSON::decode(state_); |
312 } | 316 } |
313 | 317 |
314 void set_pre_serialized_json(bool pre_serialized_json) { | 318 void set_pre_serialized_json(bool pre_serialized_json) { |
315 state_ = PreSerializedJSON::update(pre_serialized_json, state_); | 319 state_ = PreSerializedJSON::update(pre_serialized_json, state_); |
316 } | 320 } |
317 | 321 |
| 322 bool owns_label() const { |
| 323 return OwnsLabelBit::decode(state_); |
| 324 } |
| 325 |
318 enum StateBits { | 326 enum StateBits { |
319 kEventTypeBit = 0, // reserve 4 bits for type. | 327 kEventTypeBit = 0, // reserve 4 bits for type. |
320 kPreSerializedJSON = 4, | 328 kPreSerializedJSON = 4, |
321 kNextBit = 5, | 329 kOwnsLabelBit = 5, |
| 330 kNextBit = 6, |
322 }; | 331 }; |
323 | 332 |
324 class EventTypeField : public BitField<uword, EventType, kEventTypeBit, 4> {}; | 333 class EventTypeField : public BitField<uword, EventType, kEventTypeBit, 4> {}; |
325 class PreSerializedJSON : | 334 class PreSerializedJSON : |
326 public BitField<uword, bool, kPreSerializedJSON, 1> {}; | 335 public BitField<uword, bool, kPreSerializedJSON, 1> {}; |
| 336 class OwnsLabelBit : public BitField<uword, bool, kOwnsLabelBit, 1> {}; |
327 | 337 |
328 int64_t timestamp0_; | 338 int64_t timestamp0_; |
329 int64_t timestamp1_; | 339 int64_t timestamp1_; |
330 TimelineEventArgument* arguments_; | 340 TimelineEventArgument* arguments_; |
331 intptr_t arguments_length_; | 341 intptr_t arguments_length_; |
332 uword state_; | 342 uword state_; |
333 const char* label_; | 343 const char* label_; |
334 const char* category_; | 344 const char* category_; |
335 ThreadId thread_; | 345 ThreadId thread_; |
336 Dart_Port isolate_id_; | 346 Dart_Port isolate_id_; |
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
838 | 848 |
839 private: | 849 private: |
840 TimelineEventBlock* current_; | 850 TimelineEventBlock* current_; |
841 TimelineEventRecorder* recorder_; | 851 TimelineEventRecorder* recorder_; |
842 }; | 852 }; |
843 | 853 |
844 | 854 |
845 } // namespace dart | 855 } // namespace dart |
846 | 856 |
847 #endif // VM_TIMELINE_H_ | 857 #endif // VM_TIMELINE_H_ |
OLD | NEW |