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

Side by Side Diff: cc/paint_time_counter.h

Issue 12209022: cc: add rasterize time to continuous painting graph data in impl-side-painting (Closed) Base URL: http://git.chromium.org/chromium/src.git@raster
Patch Set: Save paint and rasterize time in per frame struct Created 7 years, 10 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
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CC_PAINT_TIME_COUNTER_H_ 5 #ifndef CC_PAINT_TIME_COUNTER_H_
6 #define CC_PAINT_TIME_COUNTER_H_ 6 #define CC_PAINT_TIME_COUNTER_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/time.h" 10 #include "base/time.h"
11 #include "cc/ring_buffer.h" 11 #include "cc/ring_buffer.h"
12 12
13 namespace cc { 13 namespace cc {
14 14
15 // Maintains a history of paint times for each frame 15 // Maintains a history of paint times for each frame
16 class PaintTimeCounter { 16 class PaintTimeCounter {
17 public: 17 public:
18 static scoped_ptr<PaintTimeCounter> create(); 18 static scoped_ptr<PaintTimeCounter> create();
19 19
20 size_t HistorySize() const { return ring_buffer_.BufferSize(); } 20 size_t HistorySize() const { return ring_buffer_.BufferSize(); }
21 21
22 struct Entry {
23 Entry()
24 : frame_number(0) { }
25
26 int frame_number;
27 base::TimeDelta paint_time;
28 base::TimeDelta rasterize_time;
29
30 base::TimeDelta time() const {
31 return paint_time + rasterize_time;
32 }
33 };
34
22 // n = 0 returns the oldest and 35 // n = 0 returns the oldest and
23 // n = PaintTimeHistorySize() - 1 the most recent paint time. 36 // n = PaintTimeHistorySize() - 1 the most recent paint time.
24 base::TimeDelta GetPaintTimeOfRecentFrame(const size_t& n) const; 37 base::TimeDelta GetPaintTimeOfRecentFrame(const size_t& n) const;
25 38
26 void SavePaintTime(const base::TimeDelta& total_paint_time); 39 void SavePaintTime(const base::TimeDelta& total_paint_time,
40 const int& frame_number);
41 void SaveRasterizeTime(const base::TimeDelta& total_rasterize_time,
42 const int& frame_number);
27 void GetMinAndMaxPaintTime(base::TimeDelta* min, base::TimeDelta* max) const; 43 void GetMinAndMaxPaintTime(base::TimeDelta* min, base::TimeDelta* max) const;
28 44
45 void ClearHistory();
46
29 private: 47 private:
30 PaintTimeCounter(); 48 PaintTimeCounter();
31 49
32 RingBuffer<base::TimeDelta, 90> ring_buffer_; 50 Entry& GetEntryForFrame(const int& frame_number);
51
52 RingBuffer<Entry, 90> ring_buffer_;
53
33 base::TimeDelta last_total_paint_time_; 54 base::TimeDelta last_total_paint_time_;
55 base::TimeDelta last_total_rasterize_time_;
56
57 bool ignore_next_paint_time_;
58 bool ignore_next_rasterize_time_;
34 59
35 DISALLOW_COPY_AND_ASSIGN(PaintTimeCounter); 60 DISALLOW_COPY_AND_ASSIGN(PaintTimeCounter);
36 }; 61 };
37 62
38 } // namespace cc 63 } // namespace cc
39 64
40 #endif // CC_PAINT_TIME_COUNTER_H_ 65 #endif // CC_PAINT_TIME_COUNTER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698