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

Side by Side Diff: cc/debug/performance_draw_timing_counter.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: git pull of third_party/WebKit Created 6 years, 5 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
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_PERFORMANCE_DRAW_TIMING_COUNTER_H_
6 #define CC_DEBUG_PERFORMANCE_DRAW_TIMING_COUNTER_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 provides functionality to
22 // intelligently compute average frames per second.
enne (OOO) 2014/07/22 20:44:25 Where does it compute average fps?
Mike B 2014/07/25 23:09:40 It does not. That comment was copied over when I c
23 class PerformanceDrawTimingCounter {
enne (OOO) 2014/07/22 20:44:25 bikeshedding: The word "performance" here is a lit
Mike B 2014/07/25 23:09:40 Done.
24 public:
25 struct DrawEvent {
26 int frame_id_;
27 int64_t rect_id_;
28 base::TimeTicks timestamp_;
29 DrawEvent(int frame_id, int64_t rect_id, base::TimeTicks timestamp) :
30 frame_id_(frame_id), rect_id_(rect_id), timestamp_(timestamp) {}
31 DrawEvent() {}
32 DrawEvent(const DrawEvent& rhs) :
33 frame_id_(rhs.frame_id_),
34 rect_id_(rhs.rect_id_),
35 timestamp_(rhs.timestamp_)
36 {}
37 DrawEvent& operator=(const DrawEvent& rhs) {
38 frame_id_ = rhs.frame_id_;
39 rect_id_ = rhs.rect_id_;
40 timestamp_ = rhs.timestamp_;
41 return *this;
42 }
43 };
44
45 static scoped_ptr<PerformanceDrawTimingCounter> Create();
46
47 scoped_ptr<DrawTimingSet> getDrawTimingCounts();
enne (OOO) 2014/07/22 20:44:25 style nit: get_draw_timing_counts Also, "get" is
Mike B 2014/07/25 23:09:40 I think you're right and "get" is probably not app
48
49 void clearEvents() { ring_buffer_.Clear(); }
enne (OOO) 2014/07/22 20:44:25 style nit: clear_events
Mike B 2014/07/25 23:09:40 Done.
50
51 int current_frame_number() const { return ring_buffer_.CurrentIndex(); }
52 size_t time_stamp_history_size() const { return ring_buffer_.BufferSize(); }
53
54 void SaveTimeStamp(int frame_id, int64_t rect_id, base::TimeTicks timestamp);
enne (OOO) 2014/07/22 20:44:25 Is this function used?
Mike B 2014/07/25 23:09:40 Nope. Removed. On 2014/07/22 20:44:25, enne wrote:
55
56 void SaveTimeStamps(base::TimeTicks timestamp,
57 const std::vector<std::pair<int, int64_t> > &frame_ids);
enne (OOO) 2014/07/22 20:44:25 Did git cl upload complain at you about needing to
Mike B 2014/07/25 23:09:40 git cl upload complained about a fair number of st
58
59 typedef RingBuffer<struct DrawEvent, 4096> RingBufferType;
enne (OOO) 2014/07/22 20:44:25 What happens when this overflows?
Mike B 2014/07/25 23:09:40 New stuff fails to get appended and drops. On 2014
60 RingBufferType::Iterator begin() const { return ring_buffer_.Begin(); }
61 RingBufferType::Iterator end() const { return ring_buffer_.End(); }
62
63 private:
64 explicit PerformanceDrawTimingCounter();
enne (OOO) 2014/07/22 20:44:25 style nit: explicit only on single-arg constructor
Mike B 2014/07/25 23:09:40 Done.
65
66 RingBufferType ring_buffer_;
67
68 DISALLOW_COPY_AND_ASSIGN(PerformanceDrawTimingCounter);
69 };
70
71 } // namespace cc
72
73 #endif // CC_DEBUG_PERFORMANCE_DRAW_TIMING_COUNTER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698