Make stack sampling profiler sample beyond startup

Desktop / Chromium - asvitkine [chromium.org] - 14 July 2017 18:16 EDT

This expands the base sampling profiler API to make the client callback to be able to return new sampling params if another profiling collection should be started.

Additionally, converts sampling profiler reporting to use a base::Feature rather than a field trial directly and adds a base::Feature param that specifies whether this new functionality should be used to do periodic sampling (at 1s intervals). This new functionality is not on by default, but can be enabled via a field trial.

The new periodic samples will be added to UMA logs as they're received and will have PERIODIC_COLLECTION trigger specified in the proto.

Adds a test for the new base profiler functionality.

Also, updates profile_duration for non-periodic profiles to include the sampling_period, as that was previously not accounted for.

Also fixes some existing lint warnings.

BUG=735182

Review-Url: https://codereview.chromium.org/2927593002 Cr-Commit-Position: refs/heads/master@{#486906}

2d8b08c Make stack sampling profiler sample beyond startup.
base/profiler/stack_sampling_profiler.cc | 107 +++++----
base/profiler/stack_sampling_profiler.h | 12 +-
base/profiler/stack_sampling_profiler_unittest.cc | 66 +++++-
base/time/time.h | 5 +-
chrome/browser/chrome_browser_main.cc | 15 +-
chrome/browser/chrome_browser_main.h | 1 +
components/metrics/BUILD.gn | 5 +-
components/metrics/call_stack_profile_collector.cc | 5 +-
.../metrics/call_stack_profile_metrics_provider.cc | 166 +++++++++-----
.../metrics/call_stack_profile_metrics_provider.h | 44 ++--
...call_stack_profile_metrics_provider_unittest.cc | 238 ++++++++++++++-------
components/metrics/call_stack_profile_params.cc | 22 --
components/metrics/call_stack_profile_params.h | 29 ++-
.../metrics/child_call_stack_profile_collector.cc | 26 ++-
.../metrics/child_call_stack_profile_collector.h | 13 +-
.../child_call_stack_profile_collector_unittest.cc | 3 +-
.../public/cpp/call_stack_profile_struct_traits.h | 16 +-
.../interfaces/call_stack_profile_collector.mojom | 1 +
18 files changed, 533 insertions(+), 241 deletions(-)

Upstream: git.chromium.org


  • Share