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

Unified Diff: gpu/command_buffer/service/gpu_tracer.cc

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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gpu/command_buffer/service/gpu_tracer.h ('k') | gpu/command_buffer/service/gpu_tracer_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/service/gpu_tracer.cc
diff --git a/gpu/command_buffer/service/gpu_tracer.cc b/gpu/command_buffer/service/gpu_tracer.cc
index a633959f385d11f9ff0ad72f543bc3bd5d2b8543..33d318d74b26bfe723f17282051b0e9b6f533652 100644
--- a/gpu/command_buffer/service/gpu_tracer.cc
+++ b/gpu/command_buffer/service/gpu_tracer.cc
@@ -85,12 +85,15 @@ GPUTrace::GPUTrace(scoped_refptr<Outputter> outputter,
gfx::GPUTimingClient* gpu_timing_client,
const std::string& category,
const std::string& name,
- const bool enabled)
+ const bool tracing_service,
+ const bool tracing_device)
: category_(category),
name_(name),
outputter_(outputter),
- enabled_(enabled) {
- if (gpu_timing_client->IsAvailable() &&
+ service_enabled_(tracing_service),
+ device_enabled_(tracing_device) {
+ if (tracing_device &&
+ gpu_timing_client->IsAvailable() &&
gpu_timing_client->IsTimerOffsetAvailable()) {
gpu_timer_ = gpu_timing_client->CreateGPUTimer();
}
@@ -105,8 +108,8 @@ void GPUTrace::Destroy(bool have_context) {
}
}
-void GPUTrace::Start(bool trace_service) {
- if (trace_service) {
+void GPUTrace::Start() {
+ if (service_enabled_) {
outputter_->TraceServiceBegin(category_, name_);
}
if (gpu_timer_.get()) {
@@ -114,11 +117,11 @@ void GPUTrace::Start(bool trace_service) {
}
}
-void GPUTrace::End(bool tracing_service) {
+void GPUTrace::End() {
if (gpu_timer_.get()) {
gpu_timer_->End();
}
- if (tracing_service) {
+ if (service_enabled_) {
outputter_->TraceServiceEnd(category_, name_);
}
}
@@ -195,8 +198,9 @@ bool GPUTracer::BeginDecoding() {
trace_marker.trace_ =
new GPUTrace(outputter_, gpu_timing_client_.get(),
trace_marker.category_, trace_marker.name_,
+ *gpu_trace_srv_category != 0,
*gpu_trace_dev_category != 0);
- trace_marker.trace_->Start(*gpu_trace_srv_category != 0);
+ trace_marker.trace_->Start();
}
}
}
@@ -213,7 +217,7 @@ bool GPUTracer::EndDecoding() {
for (size_t i = 0; i < markers_[n].size(); i++) {
TraceMarker& marker = markers_[n][i];
if (marker.trace_.get()) {
- marker.trace_->End(*gpu_trace_srv_category != 0);
+ marker.trace_->End();
finished_traces_.push_back(marker.trace_);
marker.trace_ = 0;
@@ -244,8 +248,9 @@ bool GPUTracer::Begin(const std::string& category, const std::string& name,
if (IsTracing()) {
scoped_refptr<GPUTrace> trace = new GPUTrace(
outputter_, gpu_timing_client_.get(), category, name,
+ *gpu_trace_srv_category != 0,
*gpu_trace_dev_category != 0);
- trace->Start(*gpu_trace_srv_category != 0);
+ trace->Start();
markers_[source].back().trace_ = trace;
}
@@ -263,7 +268,7 @@ bool GPUTracer::End(GpuTracerSource source) {
scoped_refptr<GPUTrace> trace = markers_[source].back().trace_;
if (trace.get()) {
if (IsTracing()) {
- trace->End(*gpu_trace_srv_category != 0);
+ trace->End();
}
finished_traces_.push_back(trace);
@@ -338,7 +343,7 @@ void GPUTracer::ProcessTraces() {
while (!finished_traces_.empty()) {
scoped_refptr<GPUTrace>& trace = finished_traces_.front();
- if (trace->IsEnabled()) {
+ if (trace->IsDeviceTraceEnabled()) {
if (!finished_traces_.front()->IsAvailable())
break;
finished_traces_.front()->Process();
« no previous file with comments | « gpu/command_buffer/service/gpu_tracer.h ('k') | gpu/command_buffer/service/gpu_tracer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698