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

Unified Diff: cc/debug/smoothness_timing_tracker.h

Issue 397443002: [not for review] Add Draw entries to window Performance Timeline Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use damage rect not viewport rect Created 6 years, 3 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/cc.gyp ('k') | cc/debug/smoothness_timing_tracker.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/debug/smoothness_timing_tracker.h
diff --git a/cc/debug/smoothness_timing_tracker.h b/cc/debug/smoothness_timing_tracker.h
new file mode 100644
index 0000000000000000000000000000000000000000..3114a19cf754bdb8aea61e079217cac77ae63ae2
--- /dev/null
+++ b/cc/debug/smoothness_timing_tracker.h
@@ -0,0 +1,74 @@
+// Copyright 2014 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_DEBUG_SMOOTHNESS_TIMING_TRACKER_H_
+#define CC_DEBUG_SMOOTHNESS_TIMING_TRACKER_H_
+
+#include <set>
+#include <utility>
+#include <vector>
+
+#include "base/basictypes.h"
+#include "base/containers/hash_tables.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/time/time.h"
+#include "cc/debug/ring_buffer.h"
+#include "cc/trees/layer_tree_host_common.h"
+
+namespace cc {
+
+// This class maintains a history of timestamps and rect IDs to communicate
+// smoothness events back to Blink
+class SmoothnessTimingTracker {
+ public:
+ struct SmoothnessTimingCompositeEvent {
+ int frame_id_;
+ int64_t rect_id_;
+ base::TimeTicks timestamp_;
+ SmoothnessTimingCompositeEvent(int frame_id,
+ int64_t rect_id,
+ base::TimeTicks timestamp)
+ : frame_id_(frame_id), rect_id_(rect_id), timestamp_(timestamp) {}
+ SmoothnessTimingCompositeEvent() {}
+ SmoothnessTimingCompositeEvent(const SmoothnessTimingCompositeEvent& rhs)
+ : frame_id_(rhs.frame_id_),
+ rect_id_(rhs.rect_id_),
+ timestamp_(rhs.timestamp_) {}
+ SmoothnessTimingCompositeEvent& operator=(
+ const SmoothnessTimingCompositeEvent& rhs) {
+ frame_id_ = rhs.frame_id_;
+ rect_id_ = rhs.rect_id_;
+ timestamp_ = rhs.timestamp_;
+ return *this;
+ }
+ };
+
+ static scoped_ptr<SmoothnessTimingTracker> Create();
+
+ scoped_ptr<CompositeTimingSet> CalculateCompositeCounts();
+
+ void clear_events() { ring_buffer_.Clear(); }
+
+ int current_frame_number() const { return ring_buffer_.CurrentIndex(); }
+ size_t time_stamp_history_size() const { return ring_buffer_.BufferSize(); }
+
+ void SaveTimeStamps(base::TimeTicks timestamp,
+ const std::vector<std::pair<int, int64_t> >& frame_ids);
+
+ typedef RingBuffer<struct SmoothnessTimingCompositeEvent, 4096>
+ RingBufferType;
+ RingBufferType::Iterator begin() const { return ring_buffer_.Begin(); }
+ RingBufferType::Iterator end() const { return ring_buffer_.End(); }
+
+ private:
+ SmoothnessTimingTracker();
+
+ RingBufferType ring_buffer_;
+
+ DISALLOW_COPY_AND_ASSIGN(SmoothnessTimingTracker);
+};
+
+} // namespace cc
+
+#endif // CC_DEBUG_SMOOTHNESS_TIMING_TRACKER_H_
« no previous file with comments | « cc/cc.gyp ('k') | cc/debug/smoothness_timing_tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698