Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CC_PAINT_TIME_COUNTER_H_ | |
| 6 #define CC_PAINT_TIME_COUNTER_H_ | |
| 7 | |
| 8 #include "base/basictypes.h" | |
| 9 #include "base/memory/scoped_ptr.h" | |
| 10 #include "base/time.h" | |
| 11 #include "cc/ring_buffer.h" | |
| 12 | |
| 13 namespace cc { | |
| 14 | |
| 15 // Maintains a history of paint times for each frame | |
| 16 class PaintTimeCounter { | |
| 17 public: | |
| 18 static scoped_ptr<PaintTimeCounter> create(); | |
| 19 | |
| 20 size_t HistorySize() const { return ring_buffer_.BufferSize(); } | |
|
egraether
2013/01/16 19:31:56
We decided to use size_t for the buffer size in th
| |
| 21 | |
| 22 // n = 0 returns the oldest and | |
| 23 // n = PaintTimeHistorySize() - 1 the most recent paint time. | |
| 24 base::TimeDelta GetPaintTimeOfRecentFrame(const size_t& n) const; | |
|
egraether
2013/01/16 19:31:56
Returns TimeDelta now.
| |
| 25 | |
| 26 void SavePaintTime(const base::TimeDelta& total_paint_time); | |
|
egraether
2013/01/16 19:31:56
New paint times are saved as TimeDelta.
| |
| 27 void GetMinAndMaxPaintTimeInMilliseconds(double* min, double* max) const; | |
|
egraether
2013/01/16 19:31:56
Changed the name to indicate the measurement unit.
reveman
2013/01/16 19:56:04
why isn't this using TimeDelta for min/max?
egraether
2013/01/16 22:14:13
Mostly because milliseconds with type double is th
reveman
2013/01/16 22:48:04
I'd prefer if you used TimeDelta consistently thro
| |
| 28 | |
| 29 private: | |
| 30 PaintTimeCounter(); | |
| 31 | |
| 32 RingBuffer<base::TimeDelta, 80> ring_buffer_; | |
|
egraether
2013/01/16 19:31:56
Changed type to TimeDelta.
| |
| 33 base::TimeDelta last_total_paint_time_; | |
| 34 | |
| 35 DISALLOW_COPY_AND_ASSIGN(PaintTimeCounter); | |
| 36 }; | |
| 37 | |
| 38 } // namespace cc | |
| 39 | |
| 40 #endif // CC_PAINT_TIME_COUNTER_H_ | |
| OLD | NEW |