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

Side by Side Diff: base/metrics/sample_vector.h

Issue 11022002: Add SampleMap and use it in SparseHistogram (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 8 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 | Annotate | Revision Log
OLDNEW
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 // SampleVector implements HistogramSamples interface. It is used by all 5 // SampleVector implements HistogramSamples interface. It is used by all
6 // Histogram based classes to store samples. 6 // Histogram based classes to store samples.
7 7
8 #ifndef BASE_METRICS_SAMPLE_VECTOR_H_ 8 #ifndef BASE_METRICS_SAMPLE_VECTOR_H_
9 #define BASE_METRICS_SAMPLE_VECTOR_H_ 9 #define BASE_METRICS_SAMPLE_VECTOR_H_
10 10
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 // Shares the same BucketRanges with Histogram object. 51 // Shares the same BucketRanges with Histogram object.
52 const BucketRanges* const bucket_ranges_; 52 const BucketRanges* const bucket_ranges_;
53 53
54 DISALLOW_COPY_AND_ASSIGN(SampleVector); 54 DISALLOW_COPY_AND_ASSIGN(SampleVector);
55 }; 55 };
56 56
57 class BASE_EXPORT_PRIVATE SampleVectorIterator : public SampleCountIterator { 57 class BASE_EXPORT_PRIVATE SampleVectorIterator : public SampleCountIterator {
58 public: 58 public:
59 SampleVectorIterator(const std::vector<HistogramBase::Count>* counts, 59 SampleVectorIterator(const std::vector<HistogramBase::Count>* counts,
60 const BucketRanges* bucket_ranges); 60 const BucketRanges* bucket_ranges);
61 virtual ~SampleVectorIterator();
61 62
62 // SampleCountIterator implementation: 63 // SampleCountIterator implementation:
63 virtual bool Done() const OVERRIDE; 64 virtual bool Done() const OVERRIDE;
64 virtual void Next() OVERRIDE; 65 virtual void Next() OVERRIDE;
65 virtual void Get(HistogramBase::Sample* min, 66 virtual void Get(HistogramBase::Sample* min,
66 HistogramBase::Sample* max, 67 HistogramBase::Sample* max,
67 HistogramBase::Count* count) const OVERRIDE; 68 HistogramBase::Count* count) const OVERRIDE;
69
70 // SampleVector uses predefined buckets, so iterator can return bucket index.
68 virtual bool GetBucketIndex(size_t* index) const OVERRIDE; 71 virtual bool GetBucketIndex(size_t* index) const OVERRIDE;
69 72
70 private: 73 private:
71 void SkipEmptyBuckets(); 74 void SkipEmptyBuckets();
72 75
73 const std::vector<HistogramBase::Count>* counts_; 76 const std::vector<HistogramBase::Count>* counts_;
74 const BucketRanges* bucket_ranges_; 77 const BucketRanges* bucket_ranges_;
75 78
76 size_t index_; 79 size_t index_;
77 }; 80 };
78 81
79 } // namespace base 82 } // namespace base
80 83
81 #endif // BASE_METRICS_SAMPLE_VECTOR_H_ 84 #endif // BASE_METRICS_SAMPLE_VECTOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698