OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CC_SCHEDULER_COMPOSITOR_TIMING_HISTORY_H_ | 5 #ifndef CC_SCHEDULER_COMPOSITOR_TIMING_HISTORY_H_ |
6 #define CC_SCHEDULER_COMPOSITOR_TIMING_HISTORY_H_ | 6 #define CC_SCHEDULER_COMPOSITOR_TIMING_HISTORY_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "cc/base/rolling_time_delta_history.h" | 10 #include "cc/base/rolling_time_delta_history.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 class CC_EXPORT CompositorTimingHistory { | 22 class CC_EXPORT CompositorTimingHistory { |
23 public: | 23 public: |
24 enum UMACategory { | 24 enum UMACategory { |
25 RENDERER_UMA, | 25 RENDERER_UMA, |
26 BROWSER_UMA, | 26 BROWSER_UMA, |
27 NULL_UMA, | 27 NULL_UMA, |
28 }; | 28 }; |
29 class UMAReporter; | 29 class UMAReporter; |
30 | 30 |
31 CompositorTimingHistory( | 31 CompositorTimingHistory( |
| 32 bool using_synchronous_renderer_compositor, |
32 UMACategory uma_category, | 33 UMACategory uma_category, |
33 RenderingStatsInstrumentation* rendering_stats_instrumentation); | 34 RenderingStatsInstrumentation* rendering_stats_instrumentation); |
34 virtual ~CompositorTimingHistory(); | 35 virtual ~CompositorTimingHistory(); |
35 | 36 |
36 void AsValueInto(base::trace_event::TracedValue* state) const; | 37 void AsValueInto(base::trace_event::TracedValue* state) const; |
37 | 38 |
38 // Deprecated: http://crbug.com/552004 | 39 // Deprecated: http://crbug.com/552004 |
39 virtual base::TimeDelta BeginMainFrameToCommitDurationEstimate() const; | 40 virtual base::TimeDelta BeginMainFrameToCommitDurationEstimate() const; |
40 | 41 |
41 // The main thread responsiveness depends heavily on whether or not the | 42 // The main thread responsiveness depends heavily on whether or not the |
42 // on_critical_path flag is set, so we record response times separately. | 43 // on_critical_path flag is set, so we record response times separately. |
43 virtual base::TimeDelta BeginMainFrameQueueDurationCriticalEstimate() const; | 44 virtual base::TimeDelta BeginMainFrameQueueDurationCriticalEstimate() const; |
44 virtual base::TimeDelta BeginMainFrameQueueDurationNotCriticalEstimate() | 45 virtual base::TimeDelta BeginMainFrameQueueDurationNotCriticalEstimate() |
45 const; | 46 const; |
46 virtual base::TimeDelta BeginMainFrameStartToCommitDurationEstimate() const; | 47 virtual base::TimeDelta BeginMainFrameStartToCommitDurationEstimate() const; |
47 virtual base::TimeDelta CommitToReadyToActivateDurationEstimate() const; | 48 virtual base::TimeDelta CommitToReadyToActivateDurationEstimate() const; |
48 virtual base::TimeDelta PrepareTilesDurationEstimate() const; | 49 virtual base::TimeDelta PrepareTilesDurationEstimate() const; |
49 virtual base::TimeDelta ActivateDurationEstimate() const; | 50 virtual base::TimeDelta ActivateDurationEstimate() const; |
50 virtual base::TimeDelta DrawDurationEstimate() const; | 51 virtual base::TimeDelta DrawDurationEstimate() const; |
51 | 52 |
| 53 // State that affects when events should be expected/recorded/reported. |
52 void SetRecordingEnabled(bool enabled); | 54 void SetRecordingEnabled(bool enabled); |
| 55 void DidCreateAndInitializeOutputSurface(); |
53 | 56 |
| 57 // Events to be timed. |
54 void WillBeginImplFrame(bool new_active_tree_is_likely); | 58 void WillBeginImplFrame(bool new_active_tree_is_likely); |
55 void WillFinishImplFrame(bool needs_redraw); | 59 void WillFinishImplFrame(bool needs_redraw); |
56 void BeginImplFrameNotExpectedSoon(); | 60 void BeginImplFrameNotExpectedSoon(); |
57 void WillBeginMainFrame(bool on_critical_path); | 61 void WillBeginMainFrame(bool on_critical_path, |
| 62 base::TimeTicks main_frame_time); |
58 void BeginMainFrameStarted(base::TimeTicks main_thread_start_time); | 63 void BeginMainFrameStarted(base::TimeTicks main_thread_start_time); |
59 void BeginMainFrameAborted(); | 64 void BeginMainFrameAborted(); |
60 void DidCommit(); | 65 void DidCommit(); |
61 void WillPrepareTiles(); | 66 void WillPrepareTiles(); |
62 void DidPrepareTiles(); | 67 void DidPrepareTiles(); |
63 void ReadyToActivate(); | 68 void ReadyToActivate(); |
64 void WillActivate(); | 69 void WillActivate(); |
65 void DidActivate(); | 70 void DidActivate(); |
| 71 void DrawAborted(); |
66 void WillDraw(); | 72 void WillDraw(); |
67 void DidDraw(bool used_new_active_tree); | 73 void DidDraw(bool used_new_active_tree, |
| 74 bool main_thread_missed_last_deadline, |
| 75 base::TimeTicks impl_frame_time); |
68 void DidSwapBuffers(); | 76 void DidSwapBuffers(); |
69 void DidSwapBuffersComplete(); | 77 void DidSwapBuffersComplete(); |
70 void DidSwapBuffersReset(); | |
71 | 78 |
72 protected: | 79 protected: |
73 void DidBeginMainFrame(); | 80 void DidBeginMainFrame(); |
74 | 81 |
75 void SetBeginMainFrameNeededContinuously(bool active); | 82 void SetBeginMainFrameNeededContinuously(bool active); |
76 void SetBeginMainFrameCommittingContinuously(bool active); | 83 void SetBeginMainFrameCommittingContinuously(bool active); |
77 void SetCompositorDrawingContinuously(bool active); | 84 void SetCompositorDrawingContinuously(bool active); |
78 | 85 |
79 static scoped_ptr<UMAReporter> CreateUMAReporter(UMACategory category); | 86 static scoped_ptr<UMAReporter> CreateUMAReporter(UMACategory category); |
80 virtual base::TimeTicks Now() const; | 87 virtual base::TimeTicks Now() const; |
81 | 88 |
| 89 bool using_synchronous_renderer_compositor_; |
82 bool enabled_; | 90 bool enabled_; |
83 | 91 |
84 // Used to calculate frame rates of Main and Impl threads. | 92 // Used to calculate frame rates of Main and Impl threads. |
85 bool did_send_begin_main_frame_; | 93 bool did_send_begin_main_frame_; |
86 bool begin_main_frame_needed_continuously_; | 94 bool begin_main_frame_needed_continuously_; |
87 bool begin_main_frame_committing_continuously_; | 95 bool begin_main_frame_committing_continuously_; |
88 bool compositor_drawing_continuously_; | 96 bool compositor_drawing_continuously_; |
89 base::TimeTicks begin_main_frame_end_time_prev_; | 97 base::TimeTicks begin_main_frame_end_time_prev_; |
90 base::TimeTicks new_active_tree_draw_end_time_prev_; | 98 base::TimeTicks new_active_tree_draw_end_time_prev_; |
91 base::TimeTicks draw_end_time_prev_; | 99 base::TimeTicks draw_end_time_prev_; |
92 | 100 |
93 RollingTimeDeltaHistory begin_main_frame_sent_to_commit_duration_history_; | 101 RollingTimeDeltaHistory begin_main_frame_sent_to_commit_duration_history_; |
94 RollingTimeDeltaHistory begin_main_frame_queue_duration_history_; | 102 RollingTimeDeltaHistory begin_main_frame_queue_duration_history_; |
95 RollingTimeDeltaHistory begin_main_frame_queue_duration_critical_history_; | 103 RollingTimeDeltaHistory begin_main_frame_queue_duration_critical_history_; |
96 RollingTimeDeltaHistory begin_main_frame_queue_duration_not_critical_history_; | 104 RollingTimeDeltaHistory begin_main_frame_queue_duration_not_critical_history_; |
97 RollingTimeDeltaHistory begin_main_frame_start_to_commit_duration_history_; | 105 RollingTimeDeltaHistory begin_main_frame_start_to_commit_duration_history_; |
98 RollingTimeDeltaHistory commit_to_ready_to_activate_duration_history_; | 106 RollingTimeDeltaHistory commit_to_ready_to_activate_duration_history_; |
99 RollingTimeDeltaHistory prepare_tiles_duration_history_; | 107 RollingTimeDeltaHistory prepare_tiles_duration_history_; |
100 RollingTimeDeltaHistory activate_duration_history_; | 108 RollingTimeDeltaHistory activate_duration_history_; |
101 RollingTimeDeltaHistory draw_duration_history_; | 109 RollingTimeDeltaHistory draw_duration_history_; |
102 | 110 |
103 bool begin_main_frame_on_critical_path_; | 111 bool begin_main_frame_on_critical_path_; |
| 112 base::TimeTicks begin_main_frame_frame_time_; |
104 base::TimeTicks begin_main_frame_sent_time_; | 113 base::TimeTicks begin_main_frame_sent_time_; |
105 base::TimeTicks begin_main_frame_start_time_; | 114 base::TimeTicks begin_main_frame_start_time_; |
106 base::TimeTicks begin_main_frame_end_time_; | 115 base::TimeTicks begin_main_frame_end_time_; |
| 116 base::TimeTicks pending_tree_main_frame_time_; |
107 base::TimeTicks prepare_tiles_start_time_; | 117 base::TimeTicks prepare_tiles_start_time_; |
108 base::TimeTicks activate_start_time_; | 118 base::TimeTicks activate_start_time_; |
| 119 base::TimeTicks active_tree_main_frame_time_; |
109 base::TimeTicks draw_start_time_; | 120 base::TimeTicks draw_start_time_; |
110 base::TimeTicks swap_start_time_; | 121 base::TimeTicks swap_start_time_; |
111 | 122 |
112 scoped_ptr<UMAReporter> uma_reporter_; | 123 scoped_ptr<UMAReporter> uma_reporter_; |
113 RenderingStatsInstrumentation* rendering_stats_instrumentation_; | 124 RenderingStatsInstrumentation* rendering_stats_instrumentation_; |
114 | 125 |
115 private: | 126 private: |
116 DISALLOW_COPY_AND_ASSIGN(CompositorTimingHistory); | 127 DISALLOW_COPY_AND_ASSIGN(CompositorTimingHistory); |
117 }; | 128 }; |
118 | 129 |
119 } // namespace cc | 130 } // namespace cc |
120 | 131 |
121 #endif // CC_SCHEDULER_COMPOSITOR_TIMING_HISTORY_H_ | 132 #endif // CC_SCHEDULER_COMPOSITOR_TIMING_HISTORY_H_ |
OLD | NEW |