Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(734)

Side by Side Diff: components/metrics/profiler/profiler_metrics_provider.h

Issue 985773002: Introducing phased profiling framework (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@write_to_file
Patch Set: Fixing Android compile errors. Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef COMPONENTS_METRICS_PROFILER_PROFILER_METRICS_PROVIDER_H_ 5 #ifndef COMPONENTS_METRICS_PROFILER_PROFILER_METRICS_PROVIDER_H_
6 #define COMPONENTS_METRICS_PROFILER_PROFILER_METRICS_PROVIDER_H_ 6 #define COMPONENTS_METRICS_PROFILER_PROFILER_METRICS_PROVIDER_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "components/metrics/metrics_provider.h" 10 #include "components/metrics/metrics_provider.h"
11 #include "components/metrics/profiler/tracking_synchronizer_observer.h"
11 #include "components/metrics/proto/chrome_user_metrics_extension.pb.h" 12 #include "components/metrics/proto/chrome_user_metrics_extension.pb.h"
13 #include "content/public/common/process_type.h"
12 14
13 namespace tracked_objects { 15 namespace tracked_objects {
14 struct ProcessDataSnapshot; 16 struct ProcessDataPhaseSnapshot;
15 } 17 }
16 18
17 namespace metrics { 19 namespace metrics {
18 20
19 // ProfilerMetricsProvider is responsible for filling out the |profiler_event| 21 // ProfilerMetricsProvider is responsible for filling out the |profiler_event|
20 // section of the UMA proto. 22 // section of the UMA proto.
21 class ProfilerMetricsProvider : public MetricsProvider { 23 class ProfilerMetricsProvider : public MetricsProvider {
22 public: 24 public:
23 explicit ProfilerMetricsProvider( 25 explicit ProfilerMetricsProvider(
24 const base::Callback<void(bool*)>& cellular_callback); 26 const base::Callback<void(bool*)>& cellular_callback);
25 // Creates profiler metrics provider with a null callback. 27 // Creates profiler metrics provider with a null callback.
26 ProfilerMetricsProvider(); 28 ProfilerMetricsProvider();
27 ~ProfilerMetricsProvider() override; 29 ~ProfilerMetricsProvider() override;
28 30
29 // MetricsDataProvider: 31 // MetricsDataProvider:
30 void ProvideGeneralMetrics(ChromeUserMetricsExtension* uma_proto) override; 32 void ProvideGeneralMetrics(ChromeUserMetricsExtension* uma_proto) override;
31 33
32 // Records the passed profiled data, which should be a snapshot of the 34 // Records the passed profiled data, which should be a snapshot of the
33 // browser's profiled performance during startup for a single process. 35 // browser's profiled performance during startup for a single process.
34 void RecordProfilerData( 36 void RecordProfilerData(
35 const tracked_objects::ProcessDataSnapshot& process_data, 37 const tracked_objects::ProcessDataPhaseSnapshot& process_data,
36 int process_type); 38 base::ProcessId process_id,
39 content::ProcessType process_type,
40 int profiling_phase,
41 base::TimeDelta phase_start,
42 base::TimeDelta phase_finish,
43 const ProfilerEvents& past_events);
37 44
38 private: 45 private:
39 // Returns whether current connection is cellular or not according to the 46 // Returns whether current connection is cellular or not according to the
40 // callback. 47 // callback.
41 bool IsCellularConnection(); 48 bool IsCellularConnection();
42 49
43 // Saved cache of generated Profiler event protos, to be copied into the UMA 50 // Saved cache of generated Profiler event protos, to be copied into the UMA
44 // proto when ProvideGeneralMetrics() is called. 51 // proto when ProvideGeneralMetrics() is called. The map is from a profiling
45 ProfilerEventProto profiler_event_cache_; 52 // phase id to the profiler event proto that represents profiler data for the
46 53 // profiling phase.
47 // True if this instance has recorded profiler data since the last call to 54 std::map<int, ProfilerEventProto> profiler_events_cache_;
48 // ProvideGeneralMetrics().
49 bool has_profiler_data_;
50 55
51 // Callback function used to get current network connection type. 56 // Callback function used to get current network connection type.
52 base::Callback<void(bool*)> cellular_callback_; 57 base::Callback<void(bool*)> cellular_callback_;
53 58
54 DISALLOW_COPY_AND_ASSIGN(ProfilerMetricsProvider); 59 DISALLOW_COPY_AND_ASSIGN(ProfilerMetricsProvider);
55 }; 60 };
56 61
57 } // namespace metrics 62 } // namespace metrics
58 63
59 #endif // COMPONENTS_METRICS_PROFILER_PROFILER_METRICS_PROVIDER_H_ 64 #endif // COMPONENTS_METRICS_PROFILER_PROFILER_METRICS_PROVIDER_H_
OLDNEW
« no previous file with comments | « components/metrics/profiler/DEPS ('k') | components/metrics/profiler/profiler_metrics_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698