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

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: Fixed style 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
« no previous file with comments | « cc/paint_time_counter.h ('k') | cc/rendering_stats.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/paint_time_counter.cc
diff --git a/cc/paint_time_counter.cc b/cc/paint_time_counter.cc
index 25b1bc677e9a7829cdf844a75d5c17588deeb5d4..7749cf71f4af1e71ba58faad4bee093b64e9bf5f 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()
+ : can_save_paint_time_delta_(false),
+ can_save_rasterize_time_delta_(false) {
}
base::TimeDelta PaintTimeCounter::GetPaintTimeOfRecentFrame(
@@ -19,18 +21,35 @@ base::TimeDelta PaintTimeCounter::GetPaintTimeOfRecentFrame(
DCHECK(n < ring_buffer_.BufferSize());
if (ring_buffer_.IsFilledIndex(n))
- return ring_buffer_.ReadBuffer(n);
+ return ring_buffer_.ReadBuffer(n).total_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,
+ int commit_number) {
+ if (can_save_paint_time_delta_) {
+ Entry entry;
+ entry.commit_number = commit_number;
+ entry.paint_time = total_paint_time - last_total_paint_time_;
+ ring_buffer_.SaveToBuffer(entry);
+ }
last_total_paint_time_ = total_paint_time;
+ can_save_paint_time_delta_ = true;
+}
+
+void PaintTimeCounter::SaveRasterizeTime(
+ const base::TimeDelta& total_rasterize_time,
+ int commit_number) {
+ if (can_save_rasterize_time_delta_) {
+ Entry entry = ring_buffer_.MutableReadBuffer(ring_buffer_.BufferSize() - 1);
+ DCHECK(commit_number == entry.commit_number);
+ entry.rasterize_time = total_rasterize_time - last_total_rasterize_time_;
+ }
+
+ last_total_rasterize_time_ = total_rasterize_time;
+ can_save_rasterize_time_delta_ = true;
}
void PaintTimeCounter::GetMinAndMaxPaintTime(base::TimeDelta* min,
@@ -40,7 +59,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).total_time();
if (paint_time < *min)
*min = paint_time;
@@ -53,4 +72,10 @@ void PaintTimeCounter::GetMinAndMaxPaintTime(base::TimeDelta* min,
*min = *max;
}
+void PaintTimeCounter::ClearHistory() {
+ ring_buffer_.Clear();
+ can_save_paint_time_delta_ = false;
+ can_save_rasterize_time_delta_ = false;
+}
+
} // namespace cc
« no previous file with comments | « 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