Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(367)

Side by Side Diff: runtime/vm/timeline.h

Issue 2977513002: [Fuchsia] Routes timeline events to Fuchsia's tracing app (Closed)
Patch Set: Format Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/vm/BUILD.gn ('k') | runtime/vm/timeline.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 RUNTIME_VM_TIMELINE_H_ 5 #ifndef RUNTIME_VM_TIMELINE_H_
6 #define RUNTIME_VM_TIMELINE_H_ 6 #define RUNTIME_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 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 311
312 const char* GetSerializedJSON() const; 312 const char* GetSerializedJSON() const;
313 313
314 void set_owns_label(bool owns_label) { 314 void set_owns_label(bool owns_label) {
315 state_ = OwnsLabelBit::update(owns_label, state_); 315 state_ = OwnsLabelBit::update(owns_label, state_);
316 } 316 }
317 317
318 // Returns the number of bytes written into |buffer|. 318 // Returns the number of bytes written into |buffer|.
319 intptr_t PrintSystrace(char* buffer, intptr_t buffer_size); 319 intptr_t PrintSystrace(char* buffer, intptr_t buffer_size);
320 320
321 #if defined(HOST_OS_FUCHSIA)
322 void EmitFuchsiaEvent();
323 #endif
324
321 private: 325 private:
322 void FreeArguments(); 326 void FreeArguments();
323 327
324 void StreamInit(TimelineStream* stream); 328 void StreamInit(TimelineStream* stream);
325 void Init(EventType event_type, const char* label); 329 void Init(EventType event_type, const char* label);
326 330
327 void set_event_type(EventType event_type) { 331 void set_event_type(EventType event_type) {
328 // We only reserve 4 bits to hold the event type. 332 // We only reserve 4 bits to hold the event type.
329 COMPILE_ASSERT(kNumEventTypes < 16); 333 COMPILE_ASSERT(kNumEventTypes < 16);
330 state_ = EventTypeField::update(event_type, state_); 334 state_ = EventTypeField::update(event_type, state_);
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 const char* label_; 383 const char* label_;
380 const char* category_; 384 const char* category_;
381 ThreadId thread_; 385 ThreadId thread_;
382 Dart_Port isolate_id_; 386 Dart_Port isolate_id_;
383 387
384 friend class TimelineEventRecorder; 388 friend class TimelineEventRecorder;
385 friend class TimelineEventEndlessRecorder; 389 friend class TimelineEventEndlessRecorder;
386 friend class TimelineEventRingRecorder; 390 friend class TimelineEventRingRecorder;
387 friend class TimelineEventStartupRecorder; 391 friend class TimelineEventStartupRecorder;
388 friend class TimelineEventSystraceRecorder; 392 friend class TimelineEventSystraceRecorder;
393 friend class TimelineEventFuchsiaRecorder;
389 friend class TimelineStream; 394 friend class TimelineStream;
390 friend class TimelineTestHelper; 395 friend class TimelineTestHelper;
391 DISALLOW_COPY_AND_ASSIGN(TimelineEvent); 396 DISALLOW_COPY_AND_ASSIGN(TimelineEvent);
392 }; 397 };
393 398
394 399
395 #ifndef PRODUCT 400 #ifndef PRODUCT
396 #define TIMELINE_FUNCTION_COMPILATION_DURATION(thread, name, function) \ 401 #define TIMELINE_FUNCTION_COMPILATION_DURATION(thread, name, function) \
397 TimelineDurationScope tds(thread, Timeline::GetCompilerStream(), name); \ 402 TimelineDurationScope tds(thread, Timeline::GetCompilerStream(), name); \
398 if (tds.enabled()) { \ 403 if (tds.enabled()) { \
(...skipping 27 matching lines...) Expand all
426 TimelineEventScope(TimelineStream* stream, const char* label); 431 TimelineEventScope(TimelineStream* stream, const char* label);
427 432
428 TimelineEventScope(Thread* thread, TimelineStream* stream, const char* label); 433 TimelineEventScope(Thread* thread, TimelineStream* stream, const char* label);
429 434
430 bool ShouldEmitEvent() const { return enabled_; } 435 bool ShouldEmitEvent() const { return enabled_; }
431 436
432 void set_enabled(bool enabled) { enabled_ = enabled; } 437 void set_enabled(bool enabled) { enabled_ = enabled; }
433 438
434 const char* label() const { return label_; } 439 const char* label() const { return label_; }
435 440
441 TimelineEventArgument* arguments() const { return arguments_; }
442
443 intptr_t arguments_length() const { return arguments_length_; }
444
436 TimelineStream* stream() const { return stream_; } 445 TimelineStream* stream() const { return stream_; }
437 446
438 virtual ~TimelineEventScope(); 447 virtual ~TimelineEventScope();
439 448
440 void StealArguments(TimelineEvent* event); 449 void StealArguments(TimelineEvent* event);
441 450
442 private: 451 private:
443 void Init(); 452 void Init();
444 void FreeArguments(); 453 void FreeArguments();
445 454
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
553 562
554 void Open(); 563 void Open();
555 void Finish(); 564 void Finish();
556 565
557 friend class Thread; 566 friend class Thread;
558 friend class TimelineEventRecorder; 567 friend class TimelineEventRecorder;
559 friend class TimelineEventEndlessRecorder; 568 friend class TimelineEventEndlessRecorder;
560 friend class TimelineEventRingRecorder; 569 friend class TimelineEventRingRecorder;
561 friend class TimelineEventStartupRecorder; 570 friend class TimelineEventStartupRecorder;
562 friend class TimelineEventSystraceRecorder; 571 friend class TimelineEventSystraceRecorder;
572 friend class TimelineEventFuchsiaRecorder;
563 friend class TimelineTestHelper; 573 friend class TimelineTestHelper;
564 friend class JSONStream; 574 friend class JSONStream;
565 575
566 private: 576 private:
567 DISALLOW_COPY_AND_ASSIGN(TimelineEventBlock); 577 DISALLOW_COPY_AND_ASSIGN(TimelineEventBlock);
568 }; 578 };
569 579
570 580
571 class TimelineEventFilter : public ValueObject { 581 class TimelineEventFilter : public ValueObject {
572 public: 582 public:
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
728 const char* name() const { return "Systrace"; } 738 const char* name() const { return "Systrace"; }
729 739
730 protected: 740 protected:
731 TimelineEventBlock* GetNewBlockLocked(); 741 TimelineEventBlock* GetNewBlockLocked();
732 void CompleteEvent(TimelineEvent* event); 742 void CompleteEvent(TimelineEvent* event);
733 743
734 int systrace_fd_; 744 int systrace_fd_;
735 }; 745 };
736 746
737 747
748 #if defined(HOST_OS_FUCHSIA)
749 // A recorder that sends events to Fuchsia's tracing app. Events are also stored
750 // in a buffer of fixed capacity. When the buffer is full, new events overwrite
751 // old events.
752 // See: https://fuchsia.googlesource.com/tracing/+/HEAD/docs/usage_guide.md
753 class TimelineEventFuchsiaRecorder : public TimelineEventFixedBufferRecorder {
754 public:
755 explicit TimelineEventFuchsiaRecorder(intptr_t capacity = kDefaultCapacity);
756 virtual ~TimelineEventFuchsiaRecorder() {}
757
758 const char* name() const { return "Fuchsia"; }
759
760 protected:
761 TimelineEventBlock* GetNewBlockLocked();
762 void CompleteEvent(TimelineEvent* event);
763 };
764 #endif // defined(HOST_OS_FUCHSIA)
765
766
738 // A recorder that stores events in a buffer of fixed capacity. When the buffer 767 // A recorder that stores events in a buffer of fixed capacity. When the buffer
739 // is full, new events are dropped. 768 // is full, new events are dropped.
740 class TimelineEventStartupRecorder : public TimelineEventFixedBufferRecorder { 769 class TimelineEventStartupRecorder : public TimelineEventFixedBufferRecorder {
741 public: 770 public:
742 explicit TimelineEventStartupRecorder(intptr_t capacity = kDefaultCapacity) 771 explicit TimelineEventStartupRecorder(intptr_t capacity = kDefaultCapacity)
743 : TimelineEventFixedBufferRecorder(capacity) {} 772 : TimelineEventFixedBufferRecorder(capacity) {}
744 virtual ~TimelineEventStartupRecorder() {} 773 virtual ~TimelineEventStartupRecorder() {}
745 774
746 const char* name() const { return "Startup"; } 775 const char* name() const { return "Startup"; }
747 776
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
820 849
821 private: 850 private:
822 TimelineEventBlock* current_; 851 TimelineEventBlock* current_;
823 TimelineEventRecorder* recorder_; 852 TimelineEventRecorder* recorder_;
824 }; 853 };
825 854
826 855
827 } // namespace dart 856 } // namespace dart
828 857
829 #endif // RUNTIME_VM_TIMELINE_H_ 858 #endif // RUNTIME_VM_TIMELINE_H_
OLDNEW
« no previous file with comments | « runtime/vm/BUILD.gn ('k') | runtime/vm/timeline.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698