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

Unified Diff: cc/paint_time_counter.h

Issue 11827009: cc: add PaintTimeCounter to keep track of per frame paint time (Closed) Base URL: http://git.chromium.org/chromium/src.git@ring
Patch Set: updated to use base::TimeDelta Created 7 years, 11 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.h
diff --git a/cc/paint_time_counter.h b/cc/paint_time_counter.h
new file mode 100644
index 0000000000000000000000000000000000000000..a7698f35bc23cc68fcea68f7fd7424ab014c529d
--- /dev/null
+++ b/cc/paint_time_counter.h
@@ -0,0 +1,40 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CC_PAINT_TIME_COUNTER_H_
+#define CC_PAINT_TIME_COUNTER_H_
+
+#include "base/basictypes.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/time.h"
+#include "cc/ring_buffer.h"
+
+namespace cc {
+
+// Maintains a history of paint times for each frame
+class PaintTimeCounter {
+ public:
+ static scoped_ptr<PaintTimeCounter> create();
+
+ size_t HistorySize() const { return ring_buffer_.BufferSize(); }
egraether 2013/01/16 19:31:56 We decided to use size_t for the buffer size in th
+
+ // n = 0 returns the oldest and
+ // n = PaintTimeHistorySize() - 1 the most recent paint time.
+ base::TimeDelta GetPaintTimeOfRecentFrame(const size_t& n) const;
egraether 2013/01/16 19:31:56 Returns TimeDelta now.
+
+ void SavePaintTime(const base::TimeDelta& total_paint_time);
egraether 2013/01/16 19:31:56 New paint times are saved as TimeDelta.
+ void GetMinAndMaxPaintTimeInMilliseconds(double* min, double* max) const;
egraether 2013/01/16 19:31:56 Changed the name to indicate the measurement unit.
reveman 2013/01/16 19:56:04 why isn't this using TimeDelta for min/max?
egraether 2013/01/16 22:14:13 Mostly because milliseconds with type double is th
reveman 2013/01/16 22:48:04 I'd prefer if you used TimeDelta consistently thro
+
+ private:
+ PaintTimeCounter();
+
+ RingBuffer<base::TimeDelta, 80> ring_buffer_;
egraether 2013/01/16 19:31:56 Changed type to TimeDelta.
+ base::TimeDelta last_total_paint_time_;
+
+ DISALLOW_COPY_AND_ASSIGN(PaintTimeCounter);
+};
+
+} // namespace cc
+
+#endif // CC_PAINT_TIME_COUNTER_H_

Powered by Google App Engine
This is Rietveld 408576698