Commit 43a4f5d0 authored by Mike Wittman's avatar Mike Wittman Committed by Commit Bot

Sampling profiler: disable GPU main thread profiling on OS X

Disabling pending a resolution to crashes observed in the associated
bug.

This change also removes the unused
GetSamplingParamsForCurrentProcess function and adapts
IsProfilerEnabledForCurrentProcess to operate on the current process
and specified thread.

The call to IsProfilerEnabledForCurrentProcess is also removed
from SetServiceManagerConnectorForChildProcess since that function is
only invoked in processes supporting the profiler.

Bug: 774682
Change-Id: Ibbc6f1bd9348ba09a3ee4db2e1595411617f1ccd
Reviewed-on: https://chromium-review.googlesource.com/962937
Commit-Queue: Mike Wittman <wittman@chromium.org>
Reviewed-by: default avatarScott Violet <sky@chromium.org>
Reviewed-by: default avatarLeonard Grey <lgrey@chromium.org>
Cr-Commit-Position: refs/heads/master@{#543520}
parent a9591001
...@@ -72,29 +72,20 @@ StackSamplingConfiguration::StackSamplingConfiguration() ...@@ -72,29 +72,20 @@ StackSamplingConfiguration::StackSamplingConfiguration()
: configuration_(GenerateConfiguration()) { : configuration_(GenerateConfiguration()) {
} }
base::StackSamplingProfiler::SamplingParams bool StackSamplingConfiguration::IsProfilerEnabledForThread(
StackSamplingConfiguration::GetSamplingParamsForCurrentProcess() const { metrics::CallStackProfileParams::Thread thread) const {
base::StackSamplingProfiler::SamplingParams params;
params.bursts = 1;
params.initial_delay = base::TimeDelta::FromMilliseconds(0);
params.sampling_interval = base::TimeDelta::FromMilliseconds(0);
params.samples_per_burst = 0;
if (IsProfilerEnabledForCurrentProcess()) {
const base::TimeDelta duration = base::TimeDelta::FromSeconds(30);
params.sampling_interval = base::TimeDelta::FromMilliseconds(100);
params.samples_per_burst = duration / params.sampling_interval;
}
return params;
}
bool StackSamplingConfiguration::IsProfilerEnabledForCurrentProcess() const {
if (IsBrowserProcess()) { if (IsBrowserProcess()) {
return configuration_ == PROFILE_ENABLED || return configuration_ == PROFILE_ENABLED ||
configuration_ == PROFILE_CONTROL; configuration_ == PROFILE_CONTROL;
} }
#if defined(OS_MACOSX)
// Disabled pending a resolution to crashes on Intel GPU tests. See
// https://crbug.com/774682.
if (thread == metrics::CallStackProfileParams::GPU_MAIN_THREAD)
return false;
#endif
DCHECK_EQ(PROFILE_FROM_COMMAND_LINE, configuration_); DCHECK_EQ(PROFILE_FROM_COMMAND_LINE, configuration_);
// This is a child process. The |kStartStackProfiler| switch passed by the // This is a child process. The |kStartStackProfiler| switch passed by the
// browser process determines whether the profiler is enabled for the process. // browser process determines whether the profiler is enabled for the process.
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include "base/callback.h" #include "base/callback.h"
#include "base/macros.h" #include "base/macros.h"
#include "base/profiler/stack_sampling_profiler.h" #include "base/profiler/stack_sampling_profiler.h"
#include "components/metrics/call_stack_profile_params.h"
namespace base { namespace base {
class CommandLine; class CommandLine;
...@@ -23,12 +24,10 @@ class StackSamplingConfiguration { ...@@ -23,12 +24,10 @@ class StackSamplingConfiguration {
public: public:
StackSamplingConfiguration(); StackSamplingConfiguration();
// Get the stack sampling params to use for this process. // Returns true if the profiler should be started for the specified thread in
base::StackSamplingProfiler::SamplingParams // the current process.
GetSamplingParamsForCurrentProcess() const; bool IsProfilerEnabledForThread(
metrics::CallStackProfileParams::Thread thread) const;
// Returns true if the profiler should be started for the current process.
bool IsProfilerEnabledForCurrentProcess() const;
// Get the synthetic field trial configuration. Returns true if a synthetic // Get the synthetic field trial configuration. Returns true if a synthetic
// field trial should be registered. This should only be called from the // field trial should be registered. This should only be called from the
......
...@@ -124,8 +124,10 @@ std::unique_ptr<ThreadProfiler> ThreadProfiler::CreateAndStartOnMainThread( ...@@ -124,8 +124,10 @@ std::unique_ptr<ThreadProfiler> ThreadProfiler::CreateAndStartOnMainThread(
void ThreadProfiler::SetMainThreadTaskRunner( void ThreadProfiler::SetMainThreadTaskRunner(
scoped_refptr<base::SingleThreadTaskRunner> task_runner) { scoped_refptr<base::SingleThreadTaskRunner> task_runner) {
if (!StackSamplingConfiguration::Get()->IsProfilerEnabledForCurrentProcess()) if (!StackSamplingConfiguration::Get()->IsProfilerEnabledForThread(
periodic_profile_params_.thread)) {
return; return;
}
DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
...@@ -139,7 +141,7 @@ void ThreadProfiler::SetMainThreadTaskRunner( ...@@ -139,7 +141,7 @@ void ThreadProfiler::SetMainThreadTaskRunner(
// static // static
void ThreadProfiler::StartOnChildThread( void ThreadProfiler::StartOnChildThread(
metrics::CallStackProfileParams::Thread thread) { metrics::CallStackProfileParams::Thread thread) {
if (!StackSamplingConfiguration::Get()->IsProfilerEnabledForCurrentProcess()) if (!StackSamplingConfiguration::Get()->IsProfilerEnabledForThread(thread))
return; return;
auto profiler = std::unique_ptr<ThreadProfiler>( auto profiler = std::unique_ptr<ThreadProfiler>(
...@@ -149,9 +151,6 @@ void ThreadProfiler::StartOnChildThread( ...@@ -149,9 +151,6 @@ void ThreadProfiler::StartOnChildThread(
void ThreadProfiler::SetServiceManagerConnectorForChildProcess( void ThreadProfiler::SetServiceManagerConnectorForChildProcess(
service_manager::Connector* connector) { service_manager::Connector* connector) {
if (!StackSamplingConfiguration::Get()->IsProfilerEnabledForCurrentProcess())
return;
DCHECK_NE(metrics::CallStackProfileParams::BROWSER_PROCESS, GetProcess()); DCHECK_NE(metrics::CallStackProfileParams::BROWSER_PROCESS, GetProcess());
metrics::mojom::CallStackProfileCollectorPtr browser_interface; metrics::mojom::CallStackProfileCollectorPtr browser_interface;
...@@ -194,7 +193,7 @@ ThreadProfiler::ThreadProfiler( ...@@ -194,7 +193,7 @@ ThreadProfiler::ThreadProfiler(
metrics::CallStackProfileParams::PERIODIC_COLLECTION, metrics::CallStackProfileParams::PERIODIC_COLLECTION,
metrics::CallStackProfileParams::MAY_SHUFFLE), metrics::CallStackProfileParams::MAY_SHUFFLE),
weak_factory_(this) { weak_factory_(this) {
if (!StackSamplingConfiguration::Get()->IsProfilerEnabledForCurrentProcess()) if (!StackSamplingConfiguration::Get()->IsProfilerEnabledForThread(thread))
return; return;
startup_profiler_ = std::make_unique<base::StackSamplingProfiler>( startup_profiler_ = std::make_unique<base::StackSamplingProfiler>(
......
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