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

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 new RingBuffer 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..6c5829bd83ed85899c5327934d229c33bb0b902d
--- /dev/null
+++ b/cc/paint_time_counter.h
@@ -0,0 +1,39 @@
+// 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 "cc/ring_buffer.h"
+
+namespace cc {
+
+// Maintains a history of paint times for each frame in milliseconds
+class PaintTimeCounter {
+ public:
+ static scoped_ptr<PaintTimeCounter> create();
+
+ size_t HistorySize() const { return ring_buffer_.BufferSize(); }
reveman 2013/01/11 16:10:49 nit: fix indent
+
+ // n = 0 returns the oldest and
+ // n = PaintTimeHistorySize() - 1 the most recent paint time.
+ double GetPaintTimeOfRecentFrame(int n) const;
reveman 2013/01/11 16:10:49 also here
+
+ void SavePaintTime(double total_paint_time);
+ void GetMinAndMaxPaintTime(double& min, double& max) const;
+
+ private:
+ PaintTimeCounter();
reveman 2013/01/11 16:10:49 and here
+
+ RingBuffer<double, 80> ring_buffer_;
reveman 2013/01/11 16:10:49 here
+ double last_paint_time_;
+
+ DISALLOW_COPY_AND_ASSIGN(PaintTimeCounter);
+};
+
+} // namespace cc
+
+#endif // CC_PAINT_TIME_COUNTER_H_
« no previous file with comments | « cc/layer_tree_host_impl.cc ('k') | cc/paint_time_counter.cc » ('j') | cc/paint_time_counter.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698