• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.
4 
5 #ifndef COMPONENTS_METRICS_PROFILER_PROFILER_METRICS_PROVIDER_H_
6 #define COMPONENTS_METRICS_PROFILER_PROFILER_METRICS_PROVIDER_H_
7 
8 #include "base/basictypes.h"
9 #include "components/metrics/metrics_provider.h"
10 #include "components/metrics/proto/chrome_user_metrics_extension.pb.h"
11 
12 namespace tracked_objects {
13 struct ProcessDataSnapshot;
14 }
15 
16 namespace metrics {
17 
18 // ProfilerMetricsProvider is responsible for filling out the |profiler_event|
19 // section of the UMA proto.
20 class ProfilerMetricsProvider : public MetricsProvider {
21  public:
22   ProfilerMetricsProvider();
23   virtual ~ProfilerMetricsProvider();
24 
25   // MetricsDataProvider:
26   virtual void ProvideGeneralMetrics(
27       ChromeUserMetricsExtension* uma_proto) OVERRIDE;
28 
29   // Records the passed profiled data, which should be a snapshot of the
30   // browser's profiled performance during startup for a single process.
31   void RecordProfilerData(
32       const tracked_objects::ProcessDataSnapshot& process_data,
33       int process_type);
34 
35  private:
36   // Saved cache of generated Profiler event protos, to be copied into the UMA
37   // proto when ProvideGeneralMetrics() is called.
38   ProfilerEventProto profiler_event_cache_;
39 
40   // True if this instance has recorded profiler data since the last call to
41   // ProvideGeneralMetrics().
42   bool has_profiler_data_;
43 
44   DISALLOW_COPY_AND_ASSIGN(ProfilerMetricsProvider);
45 };
46 
47 }  // namespace metrics
48 
49 #endif  // COMPONENTS_METRICS_PROFILER_PROFILER_METRICS_PROVIDER_H_
50