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 #ifndef COMPONENTS_METRICS_SERIALIZATION_METRIC_SAMPLE_H_ | 5 #ifndef COMPONENTS_METRICS_SERIALIZATION_METRIC_SAMPLE_H_ |
6 #define COMPONENTS_METRICS_SERIALIZATION_METRIC_SAMPLE_H_ | 6 #define COMPONENTS_METRICS_SERIALIZATION_METRIC_SAMPLE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 | 36 |
37 // Getters for type and name. All types of metrics have these so we do not | 37 // Getters for type and name. All types of metrics have these so we do not |
38 // need to check the type. | 38 // need to check the type. |
39 SampleType type() const { return type_; } | 39 SampleType type() const { return type_; } |
40 const std::string& name() const { return name_; } | 40 const std::string& name() const { return name_; } |
41 | 41 |
42 // Getters for sample, min, max, bucket_count. | 42 // Getters for sample, min, max, bucket_count. |
43 // Check the metric type to make sure the request make sense. (ex: a crash | 43 // Check the metric type to make sure the request make sense. (ex: a crash |
44 // sample does not have a bucket_count so we crash if we call bucket_count() | 44 // sample does not have a bucket_count so we crash if we call bucket_count() |
45 // on it.) | 45 // on it.) |
46 const int sample() const; | 46 int sample() const; |
47 const int min() const; | 47 int min() const; |
48 const int max() const; | 48 int max() const; |
49 const int bucket_count() const; | 49 int bucket_count() const; |
50 | 50 |
51 // Returns a serialized version of the sample. | 51 // Returns a serialized version of the sample. |
52 // | 52 // |
53 // The serialized message for each type is: | 53 // The serialized message for each type is: |
54 // crash: crash\0|name_|\0 | 54 // crash: crash\0|name_|\0 |
55 // user action: useraction\0|name_|\0 | 55 // user action: useraction\0|name_|\0 |
56 // histogram: histogram\0|name_| |sample_| |min_| |max_| |bucket_count_|\0 | 56 // histogram: histogram\0|name_| |sample_| |min_| |max_| |bucket_count_|\0 |
57 // sparsehistogram: sparsehistogram\0|name_| |sample_|\0 | 57 // sparsehistogram: sparsehistogram\0|name_| |sample_|\0 |
58 // linearhistogram: linearhistogram\0|name_| |sample_| |max_|\0 | 58 // linearhistogram: linearhistogram\0|name_| |sample_| |max_|\0 |
59 std::string ToString() const; | 59 std::string ToString() const; |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 const int min_; | 110 const int min_; |
111 const int max_; | 111 const int max_; |
112 const int bucket_count_; | 112 const int bucket_count_; |
113 | 113 |
114 DISALLOW_COPY_AND_ASSIGN(MetricSample); | 114 DISALLOW_COPY_AND_ASSIGN(MetricSample); |
115 }; | 115 }; |
116 | 116 |
117 } // namespace metrics | 117 } // namespace metrics |
118 | 118 |
119 #endif // COMPONENTS_METRICS_SERIALIZATION_METRIC_SAMPLE_H_ | 119 #endif // COMPONENTS_METRICS_SERIALIZATION_METRIC_SAMPLE_H_ |
OLD | NEW |