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

Side by Side Diff: cc/paint_time_counter.cc

Issue 12209022: cc: add rasterize time to continuous painting graph data in impl-side-painting (Closed) Base URL: http://git.chromium.org/chromium/src.git@raster
Patch Set: assume that rasterize time is saved after paint time Created 7 years, 10 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
1 // Copyright 2012 The Chromium Authors. All rights reserved. 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 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 #include "cc/paint_time_counter.h" 5 #include "cc/paint_time_counter.h"
6 6
7 namespace cc { 7 namespace cc {
8 8
9 // static 9 // static
10 scoped_ptr<PaintTimeCounter> PaintTimeCounter::create() { 10 scoped_ptr<PaintTimeCounter> PaintTimeCounter::create() {
11 return make_scoped_ptr(new PaintTimeCounter()); 11 return make_scoped_ptr(new PaintTimeCounter());
12 } 12 }
13 13
14 PaintTimeCounter::PaintTimeCounter() { 14 PaintTimeCounter::PaintTimeCounter()
15 : can_save_paint_time_delta(false),
16 can_save_rasterize_time_delta(false) {
15 } 17 }
16 18
17 base::TimeDelta PaintTimeCounter::GetPaintTimeOfRecentFrame( 19 base::TimeDelta PaintTimeCounter::GetPaintTimeOfRecentFrame(
18 const size_t& n) const { 20 const size_t& n) const {
19 DCHECK(n < ring_buffer_.BufferSize()); 21 DCHECK(n < ring_buffer_.BufferSize());
20 22
21 if (ring_buffer_.IsFilledIndex(n)) 23 if (ring_buffer_.IsFilledIndex(n))
22 return ring_buffer_.ReadBuffer(n); 24 return ring_buffer_.ReadBuffer(n).time();
23 25
24 return base::TimeDelta(); 26 return base::TimeDelta();
25 } 27 }
26 28
27 void PaintTimeCounter::SavePaintTime(const base::TimeDelta& total_paint_time) { 29 void PaintTimeCounter::SavePaintTime(const base::TimeDelta& total_paint_time,
28 base::TimeDelta paint_time = total_paint_time - last_total_paint_time_; 30 const int& commit_number) {
29 31 if (can_save_paint_time_delta) {
egraether 2013/02/13 20:28:07 These checks that no entry gets saved, when it's n
30 if (paint_time.InMillisecondsF() > 0) 32 Entry entry;
31 ring_buffer_.SaveToBuffer(paint_time); 33 entry.commit_number = commit_number;
34 entry.paint_time = total_paint_time - last_total_paint_time_;
35 ring_buffer_.SaveToBuffer(entry);
36 }
32 37
33 last_total_paint_time_ = total_paint_time; 38 last_total_paint_time_ = total_paint_time;
39 can_save_paint_time_delta = true;
40 }
41
42 void PaintTimeCounter::SaveRasterizeTime(
43 const base::TimeDelta& total_rasterize_time,
44 const int& commit_number) {
45 if (can_save_rasterize_time_delta) {
46 Entry entry = ring_buffer_.MutableReadBuffer(ring_buffer_.BufferSize() - 1);
47 DCHECK(commit_number == entry.commit_number);
egraether 2013/02/13 20:28:07 This checks whether the assumption that rasterize
48 entry.rasterize_time = total_rasterize_time - last_total_rasterize_time_;
49 }
50
51 last_total_rasterize_time_ = total_rasterize_time;
52 can_save_rasterize_time_delta = true;
34 } 53 }
35 54
36 void PaintTimeCounter::GetMinAndMaxPaintTime(base::TimeDelta* min, 55 void PaintTimeCounter::GetMinAndMaxPaintTime(base::TimeDelta* min,
37 base::TimeDelta* max) const { 56 base::TimeDelta* max) const {
38 *min = base::TimeDelta::FromDays(1); 57 *min = base::TimeDelta::FromDays(1);
39 *max = base::TimeDelta(); 58 *max = base::TimeDelta();
40 59
41 for (size_t i = 0; i < ring_buffer_.BufferSize(); i++) { 60 for (size_t i = 0; i < ring_buffer_.BufferSize(); i++) {
42 if (ring_buffer_.IsFilledIndex(i)) { 61 if (ring_buffer_.IsFilledIndex(i)) {
43 base::TimeDelta paint_time = ring_buffer_.ReadBuffer(i); 62 base::TimeDelta paint_time = ring_buffer_.ReadBuffer(i).time();
44 63
45 if (paint_time < *min) 64 if (paint_time < *min)
46 *min = paint_time; 65 *min = paint_time;
47 if (paint_time > *max) 66 if (paint_time > *max)
48 *max = paint_time; 67 *max = paint_time;
49 } 68 }
50 } 69 }
51 70
52 if (*min > *max) 71 if (*min > *max)
53 *min = *max; 72 *min = *max;
54 } 73 }
55 74
75 void PaintTimeCounter::ClearHistory() {
76 ring_buffer_.Clear();
77 can_save_paint_time_delta = false;
78 can_save_rasterize_time_delta = false;
79 }
80
56 } // namespace cc 81 } // namespace cc
OLDNEW
« cc/layer_tree_host_impl.cc ('K') | « cc/paint_time_counter.h ('k') | cc/rendering_stats.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698