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 GPU_COMMAND_BUFFER_SERVICE_GPU_TIMING_H_ | 5 #ifndef GPU_COMMAND_BUFFER_SERVICE_GPU_TIMING_H_ |
6 #define GPU_COMMAND_BUFFER_SERVICE_GPU_TIMING_H_ | 6 #define GPU_COMMAND_BUFFER_SERVICE_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 "gpu/gpu_export.h" | 10 #include "gpu/gpu_export.h" |
11 #include "ui/gl/gl_bindings.h" | 11 |
| 12 namespace gfx { |
| 13 class GLContext; |
| 14 } |
12 | 15 |
13 namespace gpu { | 16 namespace gpu { |
14 | |
15 class GPUTiming; | 17 class GPUTiming; |
16 | 18 |
17 // Class to compute the amount of time it takes to fully | 19 // Class to compute the amount of time it takes to fully |
18 // complete a set of GL commands | 20 // complete a set of GL commands |
19 class GPU_EXPORT GPUTimer { | 21 class GPU_EXPORT GPUTimer { |
20 public: | 22 public: |
21 // gpu_timing must outlive GPUTimer instance we're creating. | 23 // gpu_timing must outlive GPUTimer instance we're creating. |
22 explicit GPUTimer(GPUTiming* gpu_timing); | 24 explicit GPUTimer(GPUTiming* gpu_timing); |
23 ~GPUTimer(); | 25 ~GPUTimer(); |
24 | 26 |
25 void Start(); | 27 void Start(); |
26 void End(); | 28 void End(); |
27 bool IsAvailable(); | 29 bool IsAvailable(); |
28 | 30 |
29 void GetStartEndTimestamps(int64* start, int64* end); | 31 void GetStartEndTimestamps(int64* start, int64* end); |
30 int64 GetDeltaElapsed(); | 32 int64 GetDeltaElapsed(); |
31 | 33 |
32 private: | 34 private: |
33 GLuint queries_[2]; | 35 unsigned int queries_[2]; |
34 int64 offset_ = 0; | 36 int64 offset_ = 0; |
35 bool end_requested_ = false; | 37 bool end_requested_ = false; |
36 GPUTiming* gpu_timing_; | 38 GPUTiming* gpu_timing_; |
37 | 39 |
38 DISALLOW_COPY_AND_ASSIGN(GPUTimer); | 40 DISALLOW_COPY_AND_ASSIGN(GPUTimer); |
39 }; | 41 }; |
40 | 42 |
41 // GPUTiming contains all the gl timing logic that is not specific | 43 // GPUTiming contains all the gl timing logic that is not specific |
42 // to a single GPUTimer. | 44 // to a single GPUTimer. |
43 class GPU_EXPORT GPUTiming { | 45 class GPU_EXPORT GPUTiming { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 TimerType timer_type_ = kTimerTypeInvalid; | 78 TimerType timer_type_ = kTimerTypeInvalid; |
77 int64 offset_ = 0; // offset cache when timer_type_ == kTimerTypeARB | 79 int64 offset_ = 0; // offset cache when timer_type_ == kTimerTypeARB |
78 bool offset_valid_ = false; | 80 bool offset_valid_ = false; |
79 base::Callback<int64(void)> cpu_time_for_testing_; | 81 base::Callback<int64(void)> cpu_time_for_testing_; |
80 friend class GPUTimer; | 82 friend class GPUTimer; |
81 DISALLOW_COPY_AND_ASSIGN(GPUTiming); | 83 DISALLOW_COPY_AND_ASSIGN(GPUTiming); |
82 }; | 84 }; |
83 } // namespace gpu | 85 } // namespace gpu |
84 | 86 |
85 #endif // GPU_COMMAND_BUFFER_SERVICE_GPU_TIMING_H_ | 87 #endif // GPU_COMMAND_BUFFER_SERVICE_GPU_TIMING_H_ |
OLD | NEW |