OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // BucketRanges stores the vector of ranges that delimit what samples are | 5 // BucketRanges stores the vector of ranges that delimit what samples are |
6 // tallied in the corresponding buckets of a histogram. Histograms that have | 6 // tallied in the corresponding buckets of a histogram. Histograms that have |
7 // same ranges for all their corresponding buckets should share the same | 7 // same ranges for all their corresponding buckets should share the same |
8 // BucketRanges object. | 8 // BucketRanges object. |
9 // | 9 // |
10 // E.g. A 5 buckets LinearHistogram with 1 as minimal value and 4 as maximal | 10 // E.g. A 5 buckets LinearHistogram with 1 as minimal value and 4 as maximal |
(...skipping 12 matching lines...) Expand all Loading... |
23 #include "base/basictypes.h" | 23 #include "base/basictypes.h" |
24 #include "base/gtest_prod_util.h" | 24 #include "base/gtest_prod_util.h" |
25 #include "base/metrics/histogram_base.h" | 25 #include "base/metrics/histogram_base.h" |
26 | 26 |
27 namespace base { | 27 namespace base { |
28 | 28 |
29 class BASE_EXPORT BucketRanges { | 29 class BASE_EXPORT BucketRanges { |
30 public: | 30 public: |
31 typedef std::vector<HistogramBase::Sample> Ranges; | 31 typedef std::vector<HistogramBase::Sample> Ranges; |
32 | 32 |
33 BucketRanges(size_t num_ranges); | 33 explicit BucketRanges(size_t num_ranges); |
34 ~BucketRanges(); | 34 ~BucketRanges(); |
35 | 35 |
36 size_t size() const { return ranges_.size(); } | 36 size_t size() const { return ranges_.size(); } |
37 HistogramBase::Sample range(size_t i) const { return ranges_[i]; } | 37 HistogramBase::Sample range(size_t i) const { return ranges_[i]; } |
38 void set_range(size_t i, HistogramBase::Sample value); | 38 void set_range(size_t i, HistogramBase::Sample value); |
39 uint32 checksum() const { return checksum_; } | 39 uint32 checksum() const { return checksum_; } |
40 void set_checksum(uint32 checksum) { checksum_ = checksum; } | 40 void set_checksum(uint32 checksum) { checksum_ = checksum; } |
41 | 41 |
42 // Checksum methods to verify whether the ranges are corrupted (e.g. bad | 42 // Checksum methods to verify whether the ranges are corrupted (e.g. bad |
43 // memory access). | 43 // memory access). |
(...skipping 20 matching lines...) Expand all Loading... |
64 DISALLOW_COPY_AND_ASSIGN(BucketRanges); | 64 DISALLOW_COPY_AND_ASSIGN(BucketRanges); |
65 }; | 65 }; |
66 | 66 |
67 ////////////////////////////////////////////////////////////////////////////// | 67 ////////////////////////////////////////////////////////////////////////////// |
68 // Expose only for test. | 68 // Expose only for test. |
69 BASE_EXPORT_PRIVATE extern const uint32 kCrcTable[256]; | 69 BASE_EXPORT_PRIVATE extern const uint32 kCrcTable[256]; |
70 | 70 |
71 } // namespace base | 71 } // namespace base |
72 | 72 |
73 #endif // BASE_METRICS_BUCKET_RANGES_H_ | 73 #endif // BASE_METRICS_BUCKET_RANGES_H_ |
OLD | NEW |