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

Side by Side Diff: cc/debug/rendering_stats_instrumentation.cc

Issue 12519006: cc:: Add RenderingStatsInstrumentation to manage collection of RenderingStats (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Updated all tests Created 7 years, 9 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
OLDNEW
(Empty)
1 // Copyright 2013 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.
4
5 #include "cc/debug/rendering_stats_instrumentation.h"
6
7 namespace cc {
8
9 // static
10 scoped_ptr<RenderingStatsInstrumentation>
11 RenderingStatsInstrumentation::Create() {
12 return make_scoped_ptr(new RenderingStatsInstrumentation());
13 }
14
15 RenderingStatsInstrumentation::RenderingStatsInstrumentation()
16 : record_rendering_stats_(false) {
17 }
18
19 RenderingStatsInstrumentation::~RenderingStatsInstrumentation() {}
20
21 RenderingStats RenderingStatsInstrumentation::GetRenderingStats() {
22 base::AutoLock scoped_lock(lock_);
23 return rendering_stats_;
24 }
25
26 base::TimeTicks RenderingStatsInstrumentation::StartRecording() const {
27 if (record_rendering_stats_)
28 return base::TimeTicks::HighResNow();
29 return base::TimeTicks();
30 }
31
32 base::TimeDelta RenderingStatsInstrumentation::EndRecording(
33 base::TimeTicks start_time) const {
34 if (!start_time.is_null())
35 return base::TimeTicks::HighResNow() - start_time;
36 return base::TimeDelta();
37 }
38
39 void RenderingStatsInstrumentation::AddStats(const RenderingStats& other) {
40 if (!record_rendering_stats_)
41 return;
42
43 base::AutoLock scoped_lock(lock_);
44 rendering_stats_.Add(other);
45 }
46
47 void RenderingStatsInstrumentation::IncrementAnimationFrameCount() {
48 if (!record_rendering_stats_)
49 return;
50
51 base::AutoLock scoped_lock(lock_);
52 rendering_stats_.numAnimationFrames++;
53 }
54
55 void RenderingStatsInstrumentation::SetScreenFrameCount(int64 count) {
56 if (!record_rendering_stats_)
57 return;
58
59 base::AutoLock scoped_lock(lock_);
60 rendering_stats_.numFramesSentToScreen = count;
61 }
62
63 void RenderingStatsInstrumentation::SetDroppedFrameCount(int64 count) {
64 if (!record_rendering_stats_)
65 return;
66
67 base::AutoLock scoped_lock(lock_);
68 rendering_stats_.droppedFrameCount = count;
69 }
70
71 void RenderingStatsInstrumentation::AddCommit(base::TimeDelta duration) {
72 if (!record_rendering_stats_)
73 return;
74
75 base::AutoLock scoped_lock(lock_);
76 rendering_stats_.totalCommitTime += duration;
77 rendering_stats_.totalCommitCount++;
78 }
79
80 void RenderingStatsInstrumentation::AddPaint(base::TimeDelta duration,
81 int64 pixels) {
82 if (!record_rendering_stats_)
83 return;
84
85 base::AutoLock scoped_lock(lock_);
86 rendering_stats_.totalPaintTime += duration;
87 rendering_stats_.totalPixelsPainted += pixels;
88 }
89
90 void RenderingStatsInstrumentation::AddRaster(base::TimeDelta duration,
91 int64 pixels,
92 bool is_in_pending_tree_now_bin) {
93 if (!record_rendering_stats_)
94 return;
95
96 base::AutoLock scoped_lock(lock_);
97 rendering_stats_.totalRasterizeTime += duration;
98 rendering_stats_.totalPixelsRasterized += pixels;
99
100 if (is_in_pending_tree_now_bin)
101 rendering_stats_.totalRasterizeTimeForNowBinsOnPendingTree += duration;
102 }
103
104 void RenderingStatsInstrumentation::IncrementImplThreadScrolls() {
105 if (!record_rendering_stats_)
106 return;
107
108 base::AutoLock scoped_lock(lock_);
109 rendering_stats_.numImplThreadScrolls++;
110 }
111
112 void RenderingStatsInstrumentation::IncrementMainThreadScrolls() {
113 if (!record_rendering_stats_)
114 return;
115
116 base::AutoLock scoped_lock(lock_);
117 rendering_stats_.numMainThreadScrolls++;
118 }
119
120 void RenderingStatsInstrumentation::AddLayersDrawn(int64 amount) {
121 if (!record_rendering_stats_)
122 return;
123
124 base::AutoLock scoped_lock(lock_);
125 rendering_stats_.numLayersDrawn += amount;
126 }
127
128 void RenderingStatsInstrumentation::AddMissingTiles(int64 amount) {
129 if (!record_rendering_stats_)
130 return;
131
132 base::AutoLock scoped_lock(lock_);
133 rendering_stats_.numMissingTiles += amount;
134 }
135
136 void RenderingStatsInstrumentation::AddDeferredImageDecode(
137 base::TimeDelta duration) {
138 if (!record_rendering_stats_)
139 return;
140
141 base::AutoLock scoped_lock(lock_);
142 rendering_stats_.totalDeferredImageDecodeTime += duration;
143 rendering_stats_.totalDeferredImageDecodeCount++;
144 }
145
146 void RenderingStatsInstrumentation::AddImageGathering(
147 base::TimeDelta duration) {
148 if (!record_rendering_stats_)
149 return;
150
151 base::AutoLock scoped_lock(lock_);
152 rendering_stats_.totalImageGatheringTime += duration;
153 rendering_stats_.totalImageGatheringCount++;
154 }
155
156 void RenderingStatsInstrumentation::IncrementDeferredImageCacheHitCount() {
157 if (!record_rendering_stats_)
158 return;
159
160 base::AutoLock scoped_lock(lock_);
161 rendering_stats_.totalDeferredImageCacheHitCount++;
162 }
163
164 } // namespace cc
OLDNEW
« no previous file with comments | « cc/debug/rendering_stats_instrumentation.h ('k') | cc/layers/delegated_renderer_layer_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698