Commit 1ebb1171 authored by vadimt's avatar vadimt Committed by Commit bot

Profiler-instrumentation of the startup time.

Before the instrumentation, startup time wasn't reported in profiler data.

Profiling it will allow the genre of detailed analysis of the startup time via jankiness investigations.

This change requires temporarily initializing tracking earlier than usual. Thie will either removed once the investigations complete, or will be officially converted to permanent code.

BUG=453640

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

Cr-Commit-Position: refs/heads/master@{#314179}
parent 5857e9ed
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
#include "chrome/app/chrome_main_delegate.h" #include "chrome/app/chrome_main_delegate.h"
#include "base/profiler/scoped_tracker.h"
#include "chrome/common/chrome_version_info.h"
#include "content/public/app/content_main.h" #include "content/public/app/content_main.h"
#if defined(OS_WIN) #if defined(OS_WIN)
...@@ -63,6 +65,22 @@ int ChromeMain(int argc, const char** argv) { ...@@ -63,6 +65,22 @@ int ChromeMain(int argc, const char** argv) {
params.argv = argv; params.argv = argv;
#endif #endif
// TODO(vadimt): Remove the switch statement below once crbug.com/453640 is
// fixed.
// Enable profiler instrumentation depending on the channel.
switch (chrome::VersionInfo::GetChannel()) {
case chrome::VersionInfo::CHANNEL_UNKNOWN:
case chrome::VersionInfo::CHANNEL_CANARY:
tracked_objects::ScopedTracker::Enable();
break;
case chrome::VersionInfo::CHANNEL_DEV:
case chrome::VersionInfo::CHANNEL_BETA:
case chrome::VersionInfo::CHANNEL_STABLE:
// Don't enable instrumentation.
break;
}
int rv = content::ContentMain(params); int rv = content::ContentMain(params);
#if defined(OS_WIN) #if defined(OS_WIN)
......
...@@ -10,7 +10,9 @@ ...@@ -10,7 +10,9 @@
#include "base/logging.h" #include "base/logging.h"
#include "base/metrics/histogram.h" #include "base/metrics/histogram.h"
#include "base/metrics/statistics_recorder.h" #include "base/metrics/statistics_recorder.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/browser/browser_main_loop.h" #include "content/browser/browser_main_loop.h"
#include "content/browser/browser_shutdown_profile_dumper.h" #include "content/browser/browser_shutdown_profile_dumper.h"
#include "content/browser/notification_service_impl.h" #include "content/browser/notification_service_impl.h"
...@@ -126,6 +128,13 @@ class BrowserMainRunnerImpl : public BrowserMainRunner { ...@@ -126,6 +128,13 @@ class BrowserMainRunnerImpl : public BrowserMainRunner {
} }
int Initialize(const MainFunctionParams& parameters) override { int Initialize(const MainFunctionParams& parameters) override {
// TODO(vadimt): Remove all tracked_objects references below once
// crbug.com/453640 is fixed.
tracked_objects::ThreadData::InitializeThreadContext("CrBrowserMain");
tracked_objects::ScopedTracker tracking_profile(
FROM_HERE_WITH_EXPLICIT_FUNCTION("BrowserMainRunnerImpl::Initialize"));
TRACE_EVENT0("startup", "BrowserMainRunnerImpl::Initialize"); TRACE_EVENT0("startup", "BrowserMainRunnerImpl::Initialize");
// On Android we normally initialize the browser in a series of UI thread // On Android we normally initialize the browser in a series of UI thread
// tasks. While this is happening a second request can come from the OS or // tasks. While this is happening a second request can come from the OS or
......
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