| 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 "ui/gl/gl_export.h" | 10 #include "ui/gl/gl_export.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 class GPUTiming { | 45 class GPUTiming { |
| 46 public: | 46 public: |
| 47 enum TimerType { | 47 enum TimerType { |
| 48 kTimerTypeInvalid = -1, | 48 kTimerTypeInvalid = -1, |
| 49 | 49 |
| 50 kTimerTypeARB, // ARB_timer_query | 50 kTimerTypeARB, // ARB_timer_query |
| 51 kTimerTypeDisjoint // EXT_disjoint_timer_query | 51 kTimerTypeDisjoint // EXT_disjoint_timer_query |
| 52 }; | 52 }; |
| 53 | 53 |
| 54 TimerType GetTimerType() const { return timer_type_; } | 54 TimerType GetTimerType() const { return timer_type_; } |
| 55 uint32_t GetDisjointCount(); |
| 55 | 56 |
| 56 private: | 57 private: |
| 57 friend struct base::DefaultDeleter<GPUTiming>; | 58 friend struct base::DefaultDeleter<GPUTiming>; |
| 58 friend class GLContextReal; | 59 friend class GLContextReal; |
| 59 explicit GPUTiming(GLContextReal* context); | 60 explicit GPUTiming(GLContextReal* context); |
| 60 ~GPUTiming(); | 61 ~GPUTiming(); |
| 61 | 62 |
| 62 scoped_refptr<GPUTimingClient> CreateGPUTimingClient(); | 63 scoped_refptr<GPUTimingClient> CreateGPUTimingClient(); |
| 63 | 64 |
| 64 TimerType timer_type_ = kTimerTypeInvalid; | 65 TimerType timer_type_ = kTimerTypeInvalid; |
| 66 uint32_t disjoint_counter_ = 0; |
| 65 DISALLOW_COPY_AND_ASSIGN(GPUTiming); | 67 DISALLOW_COPY_AND_ASSIGN(GPUTiming); |
| 66 }; | 68 }; |
| 67 | 69 |
| 68 // Class to compute the amount of time it takes to fully | 70 // Class to compute the amount of time it takes to fully |
| 69 // complete a set of GL commands | 71 // complete a set of GL commands |
| 70 class GL_EXPORT GPUTimer { | 72 class GL_EXPORT GPUTimer { |
| 71 public: | 73 public: |
| 72 ~GPUTimer(); | 74 ~GPUTimer(); |
| 73 | 75 |
| 74 void Start(); | 76 void Start(); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 private: | 120 private: |
| 119 friend class base::RefCounted<GPUTimingClient>; | 121 friend class base::RefCounted<GPUTimingClient>; |
| 120 friend class GPUTimer; | 122 friend class GPUTimer; |
| 121 friend class GPUTiming; | 123 friend class GPUTiming; |
| 122 | 124 |
| 123 virtual ~GPUTimingClient(); | 125 virtual ~GPUTimingClient(); |
| 124 | 126 |
| 125 GPUTiming* gpu_timing_; | 127 GPUTiming* gpu_timing_; |
| 126 GPUTiming::TimerType timer_type_ = GPUTiming::kTimerTypeInvalid; | 128 GPUTiming::TimerType timer_type_ = GPUTiming::kTimerTypeInvalid; |
| 127 int64 offset_ = 0; // offset cache when timer_type_ == kTimerTypeARB | 129 int64 offset_ = 0; // offset cache when timer_type_ == kTimerTypeARB |
| 130 uint32_t disjoint_counter_ = 0; |
| 128 bool offset_valid_ = false; | 131 bool offset_valid_ = false; |
| 129 base::Callback<int64(void)> cpu_time_for_testing_; | 132 base::Callback<int64(void)> cpu_time_for_testing_; |
| 130 | 133 |
| 131 DISALLOW_COPY_AND_ASSIGN(GPUTimingClient); | 134 DISALLOW_COPY_AND_ASSIGN(GPUTimingClient); |
| 132 }; | 135 }; |
| 133 | 136 |
| 134 } // namespace gfx | 137 } // namespace gfx |
| 135 | 138 |
| 136 #endif // GPU_COMMAND_BUFFER_SERVICE_GPU_TIMING_H_ | 139 #endif // GPU_COMMAND_BUFFER_SERVICE_GPU_TIMING_H_ |
| OLD | NEW |