Index: components/metrics/call_stack_profile_metrics_provider.h |
diff --git a/components/metrics/call_stack_profile_metrics_provider.h b/components/metrics/call_stack_profile_metrics_provider.h |
index 5c4f0db7f94e39dd53dd15c84e35df876d8f2852..3412978dac914a28ff693cb3fafcf34dfd76aef7 100644 |
--- a/components/metrics/call_stack_profile_metrics_provider.h |
+++ b/components/metrics/call_stack_profile_metrics_provider.h |
@@ -7,6 +7,7 @@ |
#include <vector> |
+#include "base/feature_list.h" |
#include "base/macros.h" |
#include "base/memory/ref_counted.h" |
#include "base/profiler/stack_sampling_profiler.h" |
@@ -14,8 +15,17 @@ |
#include "components/metrics/metrics_provider.h" |
namespace metrics { |
+ |
class ChromeUserMetricsExtension; |
+// Internal to expose functions for testing. |
+namespace internal { |
+ |
+// Returns the process uptime as a TimeDelta. |
+base::TimeDelta GetUptime(); |
+ |
+} // namespace internal |
+ |
// Performs metrics logging for the stack sampling profiler. |
class CallStackProfileMetricsProvider : public MetricsProvider { |
public: |
@@ -41,27 +51,33 @@ class CallStackProfileMetricsProvider : public MetricsProvider { |
// StackSamplingProfiler, and should not be reused between |
// StackSamplingProfilers. This function may be called on any thread. |
static base::StackSamplingProfiler::CompletedCallback GetProfilerCallback( |
Mike Wittman
2017/07/13 18:10:29
This can be made private or moved into the anonymo
Alexei Svitkine (slow)
2017/07/13 18:36:14
Done. Moved to internal namespace, since it was us
|
- const CallStackProfileParams& params); |
+ CallStackProfileParams* params); |
+ |
+ // A version of GetProfilerCallback() that sets up parameters for browser |
+ // process startup sampling. The callback should be immediately passed to the |
+ // StackSamplingProfiler, and should not be reused. |
+ static base::StackSamplingProfiler::CompletedCallback |
+ GetProfilerCallbackForBrowserProcessStartup(); |
// Provides completed stack profiles to the metrics provider. Intended for use |
// when receiving profiles over IPC. In-process StackSamplingProfiler users |
// should use GetProfilerCallback() instead. |profiles| is not const& because |
// it must be passed with std::move. |
static void ReceiveCompletedProfiles( |
- const CallStackProfileParams& params, |
- base::TimeTicks start_timestamp, |
+ CallStackProfileParams* params, |
base::StackSamplingProfiler::CallStackProfiles profiles); |
+ // Whether periodic sampling is enabled via a trial. |
+ static bool IsPeriodicSamplingEnabled(); |
+ |
// MetricsProvider: |
void OnRecordingEnabled() override; |
void OnRecordingDisabled() override; |
void ProvideGeneralMetrics(ChromeUserMetricsExtension* uma_proto) override; |
protected: |
- // Finch field trial and group for reporting profiles. Provided here for test |
- // use. |
- static const char kFieldTrialName[]; |
- static const char kReportProfilesGroupName[]; |
+ // base::Feature for reporting profiles. Provided here for test use. |
+ static const base::Feature kEnableReporting; |
// Reset the static state to the defaults after startup. |
static void ResetStaticStateForTesting(); |