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 #include "components/metrics/metrics_log_base.h" | 5 #include "components/metrics/metrics_log_base.h" |
6 | 6 |
7 #include "base/metrics/histogram_base.h" | 7 #include "base/metrics/histogram_base.h" |
8 #include "base/metrics/histogram_samples.h" | 8 #include "base/metrics/histogram_samples.h" |
9 #include "components/metrics/metrics_hashes.h" | 9 #include "components/metrics/metrics_hashes.h" |
10 #include "components/metrics/proto/histogram_event.pb.h" | 10 #include "components/metrics/proto/histogram_event.pb.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 } | 30 } |
31 | 31 |
32 } // namespace | 32 } // namespace |
33 | 33 |
34 MetricsLogBase::MetricsLogBase(const std::string& client_id, | 34 MetricsLogBase::MetricsLogBase(const std::string& client_id, |
35 int session_id, | 35 int session_id, |
36 LogType log_type, | 36 LogType log_type, |
37 const std::string& version_string) | 37 const std::string& version_string) |
38 : locked_(false), | 38 : locked_(false), |
39 log_type_(log_type) { | 39 log_type_(log_type) { |
40 DCHECK_NE(NO_LOG, log_type); | |
41 if (IsTestingID(client_id)) | 40 if (IsTestingID(client_id)) |
42 uma_proto_.set_client_id(0); | 41 uma_proto_.set_client_id(0); |
43 else | 42 else |
44 uma_proto_.set_client_id(Hash(client_id)); | 43 uma_proto_.set_client_id(Hash(client_id)); |
45 | 44 |
46 uma_proto_.set_session_id(session_id); | 45 uma_proto_.set_session_id(session_id); |
47 uma_proto_.mutable_system_profile()->set_build_timestamp(GetBuildTime()); | 46 uma_proto_.mutable_system_profile()->set_build_timestamp(GetBuildTime()); |
48 uma_proto_.mutable_system_profile()->set_app_version(version_string); | 47 uma_proto_.mutable_system_profile()->set_app_version(version_string); |
49 } | 48 } |
50 | 49 |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 if (i + 1 < histogram_proto->bucket_size() && | 129 if (i + 1 < histogram_proto->bucket_size() && |
131 bucket->max() == histogram_proto->bucket(i + 1).min()) { | 130 bucket->max() == histogram_proto->bucket(i + 1).min()) { |
132 bucket->clear_max(); | 131 bucket->clear_max(); |
133 } else if (bucket->max() == bucket->min() + 1) { | 132 } else if (bucket->max() == bucket->min() + 1) { |
134 bucket->clear_min(); | 133 bucket->clear_min(); |
135 } | 134 } |
136 } | 135 } |
137 } | 136 } |
138 | 137 |
139 } // namespace metrics | 138 } // namespace metrics |
OLD | NEW |