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

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

Issue 940633004: Added disjoint context class which manages disjoints within gpu timing. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Initialize disjoint value to proper value Created 5 years, 10 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
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 6bedb7f00fc30e0714b059c13b74b172ac8ab537..71c626999876f100f7217886af10b1adcf064647 100644
--- a/gpu/command_buffer/service/gpu_tracer.cc
+++ b/gpu/command_buffer/service/gpu_tracer.cc
@@ -80,7 +80,7 @@ void TraceOutputter::TraceServiceEnd(const std::string& category,
}
GPUTrace::GPUTrace(scoped_refptr<Outputter> outputter,
- gpu::GPUTiming* gpu_timing,
+ GPUTiming* gpu_timing,
const std::string& category,
const std::string& name,
const bool enabled)
@@ -129,13 +129,14 @@ void GPUTrace::Process() {
}
}
-GPUTracer::GPUTracer(gles2::GLES2Decoder* decoder)
+GPUTracer::GPUTracer(gles2::GLES2Decoder* decoder, GPUTiming* gpu_timing)
: gpu_trace_srv_category(TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED(
TRACE_DISABLED_BY_DEFAULT("gpu.service"))),
gpu_trace_dev_category(TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED(
TRACE_DISABLED_BY_DEFAULT("gpu.device"))),
decoder_(decoder),
- gpu_timing_(),
+ gpu_timing_(gpu_timing),
Daniele Castagna 2015/02/19 18:15:32 if gpu_timing can't be null, I'd add a DCHECK.
David Yen 2015/02/19 19:00:47 Done.
+ disjoint_context_(gpu_timing->CreateDisjointContext()),
gpu_executing_(false),
process_posted_(false) {
}
@@ -148,24 +149,24 @@ bool GPUTracer::BeginDecoding() {
return false;
if (outputter_ == NULL) {
- outputter_ = CreateOutputter(gpu_timing_.GetTimerTypeName());
- gpu_timing_.Initialize(decoder_->GetGLContext());
+ outputter_ = CreateOutputter(gpu_timing_->GetTimerTypeName());
+ gpu_timing_->Initialize(decoder_->GetGLContext());
}
if (*gpu_trace_dev_category == '\0') {
// If GPU device category is off, invalidate timing sync.
- gpu_timing_.InvalidateTimerOffset();
+ gpu_timing_->InvalidateTimerOffset();
}
gpu_executing_ = true;
if (IsTracing()) {
- gpu_timing_.CheckAndResetTimerErrors();
+ disjoint_context_->CheckAndResetTimerErrors();
// Begin a Trace for all active markers
for (int n = 0; n < NUM_TRACER_SOURCES; n++) {
for (size_t i = 0; i < markers_[n].size(); i++) {
TraceMarker& trace_marker = markers_[n][i];
trace_marker.trace_ =
- new GPUTrace(outputter_, &gpu_timing_, trace_marker.category_,
+ new GPUTrace(outputter_, gpu_timing_, trace_marker.category_,
trace_marker.name_, *gpu_trace_dev_category != 0);
trace_marker.trace_->Start(*gpu_trace_srv_category != 0);
}
@@ -215,7 +216,7 @@ bool GPUTracer::Begin(const std::string& category, const std::string& name,
// Create trace
if (IsTracing()) {
scoped_refptr<GPUTrace> trace = new GPUTrace(
- outputter_, &gpu_timing_, category, name, *gpu_trace_dev_category != 0);
+ outputter_, gpu_timing_, category, name, *gpu_trace_dev_category != 0);
trace->Start(*gpu_trace_srv_category != 0);
markers_[source].back().trace_ = trace;
}
@@ -287,7 +288,7 @@ void GPUTracer::Process() {
}
void GPUTracer::ProcessTraces() {
- if (!gpu_timing_.IsAvailable()) {
+ if (!gpu_timing_->IsAvailable()) {
traces_.clear();
return;
}
@@ -303,7 +304,7 @@ void GPUTracer::ProcessTraces() {
// Check if timers are still valid (e.g: a disjoint operation
// might have occurred.)
- if (gpu_timing_.CheckAndResetTimerErrors())
+ if (disjoint_context_->CheckAndResetTimerErrors())
traces_.clear();
while (!traces_.empty() && traces_.front()->IsAvailable()) {

Powered by Google App Engine
This is Rietveld 408576698