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