| OLD | NEW |
| 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 // 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 COMPONENTS_METRICS_METRICS_LOG_H_ | 8 #ifndef COMPONENTS_METRICS_METRICS_LOG_H_ |
| 9 #define COMPONENTS_METRICS_METRICS_LOG_H_ | 9 #define COMPONENTS_METRICS_METRICS_LOG_H_ |
| 10 | 10 |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 static int64_t GetCurrentTime(); | 80 static int64_t GetCurrentTime(); |
| 81 | 81 |
| 82 // Records a user-initiated action. | 82 // Records a user-initiated action. |
| 83 void RecordUserAction(const std::string& key); | 83 void RecordUserAction(const std::string& key); |
| 84 | 84 |
| 85 // Record any changes in a given histogram for transmission. | 85 // Record any changes in a given histogram for transmission. |
| 86 void RecordHistogramDelta(const std::string& histogram_name, | 86 void RecordHistogramDelta(const std::string& histogram_name, |
| 87 const base::HistogramSamples& snapshot); | 87 const base::HistogramSamples& snapshot); |
| 88 | 88 |
| 89 // Records the current operating environment, including metrics provided by | 89 // Records the current operating environment, including metrics provided by |
| 90 // the specified set of |metrics_providers|. Takes the list of installed | 90 // the specified set of |metrics_providers|. Takes the list of synthetic |
| 91 // plugins, Google Update statistics, and synthetic trial IDs as parameters | 91 // trial IDs as a parameter. A synthetic trial is one that is set up |
| 92 // because those can't be obtained synchronously from the UI thread. | 92 // dynamically by code in Chrome. For example, a pref may be mapped to a |
| 93 // A synthetic trial is one that is set up dynamically by code in Chrome. For | 93 // synthetic trial such that the group is determined by the pref value. |
| 94 // example, a pref may be mapped to a synthetic trial such that the group | |
| 95 // is determined by the pref value. | |
| 96 void RecordEnvironment( | 94 void RecordEnvironment( |
| 97 const std::vector<MetricsProvider*>& metrics_providers, | 95 const std::vector<MetricsProvider*>& metrics_providers, |
| 98 const std::vector<variations::ActiveGroupId>& synthetic_trials, | 96 const std::vector<variations::ActiveGroupId>& synthetic_trials, |
| 99 int64_t install_date, | 97 int64_t install_date, |
| 100 int64_t metrics_reporting_enabled_date); | 98 int64_t metrics_reporting_enabled_date); |
| 101 | 99 |
| 102 // Loads the environment proto that was saved by the last RecordEnvironment() | 100 // Loads the environment proto that was saved by the last RecordEnvironment() |
| 103 // call from prefs and clears the pref value. On success, returns true and | 101 // call from prefs. On success, returns true and |app_version| contains the |
| 104 // |app_version| contains the recovered version. Otherwise (if there was no | 102 // recovered version. Otherwise (if there was no saved environment in prefs |
| 105 // saved environment in prefs or it could not be decoded), returns false and | 103 // or it could not be decoded), returns false and |app_version| is empty. |
| 106 // |app_version| is empty. | |
| 107 bool LoadSavedEnvironmentFromPrefs(std::string* app_version); | 104 bool LoadSavedEnvironmentFromPrefs(std::string* app_version); |
| 108 | 105 |
| 109 // Writes application stability metrics, including stability metrics provided | 106 // Writes application stability metrics, including stability metrics provided |
| 110 // by the specified set of |metrics_providers|. The system profile portion of | 107 // by the specified set of |metrics_providers|. The system profile portion of |
| 111 // the log must have already been filled in by a call to RecordEnvironment() | 108 // the log must have already been filled in by a call to RecordEnvironment() |
| 112 // or LoadSavedEnvironmentFromPrefs(). | 109 // or LoadSavedEnvironmentFromPrefs(). |
| 113 // NOTE: Has the side-effect of clearing the stability prefs.. | 110 // NOTE: Has the side-effect of clearing the stability prefs.. |
| 114 // | 111 // |
| 115 // If this log is of type INITIAL_STABILITY_LOG, records additional info such | 112 // If this log is of type INITIAL_STABILITY_LOG, records additional info such |
| 116 // as number of incomplete shutdowns as well as extra breakpad and debugger | 113 // as number of incomplete shutdowns as well as extra breakpad and debugger |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 const base::TimeTicks creation_time_; | 198 const base::TimeTicks creation_time_; |
| 202 | 199 |
| 203 PrefService* local_state_; | 200 PrefService* local_state_; |
| 204 | 201 |
| 205 DISALLOW_COPY_AND_ASSIGN(MetricsLog); | 202 DISALLOW_COPY_AND_ASSIGN(MetricsLog); |
| 206 }; | 203 }; |
| 207 | 204 |
| 208 } // namespace metrics | 205 } // namespace metrics |
| 209 | 206 |
| 210 #endif // COMPONENTS_METRICS_METRICS_LOG_H_ | 207 #endif // COMPONENTS_METRICS_METRICS_LOG_H_ |
| OLD | NEW |