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
3 // found in the LICENSE file.
5 #ifndef CC_SCHEDULER_COMPOSITOR_TIMING_HISTORY_H_
6 #define CC_SCHEDULER_COMPOSITOR_TIMING_HISTORY_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "cc/base/rolling_time_delta_history.h"
12 namespace trace_event
{
14 } // namespace trace_event
19 class RenderingStatsInstrumentation
;
21 class CC_EXPORT CompositorTimingHistory
{
30 CompositorTimingHistory(
31 UMACategory uma_category
,
32 RenderingStatsInstrumentation
* rendering_stats_instrumentation
);
33 virtual ~CompositorTimingHistory();
35 void AsValueInto(base::trace_event::TracedValue
* state
) const;
37 virtual base::TimeDelta
BeginMainFrameToCommitDurationEstimate() const;
38 virtual base::TimeDelta
CommitToReadyToActivateDurationEstimate() const;
39 virtual base::TimeDelta
PrepareTilesDurationEstimate() const;
40 virtual base::TimeDelta
ActivateDurationEstimate() const;
41 virtual base::TimeDelta
DrawDurationEstimate() const;
43 void SetRecordingEnabled(bool enabled
);
45 void WillBeginMainFrame();
46 void BeginMainFrameAborted();
48 void WillPrepareTiles();
49 void DidPrepareTiles();
50 void ReadyToActivate();
57 static scoped_ptr
<UMAReporter
> CreateUMAReporter(UMACategory category
);
58 virtual base::TimeTicks
Now() const;
60 bool AffectsEstimate() const;
63 int draws_left_before_estimates_affected_
;
65 RollingTimeDeltaHistory begin_main_frame_to_commit_duration_history_
;
66 RollingTimeDeltaHistory commit_to_ready_to_activate_duration_history_
;
67 RollingTimeDeltaHistory prepare_tiles_duration_history_
;
68 RollingTimeDeltaHistory activate_duration_history_
;
69 RollingTimeDeltaHistory draw_duration_history_
;
71 base::TimeTicks begin_main_frame_sent_time_
;
72 base::TimeTicks commit_time_
;
73 base::TimeTicks start_prepare_tiles_time_
;
74 base::TimeTicks start_activate_time_
;
75 base::TimeTicks start_draw_time_
;
77 scoped_ptr
<UMAReporter
> uma_reporter_
;
78 RenderingStatsInstrumentation
* rendering_stats_instrumentation_
;
81 DISALLOW_COPY_AND_ASSIGN(CompositorTimingHistory
);
86 #endif // CC_SCHEDULER_COMPOSITOR_TIMING_HISTORY_H_