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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « cc/cc.gyp ('k') | cc/debug/smoothness_timing_tracker.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CC_DEBUG_SMOOTHNESS_TIMING_TRACKER_H_
6 #define CC_DEBUG_SMOOTHNESS_TIMING_TRACKER_H_
7
8 #include <set>
9 #include <utility>
10 #include <vector>
11
12 #include "base/basictypes.h"
13 #include "base/containers/hash_tables.h"
14 #include "base/memory/scoped_ptr.h"
15 #include "base/time/time.h"
16 #include "cc/debug/ring_buffer.h"
17 #include "cc/trees/layer_tree_host_common.h"
18
19 namespace cc {
20
21 // This class maintains a history of timestamps and rect IDs to communicate
22 // smoothness events back to Blink
23 class SmoothnessTimingTracker {
24 public:
25 struct SmoothnessTimingCompositeEvent {
26 int frame_id_;
27 int64_t rect_id_;
28 base::TimeTicks timestamp_;
29 SmoothnessTimingCompositeEvent(int frame_id,
30 int64_t rect_id,
31 base::TimeTicks timestamp)
32 : frame_id_(frame_id), rect_id_(rect_id), timestamp_(timestamp) {}
33 SmoothnessTimingCompositeEvent() {}
34 SmoothnessTimingCompositeEvent(const SmoothnessTimingCompositeEvent& rhs)
35 : frame_id_(rhs.frame_id_),
36 rect_id_(rhs.rect_id_),
37 timestamp_(rhs.timestamp_) {}
38 SmoothnessTimingCompositeEvent& operator=(
39 const SmoothnessTimingCompositeEvent& rhs) {
40 frame_id_ = rhs.frame_id_;
41 rect_id_ = rhs.rect_id_;
42 timestamp_ = rhs.timestamp_;
43 return *this;
44 }
45 };
46
47 static scoped_ptr<SmoothnessTimingTracker> Create();
48
49 scoped_ptr<CompositeTimingSet> CalculateCompositeCounts();
50
51 void clear_events() { ring_buffer_.Clear(); }
52
53 int current_frame_number() const { return ring_buffer_.CurrentIndex(); }
54 size_t time_stamp_history_size() const { return ring_buffer_.BufferSize(); }
55
56 void SaveTimeStamps(base::TimeTicks timestamp,
57 const std::vector<std::pair<int, int64_t> >& frame_ids);
58
59 typedef RingBuffer<struct SmoothnessTimingCompositeEvent, 4096>
60 RingBufferType;
61 RingBufferType::Iterator begin() const { return ring_buffer_.Begin(); }
62 RingBufferType::Iterator end() const { return ring_buffer_.End(); }
63
64 private:
65 SmoothnessTimingTracker();
66
67 RingBufferType ring_buffer_;
68
69 DISALLOW_COPY_AND_ASSIGN(SmoothnessTimingTracker);
70 };
71
72 } // namespace cc
73
74 #endif // CC_DEBUG_SMOOTHNESS_TIMING_TRACKER_H_
OLDNEW
« 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