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

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: Simplified DisjointContext to simply be an ID instead of an object 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 cc484dc36f58d24a831618a01ce10676aec5e53f..96a04cb8ddab4b3449c1c04554a328c185a19719 100644
--- a/gpu/command_buffer/service/gpu_tracer.cc
+++ b/gpu/command_buffer/service/gpu_tracer.cc
@@ -81,7 +81,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)
@@ -130,15 +130,18 @@ 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),
+ disjoint_context_id_(gpu_timing->CreateDisjointContextID()),
gpu_executing_(false),
process_posted_(false) {
+ DCHECK(decoder);
+ DCHECK(gpu_timing);
}
GPUTracer::~GPUTracer() {
@@ -149,24 +152,23 @@ bool GPUTracer::BeginDecoding() {
return false;
if (outputter_ == NULL) {
- outputter_ = CreateOutputter(gpu_timing_.GetTimerTypeName());
- gpu_timing_.Initialize(decoder_->GetGLContext());
+ outputter_ = CreateOutputter(gpu_timing_->GetTimerTypeName());
}
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();
+ gpu_timing_->CheckAndResetTimerErrors(disjoint_context_id_);
// 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);
}
@@ -216,7 +218,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;
}
@@ -288,7 +290,7 @@ void GPUTracer::Process() {
}
void GPUTracer::ProcessTraces() {
- if (!gpu_timing_.IsAvailable()) {
+ if (!gpu_timing_->IsAvailable()) {
traces_.clear();
return;
}
@@ -304,7 +306,7 @@ void GPUTracer::ProcessTraces() {
// Check if timers are still valid (e.g: a disjoint operation
// might have occurred.)
- if (gpu_timing_.CheckAndResetTimerErrors())
+ if (gpu_timing_->CheckAndResetTimerErrors(disjoint_context_id_))
traces_.clear();
while (!traces_.empty() && traces_.front()->IsAvailable()) {

Powered by Google App Engine
This is Rietveld 408576698