| 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 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
| 14 #include "base/threading/thread.h" | 14 #include "base/threading/thread.h" |
| 15 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
| 15 #include "gpu/gpu_export.h" | 16 #include "gpu/gpu_export.h" |
| 16 #include "ui/gl/gl_bindings.h" | 17 #include "ui/gl/gl_bindings.h" |
| 17 | 18 |
| 18 namespace gpu { | 19 namespace gpu { |
| 19 namespace gles2 { | 20 namespace gles2 { |
| 20 | 21 |
| 21 // Traces GPU Commands. | 22 // Traces GPU Commands. |
| 22 class GPUTracer { | 23 class GPUTracer { |
| 23 public: | 24 public: |
| 24 static scoped_ptr<GPUTracer> Create(); | 25 static scoped_ptr<GPUTracer> Create(gles2::GLES2Decoder* decoder); |
| 25 | 26 |
| 26 GPUTracer() {} | 27 explicit GPUTracer(gles2::GLES2Decoder* decoder); |
| 27 virtual ~GPUTracer() {} | 28 virtual ~GPUTracer(); |
| 28 | 29 |
| 29 // Begin a trace. | 30 // Begin a trace. |
| 30 virtual bool Begin(const std::string& name) = 0; | 31 virtual bool Begin(const std::string& name) = 0; |
| 31 | 32 |
| 32 // End the last started trace. | 33 // End the last started trace. |
| 33 virtual bool End() = 0; | 34 virtual bool End() = 0; |
| 34 | 35 |
| 35 // Retrieve the name of the current open trace. | 36 // Retrieve the name of the current open trace. |
| 36 // Returns empty string if no current open trace. | 37 // Returns empty string if no current open trace. |
| 37 virtual const std::string& CurrentName() const = 0; | 38 virtual const std::string& CurrentName() const = 0; |
| 38 | 39 |
| 40 gles2::GLES2Decoder* decoder_; |
| 41 |
| 39 private: | 42 private: |
| 40 DISALLOW_COPY_AND_ASSIGN(GPUTracer); | 43 DISALLOW_COPY_AND_ASSIGN(GPUTracer); |
| 41 }; | 44 }; |
| 42 | 45 |
| 43 class Outputter : public base::RefCounted<Outputter> { | 46 class Outputter : public base::RefCounted<Outputter> { |
| 44 public: | 47 public: |
| 45 virtual void Trace(const std::string& name, | 48 virtual void Trace(const std::string& name, |
| 46 int64 start_time, | 49 int64 start_time, |
| 47 int64 end_time) = 0; | 50 int64 end_time) = 0; |
| 48 | 51 |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 | 124 |
| 122 GLuint queries_[2]; | 125 GLuint queries_[2]; |
| 123 | 126 |
| 124 DISALLOW_COPY_AND_ASSIGN(GLARBTimerTrace); | 127 DISALLOW_COPY_AND_ASSIGN(GLARBTimerTrace); |
| 125 }; | 128 }; |
| 126 | 129 |
| 127 } // namespace gles2 | 130 } // namespace gles2 |
| 128 } // namespace gpu | 131 } // namespace gpu |
| 129 | 132 |
| 130 #endif // GPU_COMMAND_BUFFER_SERVICE_GPU_TRACER_H_ | 133 #endif // GPU_COMMAND_BUFFER_SERVICE_GPU_TRACER_H_ |
| OLD | NEW |