OLD | NEW |
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 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 UI_GL_GPU_TIMING_H_ | 5 #ifndef UI_GL_GPU_TIMING_H_ |
6 #define UI_GL_GPU_TIMING_H_ | 6 #define UI_GL_GPU_TIMING_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "ui/gl/gl_export.h" | 10 #include "ui/gl/gl_export.h" |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 | 123 |
124 // CheckAndResetTimerErrors has to be called before reading timestamps | 124 // CheckAndResetTimerErrors has to be called before reading timestamps |
125 // from GPUTimers instances and after making sure all the timers | 125 // from GPUTimers instances and after making sure all the timers |
126 // were available. | 126 // were available. |
127 // If the returned value is false, all the previous timers should be | 127 // If the returned value is false, all the previous timers should be |
128 // discarded. | 128 // discarded. |
129 bool CheckAndResetTimerErrors(); | 129 bool CheckAndResetTimerErrors(); |
130 void InvalidateTimerOffset(); | 130 void InvalidateTimerOffset(); |
131 | 131 |
132 void SetCpuTimeForTesting(const base::Callback<int64(void)>& cpu_time); | 132 void SetCpuTimeForTesting(const base::Callback<int64(void)>& cpu_time); |
| 133 int64 GetCurrentCPUTime(); |
133 | 134 |
134 private: | 135 private: |
135 friend class base::RefCounted<GPUTimingClient>; | 136 friend class base::RefCounted<GPUTimingClient>; |
136 friend class GPUTimer; | 137 friend class GPUTimer; |
137 friend class GPUTiming; | 138 friend class GPUTiming; |
138 | 139 |
139 virtual ~GPUTimingClient(); | 140 virtual ~GPUTimingClient(); |
140 | 141 |
141 // Returns the offset between the current gpu time and the cpu time. | 142 // Returns the offset between the current gpu time and the cpu time. |
142 int64 CalculateTimerOffset(); | 143 int64 CalculateTimerOffset(); |
143 | 144 |
144 GPUTiming* gpu_timing_; | 145 GPUTiming* gpu_timing_; |
145 GPUTiming::TimerType timer_type_ = GPUTiming::kTimerTypeInvalid; | 146 GPUTiming::TimerType timer_type_ = GPUTiming::kTimerTypeInvalid; |
146 uint32_t disjoint_counter_ = 0; | 147 uint32_t disjoint_counter_ = 0; |
147 base::Callback<int64(void)> cpu_time_for_testing_; | 148 base::Callback<int64(void)> cpu_time_for_testing_; |
148 | 149 |
149 DISALLOW_COPY_AND_ASSIGN(GPUTimingClient); | 150 DISALLOW_COPY_AND_ASSIGN(GPUTimingClient); |
150 }; | 151 }; |
151 | 152 |
152 } // namespace gfx | 153 } // namespace gfx |
153 | 154 |
154 #endif // UI_GL_GPU_TIMING_H_ | 155 #endif // UI_GL_GPU_TIMING_H_ |
OLD | NEW |