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

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

Issue 11416117: Hookup the GPUTrace events. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years 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/gles2_cmd_decoder.cc
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc
index 2ec1e96e4a4fbe30f2a81b4996002b4cd88976d3..65cfe21290a39cc601cd287ecae4086686fc2915 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -39,7 +39,7 @@
#include "gpu/command_buffer/service/gles2_cmd_copy_texture_chromium.h"
#include "gpu/command_buffer/service/gles2_cmd_validation.h"
#include "gpu/command_buffer/service/gpu_switches.h"
-#include "gpu/command_buffer/service/gpu_trace.h"
+#include "gpu/command_buffer/service/gpu_tracer.h"
#include "gpu/command_buffer/service/image_manager.h"
#include "gpu/command_buffer/service/mailbox_manager.h"
#include "gpu/command_buffer/service/memory_tracking.h"
@@ -1584,7 +1584,7 @@ class GLES2DecoderImpl : public GLES2Decoder {
base::TimeDelta total_texture_upload_time_;
base::TimeDelta total_processing_commands_time_;
- std::stack<linked_ptr<GPUTrace> > gpu_trace_stack_;
+ scoped_ptr<GPUTracer> gpu_tracer_;
DISALLOW_COPY_AND_ASSIGN(GLES2DecoderImpl);
};
@@ -2015,6 +2015,8 @@ bool GLES2DecoderImpl::Initialize(
DCHECK(context->IsCurrent(surface.get()));
DCHECK(!context_.get());
+ gpu_tracer_ = GPUTracer::Create();
+
if (CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableGPUDebugging)) {
set_debug(true);
@@ -6446,6 +6448,9 @@ error::Error GLES2DecoderImpl::HandlePostSubBufferCHROMIUM(
"glPostSubBufferCHROMIUM", "command not supported by surface");
return error::kNoError;
}
+
+ gpu_tracer_->Process();
apatrick 2012/12/03 22:05:41 How about contexts that we never call SwapBuffers
dsinclair 2012/12/04 15:59:27 Ah, crap. I didn't know that those didn't call Swa
+
if (surface_->PostSubBuffer(c.x, c.y, c.width, c.height)) {
return error::kNoError;
} else {
@@ -8131,6 +8136,8 @@ error::Error GLES2DecoderImpl::HandleSwapBuffers(
return error::kDeferCommandUntilLater;
}
+ gpu_tracer_->Process();
+
int this_frame_number = frame_number_++;
// TRACE_EVENT for gpu tests:
TRACE_EVENT_INSTANT2("test_gpu", "SwapBuffersLatency",
@@ -9295,24 +9302,23 @@ error::Error GLES2DecoderImpl::HandleTraceBeginCHROMIUM(
if (!bucket->GetAsString(&command_name)) {
return error::kInvalidArguments;
}
-
- linked_ptr<GPUTrace> trace(new GPUTrace(command_name));
- trace->EnableStartTrace();
- gpu_trace_stack_.push(trace);
-
+ TRACE_EVENT_COPY_ASYNC_BEGIN0("gpu", command_name.c_str(), this);
+ if (!gpu_tracer_->Begin(command_name)) {
+ SetGLError(GL_INVALID_OPERATION,
+ "glTraceBeginCHROMIUM", "unable to create begin trace");
+ return error::kNoError;
+ }
return error::kNoError;
}
void GLES2DecoderImpl::DoTraceEndCHROMIUM() {
- if (gpu_trace_stack_.empty()) {
+ if (gpu_tracer_->CurrentName().empty()) {
SetGLError(GL_INVALID_OPERATION,
"glTraceEndCHROMIUM", "no trace begin found");
return;
}
-
- linked_ptr<GPUTrace> trace = gpu_trace_stack_.top();
- trace->EnableEndTrace();
- gpu_trace_stack_.pop();
+ TRACE_EVENT_COPY_ASYNC_END0("gpu", gpu_tracer_->CurrentName().c_str(), this);
+ gpu_tracer_->End();
}
error::Error GLES2DecoderImpl::HandleAsyncTexImage2DCHROMIUM(

Powered by Google App Engine
This is Rietveld 408576698