OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // This file contains the GPUTrace class. | 5 // This file contains the GPUTrace class. |
6 #ifndef GPU_COMMAND_BUFFER_SERVICE_GPU_TRACER_H_ | 6 #ifndef GPU_COMMAND_BUFFER_SERVICE_GPU_TRACER_H_ |
7 #define GPU_COMMAND_BUFFER_SERVICE_GPU_TRACER_H_ | 7 #define GPU_COMMAND_BUFFER_SERVICE_GPU_TRACER_H_ |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 int64 start_time_; | 206 int64 start_time_; |
207 int64 end_time_; | 207 int64 end_time_; |
208 GpuTracerType tracer_type_; | 208 GpuTracerType tracer_type_; |
209 bool end_requested_; | 209 bool end_requested_; |
210 | 210 |
211 GLuint queries_[2]; | 211 GLuint queries_[2]; |
212 | 212 |
213 DISALLOW_COPY_AND_ASSIGN(GPUTrace); | 213 DISALLOW_COPY_AND_ASSIGN(GPUTrace); |
214 }; | 214 }; |
215 | 215 |
| 216 class ScopedGPUTrace { |
| 217 public: |
| 218 ScopedGPUTrace(GPUTracer* gpu_tracer, GpuTracerSource source, |
| 219 const std::string& category, const std::string& name) |
| 220 : gpu_tracer_(gpu_tracer), |
| 221 source_(source) { |
| 222 gpu_tracer_->Begin(category, name, source_); |
| 223 } |
| 224 |
| 225 ~ScopedGPUTrace() { |
| 226 gpu_tracer_->End(source_); |
| 227 } |
| 228 |
| 229 private: |
| 230 GPUTracer* gpu_tracer_; |
| 231 GpuTracerSource source_; |
| 232 }; |
| 233 |
216 } // namespace gles2 | 234 } // namespace gles2 |
217 } // namespace gpu | 235 } // namespace gpu |
218 | 236 |
219 #endif // GPU_COMMAND_BUFFER_SERVICE_GPU_TRACER_H_ | 237 #endif // GPU_COMMAND_BUFFER_SERVICE_GPU_TRACER_H_ |
OLD | NEW |