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 #include "gpu/command_buffer/service/gpu_tracer.h" | 5 #include "gpu/command_buffer/service/gpu_tracer.h" |
6 | 6 |
7 #include <deque> | 7 #include <deque> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 GLARBTimerTrace(scoped_refptr<Outputter> outputter, const std::string& name, | 83 GLARBTimerTrace(scoped_refptr<Outputter> outputter, const std::string& name, |
84 int64 offset); | 84 int64 offset); |
85 | 85 |
86 // Implementation of Tracer | 86 // Implementation of Tracer |
87 virtual void Start() OVERRIDE; | 87 virtual void Start() OVERRIDE; |
88 virtual void End() OVERRIDE; | 88 virtual void End() OVERRIDE; |
89 virtual bool IsAvailable() OVERRIDE; | 89 virtual bool IsAvailable() OVERRIDE; |
90 virtual void Process() OVERRIDE; | 90 virtual void Process() OVERRIDE; |
91 | 91 |
92 private: | 92 private: |
93 ~GLARBTimerTrace(); | 93 virtual ~GLARBTimerTrace(); |
94 | 94 |
95 void Output(); | 95 void Output(); |
96 | 96 |
97 scoped_refptr<Outputter> outputter_; | 97 scoped_refptr<Outputter> outputter_; |
98 | 98 |
99 int64 offset_; | 99 int64 offset_; |
100 int64 start_time_; | 100 int64 start_time_; |
101 int64 end_time_; | 101 int64 end_time_; |
102 bool end_requested_; | 102 bool end_requested_; |
103 | 103 |
104 GLuint queries_[2]; | 104 GLuint queries_[2]; |
105 | 105 |
106 DISALLOW_COPY_AND_ASSIGN(GLARBTimerTrace); | 106 DISALLOW_COPY_AND_ASSIGN(GLARBTimerTrace); |
107 }; | 107 }; |
108 | 108 |
109 class NoopTrace : public Trace { | 109 class NoopTrace : public Trace { |
110 public: | 110 public: |
111 explicit NoopTrace(const std::string& name) : Trace(name) {} | 111 explicit NoopTrace(const std::string& name) : Trace(name) {} |
112 | 112 |
113 // Implementation of Tracer | 113 // Implementation of Tracer |
114 virtual void Start() OVERRIDE {} | 114 virtual void Start() OVERRIDE {} |
115 virtual void End() OVERRIDE {} | 115 virtual void End() OVERRIDE {} |
116 virtual bool IsAvailable() OVERRIDE { return true; } | 116 virtual bool IsAvailable() OVERRIDE { return true; } |
117 virtual bool IsProcessable() OVERRIDE { return false; } | 117 virtual bool IsProcessable() OVERRIDE { return false; } |
118 virtual void Process() OVERRIDE {} | 118 virtual void Process() OVERRIDE {} |
119 | 119 |
120 private: | 120 private: |
121 ~NoopTrace() {} | 121 virtual ~NoopTrace() {} |
122 | 122 |
123 DISALLOW_COPY_AND_ASSIGN(NoopTrace); | 123 DISALLOW_COPY_AND_ASSIGN(NoopTrace); |
124 }; | 124 }; |
125 | 125 |
126 class GPUTracerImpl | 126 class GPUTracerImpl |
127 : public GPUTracer, | 127 : public GPUTracer, |
128 public base::SupportsWeakPtr<GPUTracerImpl> { | 128 public base::SupportsWeakPtr<GPUTracerImpl> { |
129 public: | 129 public: |
130 GPUTracerImpl() | 130 GPUTracerImpl() |
131 : gpu_category_enabled_(TRACE_EVENT_API_GET_CATEGORY_ENABLED("gpu")), | 131 : gpu_category_enabled_(TRACE_EVENT_API_GET_CATEGORY_ENABLED("gpu")), |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 } // namespace | 336 } // namespace |
337 | 337 |
338 scoped_ptr<GPUTracer> GPUTracer::Create() { | 338 scoped_ptr<GPUTracer> GPUTracer::Create() { |
339 if (gfx::g_driver_gl.ext.b_GL_ARB_timer_query) | 339 if (gfx::g_driver_gl.ext.b_GL_ARB_timer_query) |
340 return scoped_ptr<GPUTracer>(new GPUTracerARBTimerQuery()); | 340 return scoped_ptr<GPUTracer>(new GPUTracerARBTimerQuery()); |
341 return scoped_ptr<GPUTracer>(new GPUTracerImpl()); | 341 return scoped_ptr<GPUTracer>(new GPUTracerImpl()); |
342 } | 342 } |
343 | 343 |
344 } // namespace gles2 | 344 } // namespace gles2 |
345 } // namespace gpu | 345 } // namespace gpu |
OLD | NEW |