Commit b52e91e1 authored by vadimt's avatar vadimt Committed by Commit bot

Instrumenting GPU initialization for jank

We want to see how much GPU initialization contributes to startup slowness.

BUG=125248

Review URL: https://codereview.chromium.org/860293004

Cr-Commit-Position: refs/heads/master@{#313611}
parent 6302d690
...@@ -7,10 +7,10 @@ ...@@ -7,10 +7,10 @@
#include <set> #include <set>
#include "base/bind.h" #include "base/bind.h"
#include "base/profiler/scoped_tracker.h"
#include "base/synchronization/waitable_event.h" #include "base/synchronization/waitable_event.h"
#include "base/threading/thread_restrictions.h" #include "base/threading/thread_restrictions.h"
#include "base/trace_event/trace_event.h" #include "base/trace_event/trace_event.h"
#include "base/tracked_objects.h"
#include "content/browser/gpu/browser_gpu_memory_buffer_manager.h" #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h"
#include "content/browser/gpu/gpu_data_manager_impl.h" #include "content/browser/gpu/gpu_data_manager_impl.h"
#include "content/browser/gpu/gpu_process_host.h" #include "content/browser/gpu/gpu_process_host.h"
...@@ -194,12 +194,10 @@ void BrowserGpuChannelHostFactory::EstablishRequest::FinishOnMain() { ...@@ -194,12 +194,10 @@ void BrowserGpuChannelHostFactory::EstablishRequest::FinishOnMain() {
void BrowserGpuChannelHostFactory::EstablishRequest::Wait() { void BrowserGpuChannelHostFactory::EstablishRequest::Wait() {
DCHECK(main_loop_->BelongsToCurrentThread()); DCHECK(main_loop_->BelongsToCurrentThread());
{ {
// Since the current task synchronously waits for establishing a GPU // TODO(vadimt): Remove ScopedTracker below once crbug.com/125248 is fixed.
// channel, it shouldn't be tallied because its execution time has nothing tracked_objects::ScopedTracker tracking_profile(
// to do with its efficiency. Using task stopwatch to exclude the waiting FROM_HERE_WITH_EXPLICIT_FUNCTION(
// time from the current task run time. "125248 BrowserGpuChannelHostFactory::EstablishRequest::Wait"));
tracked_objects::TaskStopwatch stopwatch;
stopwatch.Start();
// We're blocking the UI thread, which is generally undesirable. // We're blocking the UI thread, which is generally undesirable.
// In this case we need to wait for this before we can show any UI // In this case we need to wait for this before we can show any UI
...@@ -209,8 +207,6 @@ void BrowserGpuChannelHostFactory::EstablishRequest::Wait() { ...@@ -209,8 +207,6 @@ void BrowserGpuChannelHostFactory::EstablishRequest::Wait() {
"BrowserGpuChannelHostFactory::EstablishGpuChannelSync"); "BrowserGpuChannelHostFactory::EstablishGpuChannelSync");
base::ThreadRestrictions::ScopedAllowWait allow_wait; base::ThreadRestrictions::ScopedAllowWait allow_wait;
event_.Wait(); event_.Wait();
stopwatch.Stop();
} }
FinishOnMain(); FinishOnMain();
} }
...@@ -331,6 +327,11 @@ CreateCommandBufferResult BrowserGpuChannelHostFactory::CreateViewCommandBuffer( ...@@ -331,6 +327,11 @@ CreateCommandBufferResult BrowserGpuChannelHostFactory::CreateViewCommandBuffer(
&request, &request,
surface_id, surface_id,
init_params)); init_params));
// TODO(vadimt): Remove ScopedTracker below once crbug.com/125248 is fixed.
tracked_objects::ScopedTracker tracking_profile(
FROM_HERE_WITH_EXPLICIT_FUNCTION(
"125248 BrowserGpuChannelHostFactory::CreateViewCommandBuffer"));
// We're blocking the UI thread, which is generally undesirable. // We're blocking the UI thread, which is generally undesirable.
// In this case we need to wait for this before we can show any UI /anyway/, // In this case we need to wait for this before we can show any UI /anyway/,
// so it won't cause additional jank. // so it won't cause additional jank.
......
...@@ -21,8 +21,8 @@ ...@@ -21,8 +21,8 @@
#include "base/message_loop/message_loop.h" #include "base/message_loop/message_loop.h"
#include "base/metrics/field_trial.h" #include "base/metrics/field_trial.h"
#include "base/metrics/histogram.h" #include "base/metrics/histogram.h"
#include "base/profiler/scoped_tracker.h"
#include "base/trace_event/trace_event.h" #include "base/trace_event/trace_event.h"
#include "base/tracked_objects.h"
#include "content/common/gpu/client/gpu_channel_host.h" #include "content/common/gpu/client/gpu_channel_host.h"
#include "content/public/common/content_constants.h" #include "content/public/common/content_constants.h"
#include "content/public/common/content_switches.h" #include "content/public/common/content_switches.h"
...@@ -128,18 +128,14 @@ bool WebGraphicsContext3DCommandBufferImpl::MaybeInitializeGL() { ...@@ -128,18 +128,14 @@ bool WebGraphicsContext3DCommandBufferImpl::MaybeInitializeGL() {
TRACE_EVENT0("gpu", "WebGfxCtx3DCmdBfrImpl::MaybeInitializeGL"); TRACE_EVENT0("gpu", "WebGfxCtx3DCmdBfrImpl::MaybeInitializeGL");
// Below, we perform an expensive one-time initialization that is required to // TODO(vadimt): Remove ScopedTracker below once crbug.com/125248 is fixed.
// get first pixels to the screen. This can't be called "jank" since there is tracked_objects::ScopedTracker tracking_profile(
// nothing on the screen. Using TaskStopwatch to exclude the operation from FROM_HERE_WITH_EXPLICIT_FUNCTION(
// jank calculations. "125248 WebGraphicsContext3DCommandBufferImpl::MaybeInitializeGL"));
tracked_objects::TaskStopwatch stopwatch;
stopwatch.Start();
if (!CreateContext(surface_id_ != 0)) { if (!CreateContext(surface_id_ != 0)) {
Destroy(); Destroy();
stopwatch.Stop();
initialize_failed_ = true; initialize_failed_ = true;
return false; return false;
} }
...@@ -157,8 +153,6 @@ bool WebGraphicsContext3DCommandBufferImpl::MaybeInitializeGL() { ...@@ -157,8 +153,6 @@ bool WebGraphicsContext3DCommandBufferImpl::MaybeInitializeGL() {
real_gl_->SetErrorMessageCallback(getErrorMessageCallback()); real_gl_->SetErrorMessageCallback(getErrorMessageCallback());
stopwatch.Stop();
visible_ = true; visible_ = true;
initialized_ = true; initialized_ = true;
return true; return true;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment