summaryrefslogtreecommitdiffstats
path: root/gpu
diff options
context:
space:
mode:
authorjbates@chromium.org <jbates@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-19 17:16:19 +0000
committerjbates@chromium.org <jbates@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-19 17:16:19 +0000
commitc8867ff8d91f5be838ddb179bd08261807cc8cb2 (patch)
treeab0a2efb19bcb8a30a7b6dcbee1d743aa8f22a83 /gpu
parentacf25bc074f81f41b0373c5c8ebe5ac599b2dcf0 (diff)
downloadchromium_src-c8867ff8d91f5be838ddb179bd08261807cc8cb2.zip
chromium_src-c8867ff8d91f5be838ddb179bd08261807cc8cb2.tar.gz
chromium_src-c8867ff8d91f5be838ddb179bd08261807cc8cb2.tar.bz2
Updated event trace code to stop on buffer full condition for any child process. Added more trace events to show expensive blocking IPCs in renderer process.
BUG=79510 TEST=start trace in about:gpu; open some WebGL windows; when trace Buffer usage reaches 100%, verify that the trace is ended Review URL: http://codereview.chromium.org/6870020 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@82115 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu')
-rw-r--r--gpu/command_buffer/client/cmd_buffer_helper.cc3
-rw-r--r--gpu/command_buffer/service/gles2_cmd_decoder.cc3
-rw-r--r--gpu/common/gpu_trace_event.cc12
-rw-r--r--gpu/common/gpu_trace_event.h9
4 files changed, 27 insertions, 0 deletions
diff --git a/gpu/command_buffer/client/cmd_buffer_helper.cc b/gpu/command_buffer/client/cmd_buffer_helper.cc
index d3eaca1..3f7d94e 100644
--- a/gpu/command_buffer/client/cmd_buffer_helper.cc
+++ b/gpu/command_buffer/client/cmd_buffer_helper.cc
@@ -62,6 +62,7 @@ void CommandBufferHelper::Flush() {
// Calls Flush() and then waits until the buffer is empty. Break early if the
// error is set.
bool CommandBufferHelper::Finish() {
+ GPU_TRACE_EVENT0("gpu", "CommandBufferHelper::Finish");
do {
// Do not loop forever if the flush fails, meaning the command buffer reader
// has shutdown.
@@ -83,6 +84,7 @@ int32 CommandBufferHelper::InsertToken() {
cmd::SetToken& cmd = GetCmdSpace<cmd::SetToken>();
cmd.Init(token_);
if (token_ == 0) {
+ GPU_TRACE_EVENT0("gpu", "CommandBufferHelper::InsertToken(wrapped)");
// we wrapped
Finish();
GPU_DCHECK_EQ(token_, last_token_read_);
@@ -93,6 +95,7 @@ int32 CommandBufferHelper::InsertToken() {
// Waits until the current token value is greater or equal to the value passed
// in argument.
void CommandBufferHelper::WaitForToken(int32 token) {
+ GPU_TRACE_EVENT0("gpu", "CommandBufferHelper::WaitForToken");
// Return immediately if corresponding InsertToken failed.
if (token < 0)
return;
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc
index 9e14183..db58132 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -34,6 +34,7 @@
#include "gpu/command_buffer/service/shader_manager.h"
#include "gpu/command_buffer/service/shader_translator.h"
#include "gpu/command_buffer/service/texture_manager.h"
+#include "gpu/common/gpu_trace_event.h"
#include "gpu/GLES2/gles2_command_buffer.h"
#include "ui/gfx/gl/gl_context.h"
#include "ui/gfx/gl/gl_implementation.h"
@@ -6387,6 +6388,7 @@ error::Error GLES2DecoderImpl::HandleSwapBuffers(
error::Error GLES2DecoderImpl::HandleSetLatchCHROMIUM(
uint32 immediate_data_size, const gles2::SetLatchCHROMIUM& c) {
+ GPU_TRACE_EVENT0("gpu", "SetLatch");
// Ensure the side effects of previous commands are visible to other contexts.
// There is no need to do this for ANGLE because it uses a
// single D3D device for all contexts.
@@ -6413,6 +6415,7 @@ error::Error GLES2DecoderImpl::HandleSetLatchCHROMIUM(
error::Error GLES2DecoderImpl::HandleWaitLatchCHROMIUM(
uint32 immediate_data_size, const gles2::WaitLatchCHROMIUM& c) {
+ GPU_TRACE_EVENT0("gpu", "WaitLatch");
int32 shm_id = gpu::kLatchSharedMemoryId;
uint32 latch_id = c.latch_id;
uint32 shm_offset = 0;
diff --git a/gpu/common/gpu_trace_event.cc b/gpu/common/gpu_trace_event.cc
index af6c16e..882b0b8 100644
--- a/gpu/common/gpu_trace_event.cc
+++ b/gpu/common/gpu_trace_event.cc
@@ -169,6 +169,10 @@ void TraceLog::SetEnabled(bool enabled) {
}
}
+float TraceLog::GetBufferPercentFull() const {
+ return (float)((double)logged_events_.size()/(double)TRACE_EVENT_BUFFER_SIZE);
+}
+
void TraceLog::SetOutputCallback(TraceLog::OutputCallback* cb) {
AutoLock lock(lock_);
if (enabled_) {
@@ -177,6 +181,11 @@ void TraceLog::SetOutputCallback(TraceLog::OutputCallback* cb) {
output_callback_.reset(cb);
}
+void TraceLog::SetBufferFullCallback(TraceLog::BufferFullCallback* cb) {
+ AutoLock lock(lock_);
+ buffer_full_callback_.reset(cb);
+}
+
void TraceLog::AddRemotelyCollectedData(const std::string& json_events) {
AutoLock lock(lock_);
if (output_callback_.get())
@@ -229,6 +238,9 @@ void TraceLog::AddTraceEvent(TraceEventPhase phase,
event.argNames[1] = arg2name;
event.argValues[1] = arg2name ? arg2val : "";
COMPILE_ASSERT(TRACE_MAX_NUM_ARGS == 2, TraceEvent_arc_count_out_of_sync);
+ if (logged_events_.size() == TRACE_EVENT_BUFFER_SIZE &&
+ buffer_full_callback_.get())
+ buffer_full_callback_->Run();
}
} // namespace gpu
diff --git a/gpu/common/gpu_trace_event.h b/gpu/common/gpu_trace_event.h
index 8e4a176..2ed9b9d 100644
--- a/gpu/common/gpu_trace_event.h
+++ b/gpu/common/gpu_trace_event.h
@@ -214,12 +214,20 @@ class TraceLog {
// implicitly controls the global logging state.
void SetEnabled(bool enabled);
+ float GetBufferPercentFull() const;
+
// When enough events are collected, they are handed (in bulk) to
// the output callback. If no callback is set, the output will be
// silently dropped.
typedef Callback1<const std::string& /* json_events */>::Type OutputCallback;
void SetOutputCallback(OutputCallback* cb);
+ // The trace buffer does not flush dynamically, so when it fills up,
+ // subsequent trace events will be dropped. This callback is generated when
+ // the trace buffer is full.
+ typedef Callback0::Type BufferFullCallback;
+ void SetBufferFullCallback(BufferFullCallback* cb);
+
// Forwards data collected by a child process to the registered
// output callback.
void AddRemotelyCollectedData(const std::string& json_events);
@@ -253,6 +261,7 @@ class TraceLog {
bool enabled_;
ScopedVector<TraceCategory> categories_;
scoped_ptr<OutputCallback> output_callback_;
+ scoped_ptr<BufferFullCallback> buffer_full_callback_;
std::vector<TraceEvent> logged_events_;
DISALLOW_COPY_AND_ASSIGN(TraceLog);