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

Side by Side Diff: components/metrics/serialization/metric_sample.cc

Issue 644603002: Cleanup of component/metrics for GN. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: source_set Created 6 years, 2 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
« no previous file with comments | « components/metrics/serialization/metric_sample.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "components/metrics/serialization/metric_sample.h" 5 #include "components/metrics/serialization/metric_sample.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 } else { 67 } else {
68 // The type can only be USER_ACTION. 68 // The type can only be USER_ACTION.
69 CHECK_EQ(type_, USER_ACTION); 69 CHECK_EQ(type_, USER_ACTION);
70 return base::StringPrintf("useraction%c%s%c", 70 return base::StringPrintf("useraction%c%s%c",
71 '\0', 71 '\0',
72 name().c_str(), 72 name().c_str(),
73 '\0'); 73 '\0');
74 } 74 }
75 } 75 }
76 76
77 const int MetricSample::sample() const { 77 int MetricSample::sample() const {
78 CHECK_NE(type_, USER_ACTION); 78 CHECK_NE(type_, USER_ACTION);
79 CHECK_NE(type_, CRASH); 79 CHECK_NE(type_, CRASH);
80 return sample_; 80 return sample_;
81 } 81 }
82 82
83 const int MetricSample::min() const { 83 int MetricSample::min() const {
84 CHECK_EQ(type_, HISTOGRAM); 84 CHECK_EQ(type_, HISTOGRAM);
85 return min_; 85 return min_;
86 } 86 }
87 87
88 const int MetricSample::max() const { 88 int MetricSample::max() const {
89 CHECK_NE(type_, CRASH); 89 CHECK_NE(type_, CRASH);
90 CHECK_NE(type_, USER_ACTION); 90 CHECK_NE(type_, USER_ACTION);
91 CHECK_NE(type_, SPARSE_HISTOGRAM); 91 CHECK_NE(type_, SPARSE_HISTOGRAM);
92 return max_; 92 return max_;
93 } 93 }
94 94
95 const int MetricSample::bucket_count() const { 95 int MetricSample::bucket_count() const {
96 CHECK_EQ(type_, HISTOGRAM); 96 CHECK_EQ(type_, HISTOGRAM);
97 return bucket_count_; 97 return bucket_count_;
98 } 98 }
99 99
100 // static 100 // static
101 scoped_ptr<MetricSample> MetricSample::CrashSample( 101 scoped_ptr<MetricSample> MetricSample::CrashSample(
102 const std::string& crash_name) { 102 const std::string& crash_name) {
103 return scoped_ptr<MetricSample>( 103 return scoped_ptr<MetricSample>(
104 new MetricSample(CRASH, crash_name, 0, 0, 0, 0)); 104 new MetricSample(CRASH, crash_name, 0, 0, 0, 0));
105 } 105 }
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 new MetricSample(USER_ACTION, action_name, 0, 0, 0, 0)); 188 new MetricSample(USER_ACTION, action_name, 0, 0, 0, 0));
189 } 189 }
190 190
191 bool MetricSample::IsEqual(const MetricSample& metric) { 191 bool MetricSample::IsEqual(const MetricSample& metric) {
192 return type_ == metric.type_ && name_ == metric.name_ && 192 return type_ == metric.type_ && name_ == metric.name_ &&
193 sample_ == metric.sample_ && min_ == metric.min_ && 193 sample_ == metric.sample_ && min_ == metric.min_ &&
194 max_ == metric.max_ && bucket_count_ == metric.bucket_count_; 194 max_ == metric.max_ && bucket_count_ == metric.bucket_count_;
195 } 195 }
196 196
197 } // namespace metrics 197 } // namespace metrics
OLDNEW
« no previous file with comments | « components/metrics/serialization/metric_sample.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698