| 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 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 #endif | 30 #endif |
| 31 | 31 |
| 32 namespace base { | 32 namespace base { |
| 33 class DictionaryValue; | 33 class DictionaryValue; |
| 34 } | 34 } |
| 35 | 35 |
| 36 namespace content { | 36 namespace content { |
| 37 struct WebPluginInfo; | 37 struct WebPluginInfo; |
| 38 } | 38 } |
| 39 | 39 |
| 40 namespace metrics { |
| 41 class MetricsProvider; |
| 42 } |
| 43 |
| 40 namespace tracked_objects { | 44 namespace tracked_objects { |
| 41 struct ProcessDataSnapshot; | 45 struct ProcessDataSnapshot; |
| 42 } | 46 } |
| 43 | 47 |
| 44 namespace variations { | 48 namespace variations { |
| 45 struct ActiveGroupId; | 49 struct ActiveGroupId; |
| 46 } | 50 } |
| 47 | 51 |
| 48 // This is a small helper struct to pass Google Update metrics in a single | 52 // This is a small helper struct to pass Google Update metrics in a single |
| 49 // reference argument to MetricsLog::RecordEnvironment(). | 53 // reference argument to MetricsLog::RecordEnvironment(). |
| (...skipping 25 matching lines...) Expand all Loading... |
| 75 static void RegisterPrefs(PrefRegistrySimple* registry); | 79 static void RegisterPrefs(PrefRegistrySimple* registry); |
| 76 | 80 |
| 77 // Get the current version of the application as a string. | 81 // Get the current version of the application as a string. |
| 78 static std::string GetVersionString(); | 82 static std::string GetVersionString(); |
| 79 | 83 |
| 80 // Use |extension| in all uploaded appversions in addition to the standard | 84 // Use |extension| in all uploaded appversions in addition to the standard |
| 81 // version string. | 85 // version string. |
| 82 static void set_version_extension(const std::string& extension); | 86 static void set_version_extension(const std::string& extension); |
| 83 static const std::string& version_extension(); | 87 static const std::string& version_extension(); |
| 84 | 88 |
| 85 // Records the current operating environment. Takes the list of installed | 89 // Records the current operating environment, including metrics provided by |
| 90 // the specified set of |metrics_providers|. 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 std::vector<metrics::MetricsProvider*>& metrics_providers, |
| 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<variations::ActiveGroupId>& synthetic_trials); | 100 const std::vector<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, including stability metrics provided |
| 112 // system profile portion of the log must have already been filled in by a | 118 // by the specified set of |metrics_providers|. The system profile portion of |
| 113 // call to RecordEnvironment() or LoadSavedEnvironmentFromPrefs(). | 119 // the log must have already been filled in by a call to RecordEnvironment() |
| 120 // or LoadSavedEnvironmentFromPrefs(). |
| 114 // NOTE: Has the side-effect of clearing the stability prefs.. | 121 // NOTE: Has the side-effect of clearing the stability prefs.. |
| 115 // | 122 // |
| 116 // If this log is of type INITIAL_STABILITY_LOG, records additional info such | 123 // 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 | 124 // as number of incomplete shutdowns as well as extra breakpad and debugger |
| 118 // stats. | 125 // stats. |
| 119 void RecordStabilityMetrics(base::TimeDelta incremental_uptime, | 126 void RecordStabilityMetrics( |
| 120 base::TimeDelta uptime); | 127 const std::vector<metrics::MetricsProvider*>& metrics_providers, |
| 128 base::TimeDelta incremental_uptime, |
| 129 base::TimeDelta uptime); |
| 130 |
| 131 // Records general metrics based on the specified |metrics_providers|. |
| 132 void RecordGeneralMetrics( |
| 133 const std::vector<metrics::MetricsProvider*>& metrics_providers); |
| 121 | 134 |
| 122 const base::TimeTicks& creation_time() const { | 135 const base::TimeTicks& creation_time() const { |
| 123 return creation_time_; | 136 return creation_time_; |
| 124 } | 137 } |
| 125 | 138 |
| 126 protected: | 139 protected: |
| 127 // Exposed for the sake of mocking in test code. | 140 // Exposed for the sake of mocking in test code. |
| 128 | 141 |
| 129 // Returns the PrefService from which to log metrics data. | 142 // Returns the PrefService from which to log metrics data. |
| 130 virtual PrefService* GetPrefService(); | 143 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. | 199 // The time when the current log was created. |
| 187 const base::TimeTicks creation_time_; | 200 const base::TimeTicks creation_time_; |
| 188 | 201 |
| 189 // For including information on which extensions are installed in reports. | 202 // For including information on which extensions are installed in reports. |
| 190 HashedExtensionMetrics extension_metrics_; | 203 HashedExtensionMetrics extension_metrics_; |
| 191 | 204 |
| 192 DISALLOW_COPY_AND_ASSIGN(MetricsLog); | 205 DISALLOW_COPY_AND_ASSIGN(MetricsLog); |
| 193 }; | 206 }; |
| 194 | 207 |
| 195 #endif // CHROME_BROWSER_METRICS_METRICS_LOG_H_ | 208 #endif // CHROME_BROWSER_METRICS_METRICS_LOG_H_ |
| OLD | NEW |