| 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 |
| 11 // value will need a BucketRanges with 6 ranges: | 11 // value will need a BucketRanges with 6 ranges: |
| 12 // 0, 1, 2, 3, 4, INT_MAX | 12 // 0, 1, 2, 3, 4, INT_MAX |
| 13 // | 13 // |
| 14 // TODO(kaiwang): Currently we keep all negative values in 0~1 bucket. Consider | 14 // TODO(kaiwang): Currently we keep all negative values in 0~1 bucket. Consider |
| 15 // changing 0 to INT_MIN. | 15 // changing 0 to INT_MIN. |
| 16 | 16 |
| 17 #ifndef BASE_METRICS_BUCKET_RANGES_H_ | 17 #ifndef BASE_METRICS_BUCKET_RANGES_H_ |
| 18 #define BASE_METRICS_BUCKET_RANGES_H_ | 18 #define BASE_METRICS_BUCKET_RANGES_H_ |
| 19 | 19 |
| 20 #include <vector> | 20 #include <vector> |
| 21 | 21 |
| 22 #include "base/base_export.h" | 22 #include "base/base_export.h" |
| 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_PRIVATE 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 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_; } |
| (...skipping 24 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 |