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

Unified 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: Save paint and rasterize time in per frame struct 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 side-by-side diff with in-line comments
Download patch
Index: cc/paint_time_counter.cc
diff --git a/cc/paint_time_counter.cc b/cc/paint_time_counter.cc
index 25b1bc677e9a7829cdf844a75d5c17588deeb5d4..dea0879e2656ca5b601a07ef42278cdcf97d5bbd 100644
--- a/cc/paint_time_counter.cc
+++ b/cc/paint_time_counter.cc
@@ -11,7 +11,9 @@ scoped_ptr<PaintTimeCounter> PaintTimeCounter::create() {
return make_scoped_ptr(new PaintTimeCounter());
}
-PaintTimeCounter::PaintTimeCounter() {
+PaintTimeCounter::PaintTimeCounter()
+ : ignore_next_paint_time_(true),
+ ignore_next_rasterize_time_(true) {
}
base::TimeDelta PaintTimeCounter::GetPaintTimeOfRecentFrame(
@@ -19,18 +21,30 @@ base::TimeDelta PaintTimeCounter::GetPaintTimeOfRecentFrame(
DCHECK(n < ring_buffer_.BufferSize());
if (ring_buffer_.IsFilledIndex(n))
- return ring_buffer_.ReadBuffer(n);
+ return ring_buffer_.ReadBuffer(n).time();
return base::TimeDelta();
}
-void PaintTimeCounter::SavePaintTime(const base::TimeDelta& total_paint_time) {
- base::TimeDelta paint_time = total_paint_time - last_total_paint_time_;
-
- if (paint_time.InMillisecondsF() > 0)
- ring_buffer_.SaveToBuffer(paint_time);
+void PaintTimeCounter::SavePaintTime(const base::TimeDelta& total_paint_time,
+ const int& frame_number) {
+ if (!ignore_next_paint_time_)
+ GetEntryForFrame(frame_number).paint_time =
+ total_paint_time - last_total_paint_time_;
last_total_paint_time_ = total_paint_time;
+ ignore_next_paint_time_ = false;
+}
+
+void PaintTimeCounter::SaveRasterizeTime(
+ const base::TimeDelta& total_rasterize_time,
+ const int& frame_number) {
+ if (!ignore_next_rasterize_time_)
nduca 2013/02/13 08:12:21 since this is just for the first entry in the ring
+ GetEntryForFrame(frame_number).rasterize_time =
nduca 2013/02/13 08:12:21 Oh, i just realized.... So! The sequence in wallt
+ total_rasterize_time - last_total_rasterize_time_;
+
+ last_total_rasterize_time_ = total_rasterize_time;
+ ignore_next_rasterize_time_ = false;
}
void PaintTimeCounter::GetMinAndMaxPaintTime(base::TimeDelta* min,
@@ -40,7 +54,7 @@ void PaintTimeCounter::GetMinAndMaxPaintTime(base::TimeDelta* min,
for (size_t i = 0; i < ring_buffer_.BufferSize(); i++) {
if (ring_buffer_.IsFilledIndex(i)) {
- base::TimeDelta paint_time = ring_buffer_.ReadBuffer(i);
+ base::TimeDelta paint_time = ring_buffer_.ReadBuffer(i).time();
if (paint_time < *min)
*min = paint_time;
@@ -53,4 +67,24 @@ void PaintTimeCounter::GetMinAndMaxPaintTime(base::TimeDelta* min,
*min = *max;
}
+void PaintTimeCounter::ClearHistory() {
+ ring_buffer_.Clear();
+ ignore_next_paint_time_ = true;
+ ignore_next_rasterize_time_ = true;
+}
+
+PaintTimeCounter::Entry& PaintTimeCounter::GetEntryForFrame(
nduca 2013/02/13 08:12:21 GetOrCreateEntryForFrame since it adds it if it do
+ const int& frame_number) {
+ for (size_t i = 0; i < ring_buffer_.BufferSize(); i++) {
+ if (ring_buffer_.IsFilledIndex(i) &&
egraether 2013/02/12 00:15:30 Buffer iteration is a mess. I will try to implemen
+ ring_buffer_.ReadBuffer(i).frame_number == frame_number)
+ return ring_buffer_.MutableReadBuffer(i);
+ }
+
+ Entry entry;
+ entry.frame_number = frame_number;
+ ring_buffer_.SaveToBuffer(entry);
+ return ring_buffer_.MutableReadBuffer(ring_buffer_.BufferSize() - 1);
+}
+
} // namespace cc
« 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