1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_METRICS_PROFILER_METRICS_PROVIDER_H_
6 #define CHROME_BROWSER_METRICS_PROFILER_METRICS_PROVIDER_H_
8 #include "base/basictypes.h"
9 #include "components/metrics/metrics_provider.h"
10 #include "components/metrics/proto/chrome_user_metrics_extension.pb.h"
12 namespace tracked_objects
{
13 struct ProcessDataSnapshot
;
16 // ProfilerMetricsProvider is responsible for filling out the |profiler_event|
17 // section of the UMA proto.
18 class ProfilerMetricsProvider
: public metrics::MetricsProvider
{
20 ProfilerMetricsProvider();
21 virtual ~ProfilerMetricsProvider();
23 // metrics::MetricsDataProvider:
24 virtual void ProvideGeneralMetrics(
25 metrics::ChromeUserMetricsExtension
* uma_proto
) OVERRIDE
;
27 // Records the passed profiled data, which should be a snapshot of the
28 // browser's profiled performance during startup for a single process.
29 void RecordProfilerData(
30 const tracked_objects::ProcessDataSnapshot
& process_data
,
34 // Saved cache of generated Profiler event protos, to be copied into the UMA
35 // proto when ProvideGeneralMetrics() is called.
36 metrics::ProfilerEventProto profiler_event_cache_
;
38 // True if this instance has recorded profiler data since the last call to
39 // ProvideGeneralMetrics().
40 bool has_profiler_data_
;
42 DISALLOW_COPY_AND_ASSIGN(ProfilerMetricsProvider
);
45 #endif // CHROME_BROWSER_METRICS_PROFILER_METRICS_PROVIDER_H_