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

Side by Side Diff: components/metrics/metrics_log.h

Issue 2687393004: Gather stability prefs into managing objects. (Closed)
Patch Set: Remove unused method Created 3 years, 10 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 // 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
11 #include <stdint.h> 11 #include <stdint.h>
12 12
13 #include <string> 13 #include <string>
14 #include <vector> 14 #include <vector>
15 15
16 #include "base/macros.h" 16 #include "base/macros.h"
17 #include "base/time/time.h" 17 #include "base/time/time.h"
18 #include "components/metrics/metrics_service_client.h" 18 #include "components/metrics/metrics_service_client.h"
19 #include "components/metrics/proto/chrome_user_metrics_extension.pb.h" 19 #include "components/metrics/proto/chrome_user_metrics_extension.pb.h"
20 20
21 class PrefRegistrySimple;
22 class PrefService; 21 class PrefService;
23 22
24 namespace base { 23 namespace base {
25 class HistogramSamples; 24 class HistogramSamples;
26 } 25 }
27 26
28 namespace variations { 27 namespace variations {
29 struct ActiveGroupId; 28 struct ActiveGroupId;
30 } 29 }
31 30
(...skipping 17 matching lines...) Expand all
49 // Note: |this| instance does not take ownership of the |client|, but rather 48 // Note: |this| instance does not take ownership of the |client|, but rather
50 // stores a weak pointer to it. The caller should ensure that the |client| is 49 // stores a weak pointer to it. The caller should ensure that the |client| is
51 // valid for the lifetime of this class. 50 // valid for the lifetime of this class.
52 MetricsLog(const std::string& client_id, 51 MetricsLog(const std::string& client_id,
53 int session_id, 52 int session_id,
54 LogType log_type, 53 LogType log_type,
55 MetricsServiceClient* client, 54 MetricsServiceClient* client,
56 PrefService* local_state); 55 PrefService* local_state);
57 virtual ~MetricsLog(); 56 virtual ~MetricsLog();
58 57
59 // Registers local state prefs used by this class.
60 static void RegisterPrefs(PrefRegistrySimple* registry);
61
62 // Computes the MD5 hash of the given string, and returns the first 8 bytes of 58 // Computes the MD5 hash of the given string, and returns the first 8 bytes of
63 // the hash. 59 // the hash.
64 static uint64_t Hash(const std::string& value); 60 static uint64_t Hash(const std::string& value);
65 61
66 // Get the GMT buildtime for the current binary, expressed in seconds since 62 // Get the GMT buildtime for the current binary, expressed in seconds since
67 // January 1, 1970 GMT. 63 // January 1, 1970 GMT.
68 // The value is used to identify when a new build is run, so that previous 64 // The value is used to identify when a new build is run, so that previous
69 // reliability stats, from other builds, can be abandoned. 65 // reliability stats, from other builds, can be abandoned.
70 static int64_t GetBuildTime(); 66 static int64_t GetBuildTime();
71 67
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 bool HasEnvironment() const; 161 bool HasEnvironment() const;
166 162
167 // Write the default state of the enable metrics checkbox. 163 // Write the default state of the enable metrics checkbox.
168 void WriteMetricsEnableDefault(EnableMetricsDefault metrics_default, 164 void WriteMetricsEnableDefault(EnableMetricsDefault metrics_default,
169 SystemProfileProto* system_profile); 165 SystemProfileProto* system_profile);
170 166
171 // Returns true if the stability metrics have already been filled in by a 167 // Returns true if the stability metrics have already been filled in by a
172 // call to RecordStabilityMetrics(). 168 // call to RecordStabilityMetrics().
173 bool HasStabilityMetrics() const; 169 bool HasStabilityMetrics() const;
174 170
175 // Within the stability group, write required attributes.
176 void WriteRequiredStabilityAttributes(PrefService* pref);
177
178 // Within the stability group, write attributes that need to be updated asap 171 // Within the stability group, write attributes that need to be updated asap
179 // and can't be delayed until the user decides to restart chromium. 172 // and can't be delayed until the user decides to restart chromium.
180 // Delaying these stats would bias metrics away from happy long lived 173 // Delaying these stats would bias metrics away from happy long lived
181 // chromium processes (ones that don't crash, and keep on running). 174 // chromium processes (ones that don't crash, and keep on running).
182 void WriteRealtimeStabilityAttributes(PrefService* pref, 175 void WriteRealtimeStabilityAttributes(base::TimeDelta incremental_uptime,
183 base::TimeDelta incremental_uptime,
184 base::TimeDelta uptime); 176 base::TimeDelta uptime);
185 177
186 // closed_ is true when record has been packed up for sending, and should 178 // closed_ is true when record has been packed up for sending, and should
187 // no longer be written to. It is only used for sanity checking. 179 // no longer be written to. It is only used for sanity checking.
188 bool closed_; 180 bool closed_;
189 181
190 // The type of the log, i.e. initial or ongoing. 182 // The type of the log, i.e. initial or ongoing.
191 const LogType log_type_; 183 const LogType log_type_;
192 184
193 // Stores the protocol buffer representation for this log. 185 // Stores the protocol buffer representation for this log.
194 ChromeUserMetricsExtension uma_proto_; 186 ChromeUserMetricsExtension uma_proto_;
195 187
196 // Used to interact with the embedder. Weak pointer; must outlive |this| 188 // Used to interact with the embedder. Weak pointer; must outlive |this|
197 // instance. 189 // instance.
198 MetricsServiceClient* const client_; 190 MetricsServiceClient* const client_;
199 191
200 // The time when the current log was created. 192 // The time when the current log was created.
201 const base::TimeTicks creation_time_; 193 const base::TimeTicks creation_time_;
202 194
203 PrefService* local_state_; 195 PrefService* local_state_;
204 196
205 DISALLOW_COPY_AND_ASSIGN(MetricsLog); 197 DISALLOW_COPY_AND_ASSIGN(MetricsLog);
206 }; 198 };
207 199
208 } // namespace metrics 200 } // namespace metrics
209 201
210 #endif // COMPONENTS_METRICS_METRICS_LOG_H_ 202 #endif // COMPONENTS_METRICS_METRICS_LOG_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698