Commit 3823737f authored by erikchen's avatar erikchen Committed by Commit Bot

Disable tracing for profiling service.

Chrome suffers a significant performance degradation when both tracing and
out-of-process heap-profiling are enabled. This is because the profiling service
emits multiple trace events each time it reads from a profiling pipe, which
happens around every 30 allocations or so. For more details, see the thread
https://groups.google.com/a/google.com/forum/#!topic/chrome-benchmarking/rjNyxf_53lU.

Bug: 769583
Change-Id: Iba006679154037268bb91b5baf09857a73aae8d2
Reviewed-on: https://chromium-review.googlesource.com/723747
Commit-Queue: Erik Chen <erikchen@chromium.org>
Reviewed-by: default avatarBrett Wilson <brettw@chromium.org>
Cr-Commit-Position: refs/heads/master@{#510265}
parent a18d187d
......@@ -76,6 +76,7 @@
#include "services/service_manager/public/cpp/connector.h"
#include "services/service_manager/public/cpp/interface_provider.h"
#include "services/service_manager/runner/common/client_util.h"
#include "services/service_manager/sandbox/sandbox_type.h"
#if defined(OS_POSIX)
#include "base/posix/global_descriptors.h"
......@@ -505,15 +506,11 @@ void ChildThreadImpl::Init(const Options& options) {
channel_->AddFilter(notification_dispatcher_->GetFilter());
channel_->AddFilter(service_worker_message_filter_->GetFilter());
if (!IsInBrowserProcess()) {
// In single process mode, browser-side tracing and memory will cover the
// whole process including renderers.
channel_->AddFilter(new tracing::ChildTraceMessageFilter(
ChildProcess::current()->io_task_runner()));
chrome_trace_event_agent_ =
base::MakeUnique<tracing::ChromeTraceEventAgent>(GetConnector());
InitTracing();
// In single process mode, browser-side tracing and memory will cover the
// whole process including renderers.
if (!IsInBrowserProcess()) {
if (service_manager_connection_) {
std::string process_type_str =
base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
......@@ -609,6 +606,28 @@ void ChildThreadImpl::Init(const Options& options) {
#endif
}
void ChildThreadImpl::InitTracing() {
// In single process mode, browser-side tracing and memory will cover the
// whole process including renderers.
if (IsInBrowserProcess())
return;
// Tracing adds too much overhead to the profiling service. The only
// way to determine if this is the profiling service is by checking the
// sandbox type.
service_manager::SandboxType sandbox_type =
service_manager::SandboxTypeFromCommandLine(
*base::CommandLine::ForCurrentProcess());
if (sandbox_type == service_manager::SANDBOX_TYPE_PROFILING)
return;
channel_->AddFilter(new tracing::ChildTraceMessageFilter(
ChildProcess::current()->io_task_runner()));
chrome_trace_event_agent_ =
base::MakeUnique<tracing::ChromeTraceEventAgent>(GetConnector());
}
ChildThreadImpl::~ChildThreadImpl() {
#if BUILDFLAG(IPC_MESSAGE_LOG_ENABLED)
IPC::Logging::GetInstance()->SetIPCSender(NULL);
......
......@@ -213,6 +213,9 @@ class CONTENT_EXPORT ChildThreadImpl
void Init(const Options& options);
// Sets chrome_trace_event_agent_ if necessary.
void InitTracing();
// We create the channel first without connecting it so we can add filters
// prior to any messages being received, then connect it afterwards.
void ConnectChannel(mojo::edk::IncomingBrokerClientInvitation* invitation);
......
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