Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(326)

Side by Side Diff: gpu/command_buffer/service/gpu_tracer.h

Issue 1081483002: GPU Tracer no longer issue device traces when device category is off. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added unit test to test that trace calls are only called when categories are enabled Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | gpu/command_buffer/service/gpu_tracer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <deque> 9 #include <deque>
10 #include <string> 10 #include <string>
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 DISALLOW_COPY_AND_ASSIGN(TraceOutputter); 149 DISALLOW_COPY_AND_ASSIGN(TraceOutputter);
150 }; 150 };
151 151
152 class GPU_EXPORT GPUTrace 152 class GPU_EXPORT GPUTrace
153 : public base::RefCounted<GPUTrace> { 153 : public base::RefCounted<GPUTrace> {
154 public: 154 public:
155 GPUTrace(scoped_refptr<Outputter> outputter, 155 GPUTrace(scoped_refptr<Outputter> outputter,
156 gfx::GPUTimingClient* gpu_timing_client, 156 gfx::GPUTimingClient* gpu_timing_client,
157 const std::string& category, 157 const std::string& category,
158 const std::string& name, 158 const std::string& name,
159 const bool enabled); 159 const bool tracing_service,
160 const bool tracing_device);
160 161
161 void Destroy(bool have_context); 162 void Destroy(bool have_context);
162 163
163 void Start(bool trace_service); 164 void Start();
164 void End(bool tracing_service); 165 void End();
165 bool IsAvailable(); 166 bool IsAvailable();
166 bool IsEnabled() { return enabled_; } 167 bool IsServiceTraceEnabled() const { return service_enabled_; }
168 bool IsDeviceTraceEnabled() const { return device_enabled_; }
167 void Process(); 169 void Process();
168 170
169 private: 171 private:
170 ~GPUTrace(); 172 ~GPUTrace();
171 173
172 void Output(); 174 void Output();
173 175
174 friend class base::RefCounted<GPUTrace>; 176 friend class base::RefCounted<GPUTrace>;
175 177
176 std::string category_; 178 std::string category_;
177 std::string name_; 179 std::string name_;
178 scoped_refptr<Outputter> outputter_; 180 scoped_refptr<Outputter> outputter_;
179 scoped_ptr<gfx::GPUTimer> gpu_timer_; 181 scoped_ptr<gfx::GPUTimer> gpu_timer_;
180 const bool enabled_ = false; 182 const bool service_enabled_ = false;
183 const bool device_enabled_ = false;
181 184
182 DISALLOW_COPY_AND_ASSIGN(GPUTrace); 185 DISALLOW_COPY_AND_ASSIGN(GPUTrace);
183 }; 186 };
184 187
185 class ScopedGPUTrace { 188 class ScopedGPUTrace {
186 public: 189 public:
187 ScopedGPUTrace(GPUTracer* gpu_tracer, 190 ScopedGPUTrace(GPUTracer* gpu_tracer,
188 GpuTracerSource source, 191 GpuTracerSource source,
189 const std::string& category, 192 const std::string& category,
190 const std::string& name) 193 const std::string& name)
191 : gpu_tracer_(gpu_tracer), source_(source) { 194 : gpu_tracer_(gpu_tracer), source_(source) {
192 gpu_tracer_->Begin(category, name, source_); 195 gpu_tracer_->Begin(category, name, source_);
193 } 196 }
194 197
195 ~ScopedGPUTrace() { gpu_tracer_->End(source_); } 198 ~ScopedGPUTrace() { gpu_tracer_->End(source_); }
196 199
197 private: 200 private:
198 GPUTracer* gpu_tracer_; 201 GPUTracer* gpu_tracer_;
199 GpuTracerSource source_; 202 GpuTracerSource source_;
200 }; 203 };
201 204
202 } // namespace gles2 205 } // namespace gles2
203 } // namespace gpu 206 } // namespace gpu
204 207
205 #endif // GPU_COMMAND_BUFFER_SERVICE_GPU_TRACER_H_ 208 #endif // GPU_COMMAND_BUFFER_SERVICE_GPU_TRACER_H_
OLDNEW
« no previous file with comments | « no previous file | gpu/command_buffer/service/gpu_tracer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698