OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // This file defines a set of user experience metrics data recorded by | 5 // This file defines a set of user experience metrics data recorded by |
6 // the MetricsService. This is the unit of data that is sent to the server. | 6 // the MetricsService. This is the unit of data that is sent to the server. |
7 | 7 |
8 #ifndef CHROME_BROWSER_METRICS_METRICS_LOG_H_ | 8 #ifndef CHROME_BROWSER_METRICS_METRICS_LOG_H_ |
9 #define CHROME_BROWSER_METRICS_METRICS_LOG_H_ | 9 #define CHROME_BROWSER_METRICS_METRICS_LOG_H_ |
10 | 10 |
11 #include <string> | 11 #include <string> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "base/basictypes.h" | 14 #include "base/basictypes.h" |
15 #include "base/memory/scoped_vector.h" | |
15 #include "chrome/browser/metrics/extension_metrics.h" | 16 #include "chrome/browser/metrics/extension_metrics.h" |
16 #include "chrome/browser/metrics/metrics_network_observer.h" | 17 #include "chrome/browser/metrics/metrics_network_observer.h" |
17 #include "chrome/common/metrics/variations/variations_util.h" | 18 #include "chrome/common/metrics/variations/variations_util.h" |
18 #include "chrome/installer/util/google_update_settings.h" | 19 #include "chrome/installer/util/google_update_settings.h" |
19 #include "components/metrics/metrics_log_base.h" | 20 #include "components/metrics/metrics_log_base.h" |
20 #include "ui/gfx/size.h" | 21 #include "ui/gfx/size.h" |
21 | 22 |
22 class HashedExtensionMetrics; | 23 class HashedExtensionMetrics; |
23 class MetricsNetworkObserver; | 24 class MetricsNetworkObserver; |
24 struct OmniboxLog; | 25 struct OmniboxLog; |
25 class PrefService; | 26 class PrefService; |
26 class PrefRegistrySimple; | 27 class PrefRegistrySimple; |
27 | 28 |
28 #if defined(OS_CHROMEOS) | 29 #if defined(OS_CHROMEOS) |
29 class MetricsLogChromeOS; | 30 class MetricsLogChromeOS; |
30 #endif | 31 #endif |
31 | 32 |
32 namespace base { | 33 namespace base { |
33 class DictionaryValue; | 34 class DictionaryValue; |
34 } | 35 } |
35 | 36 |
36 namespace content { | 37 namespace content { |
37 struct WebPluginInfo; | 38 struct WebPluginInfo; |
38 } | 39 } |
39 | 40 |
41 namespace metrics { | |
42 class MetricsDataProvider; | |
43 } | |
44 | |
40 namespace tracked_objects { | 45 namespace tracked_objects { |
41 struct ProcessDataSnapshot; | 46 struct ProcessDataSnapshot; |
42 } | 47 } |
43 | 48 |
44 namespace chrome_variations { | 49 namespace chrome_variations { |
45 struct ActiveGroupId; | 50 struct ActiveGroupId; |
46 } | 51 } |
47 | 52 |
48 // This is a small helper struct to pass Google Update metrics in a single | 53 // This is a small helper struct to pass Google Update metrics in a single |
49 // reference argument to MetricsLog::RecordEnvironment(). | 54 // reference argument to MetricsLog::RecordEnvironment(). |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
82 static void set_version_extension(const std::string& extension); | 87 static void set_version_extension(const std::string& extension); |
83 static const std::string& version_extension(); | 88 static const std::string& version_extension(); |
84 | 89 |
85 // Records the current operating environment. Takes the list of installed | 90 // Records the current operating environment. Takes the list of installed |
86 // plugins, Google Update statistics, and synthetic trial IDs as parameters | 91 // plugins, Google Update statistics, and synthetic trial IDs as parameters |
87 // because those can't be obtained synchronously from the UI thread. | 92 // because those can't be obtained synchronously from the UI thread. |
88 // A synthetic trial is one that is set up dynamically by code in Chrome. For | 93 // A synthetic trial is one that is set up dynamically by code in Chrome. For |
89 // example, a pref may be mapped to a synthetic trial such that the group | 94 // example, a pref may be mapped to a synthetic trial such that the group |
90 // is determined by the pref value. | 95 // is determined by the pref value. |
91 void RecordEnvironment( | 96 void RecordEnvironment( |
97 const ScopedVector<metrics::MetricsDataProvider>& data_providers, | |
Ilya Sherman
2014/05/19 14:45:00
nit: Passing ScopedVectors is a little odd. Pleas
Ilya Sherman
2014/05/19 14:45:00
nit: Please update the docs.
Alexei Svitkine (slow)
2014/05/19 15:23:02
Didn't realise it's possible to access the underly
Alexei Svitkine (slow)
2014/05/19 15:23:02
Done.
| |
92 const std::vector<content::WebPluginInfo>& plugin_list, | 98 const std::vector<content::WebPluginInfo>& plugin_list, |
93 const GoogleUpdateMetrics& google_update_metrics, | 99 const GoogleUpdateMetrics& google_update_metrics, |
94 const std::vector<chrome_variations::ActiveGroupId>& synthetic_trials); | 100 const std::vector<chrome_variations::ActiveGroupId>& synthetic_trials); |
95 | 101 |
96 // Loads the environment proto that was saved by the last RecordEnvironment() | 102 // Loads the environment proto that was saved by the last RecordEnvironment() |
97 // call from prefs and clears the pref value. Returns true on success or false | 103 // call from prefs and clears the pref value. Returns true on success or false |
98 // if there was no saved environment in prefs or it could not be decoded. | 104 // if there was no saved environment in prefs or it could not be decoded. |
99 bool LoadSavedEnvironmentFromPrefs(); | 105 bool LoadSavedEnvironmentFromPrefs(); |
100 | 106 |
101 // Records the input text, available choices, and selected entry when the | 107 // Records the input text, available choices, and selected entry when the |
102 // user uses the Omnibox to open a URL. | 108 // user uses the Omnibox to open a URL. |
103 void RecordOmniboxOpenedURL(const OmniboxLog& log); | 109 void RecordOmniboxOpenedURL(const OmniboxLog& log); |
104 | 110 |
105 // Records the passed profiled data, which should be a snapshot of the | 111 // Records the passed profiled data, which should be a snapshot of the |
106 // browser's profiled performance during startup for a single process. | 112 // browser's profiled performance during startup for a single process. |
107 void RecordProfilerData( | 113 void RecordProfilerData( |
108 const tracked_objects::ProcessDataSnapshot& process_data, | 114 const tracked_objects::ProcessDataSnapshot& process_data, |
109 int process_type); | 115 int process_type); |
110 | 116 |
111 // Writes application stability metrics (as part of the profile log). The | 117 // Writes application stability metrics (as part of the profile log). The |
112 // system profile portion of the log must have already been filled in by a | 118 // system profile portion of the log must have already been filled in by a |
113 // call to RecordEnvironment() or LoadSavedEnvironmentFromPrefs(). | 119 // call to RecordEnvironment() or LoadSavedEnvironmentFromPrefs(). |
114 // NOTE: Has the side-effect of clearing the stability prefs.. | 120 // NOTE: Has the side-effect of clearing the stability prefs.. |
115 // | 121 // |
116 // If this log is of type INITIAL_STABILITY_LOG, records additional info such | 122 // If this log is of type INITIAL_STABILITY_LOG, records additional info such |
117 // as number of incomplete shutdowns as well as extra breakpad and debugger | 123 // as number of incomplete shutdowns as well as extra breakpad and debugger |
118 // stats. | 124 // stats. |
119 void RecordStabilityMetrics(base::TimeDelta incremental_uptime, | 125 void RecordStabilityMetrics( |
120 base::TimeDelta uptime); | 126 const ScopedVector<metrics::MetricsDataProvider>& data_providers, |
Ilya Sherman
2014/05/19 14:45:00
nit: Please update the docs.
Alexei Svitkine (slow)
2014/05/19 15:23:02
Done.
| |
127 base::TimeDelta incremental_uptime, | |
128 base::TimeDelta uptime); | |
129 | |
130 // Record general metrics based on the specified |providers|. | |
131 void RecordGeneralMetrics( | |
132 const ScopedVector<metrics::MetricsDataProvider>& data_providers); | |
121 | 133 |
122 const base::TimeTicks& creation_time() const { | 134 const base::TimeTicks& creation_time() const { |
123 return creation_time_; | 135 return creation_time_; |
124 } | 136 } |
125 | 137 |
126 protected: | 138 protected: |
127 // Exposed for the sake of mocking in test code. | 139 // Exposed for the sake of mocking in test code. |
128 | 140 |
129 // Returns the PrefService from which to log metrics data. | 141 // Returns the PrefService from which to log metrics data. |
130 virtual PrefService* GetPrefService(); | 142 virtual PrefService* GetPrefService(); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
186 // The time when the current log was created. | 198 // The time when the current log was created. |
187 const base::TimeTicks creation_time_; | 199 const base::TimeTicks creation_time_; |
188 | 200 |
189 // For including information on which extensions are installed in reports. | 201 // For including information on which extensions are installed in reports. |
190 HashedExtensionMetrics extension_metrics_; | 202 HashedExtensionMetrics extension_metrics_; |
191 | 203 |
192 DISALLOW_COPY_AND_ASSIGN(MetricsLog); | 204 DISALLOW_COPY_AND_ASSIGN(MetricsLog); |
193 }; | 205 }; |
194 | 206 |
195 #endif // CHROME_BROWSER_METRICS_METRICS_LOG_H_ | 207 #endif // CHROME_BROWSER_METRICS_METRICS_LOG_H_ |
OLD | NEW |