1 // Copyright 2012 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_DEBUG_RENDERING_STATS_H_
6 #define CC_DEBUG_RENDERING_STATS_H_
10 #include "base/basictypes.h"
11 #include "base/debug/trace_event_argument.h"
12 #include "base/time/time.h"
13 #include "base/values.h"
14 #include "cc/base/cc_export.h"
15 #include "cc/debug/traced_value.h"
19 struct CC_EXPORT RenderingStats {
20 // Stores a sequence of TimeDelta objects.
21 class CC_EXPORT TimeDeltaList {
26 void Append(base::TimeDelta value);
27 void AddToTracedValue(base::debug::TracedValue* list_value) const;
29 void Add(const TimeDeltaList& other);
31 base::TimeDelta GetLastTimeDelta() const;
34 std::list<base::TimeDelta> values;
37 struct CC_EXPORT MainThreadRenderingStats {
38 // Note: when adding new members, please remember to update Add in
39 // rendering_stats.cc.
41 base::TimeDelta paint_time;
42 int64 painted_pixel_count;
43 base::TimeDelta record_time;
44 int64 recorded_pixel_count;
46 MainThreadRenderingStats();
47 ~MainThreadRenderingStats();
48 scoped_refptr<base::debug::ConvertableToTraceFormat> AsTraceableData()
50 void Add(const MainThreadRenderingStats& other);
53 struct CC_EXPORT ImplThreadRenderingStats {
54 // Note: when adding new members, please remember to update Add in
55 // rendering_stats.cc.
58 int64 visible_content_area;
59 int64 approximated_visible_content_area;
61 TimeDeltaList draw_duration;
62 TimeDeltaList draw_duration_estimate;
63 TimeDeltaList begin_main_frame_to_commit_duration;
64 TimeDeltaList begin_main_frame_to_commit_duration_estimate;
65 TimeDeltaList commit_to_activate_duration;
66 TimeDeltaList commit_to_activate_duration_estimate;
68 ImplThreadRenderingStats();
69 ~ImplThreadRenderingStats();
70 scoped_refptr<base::debug::ConvertableToTraceFormat> AsTraceableData()
72 void Add(const ImplThreadRenderingStats& other);
75 MainThreadRenderingStats main_stats;
76 ImplThreadRenderingStats impl_stats;
78 // Add fields of |other| to the fields in this structure.
79 void Add(const RenderingStats& other);
84 #endif // CC_DEBUG_RENDERING_STATS_H_