Stack sampling profiler: add fire-and-forget interface
commit622851eac1f83a532d080699ab9825f1ef47d34f
authorwittman <wittman@chromium.org>
Fri, 31 Jul 2015 18:13:40 +0000 (31 11:13 -0700)
committerCommit bot <commit-bot@chromium.org>
Fri, 31 Jul 2015 18:14:18 +0000 (31 18:14 +0000)
tree2dec7617b77db5caca59cf08ff2d423cfffae474
parent495ab7c4baebbe5096d571171c78819d82d40bd6
Stack sampling profiler: add fire-and-forget interface

Adds a StartAndRunAsync function on the stack sampling profiler that permits
profiling to be performed with a single call, rather than having to allocate and
start a profiler object. This allows the profiler to be used to record execution
state in response to discrete events (e.g. on the WatchDogThread) without
forcing the caller to maintain profiler-related state during the profiling
execution.

To keep the interface simple this change updates the stack sampling profiler to
require a CompletedCallback and eliminates the default completed callback. This
has the additional benefits of moving the retention of completed stack profiles
from base to components/metrics, simplifying the base implementation, and moving
UMA-specific parameters out of the base interface.

BUG=464929

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

Cr-Commit-Position: refs/heads/master@{#341367}
12 files changed:
base/profiler/stack_sampling_profiler.cc
base/profiler/stack_sampling_profiler.h
base/profiler/stack_sampling_profiler_unittest.cc
chrome/browser/metrics/metrics_services_manager.cc
components/metrics/call_stack_profile_metrics_provider.cc
components/metrics/call_stack_profile_metrics_provider.h
components/metrics/call_stack_profile_metrics_provider_unittest.cc
components/metrics/metrics_service.cc
components/metrics/metrics_service.h
components/metrics/metrics_service_unittest.cc
components/metrics/test_metrics_provider.cc
components/metrics/test_metrics_provider.h