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

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

Issue 1425533011: Support "shared" histograms between processes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@shmem-alloc
Patch Set: added a couple tests (and fixed related issues) Created 5 years 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
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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 43
44 protected: 44 protected:
45 bool AddSubtractImpl( 45 bool AddSubtractImpl(
46 SampleCountIterator* iter, 46 SampleCountIterator* iter,
47 HistogramSamples::Operator op) override; // |op| is ADD or SUBTRACT. 47 HistogramSamples::Operator op) override; // |op| is ADD or SUBTRACT.
48 48
49 virtual size_t GetBucketIndex(HistogramBase::Sample value) const; 49 virtual size_t GetBucketIndex(HistogramBase::Sample value) const;
50 50
51 private: 51 private:
52 FRIEND_TEST_ALL_PREFIXES(HistogramTest, CorruptSampleCounts); 52 FRIEND_TEST_ALL_PREFIXES(HistogramTest, CorruptSampleCounts);
53 FRIEND_TEST_ALL_PREFIXES(SharedHistogramTest, CorruptSampleCounts);
53 54
54 // In the case where this class manages the memory, here it is. 55 // In the case where this class manages the memory, here it is.
55 std::vector<HistogramBase::AtomicCount> local_counts_; 56 std::vector<HistogramBase::AtomicCount> local_counts_;
56 57
57 // These are raw pointers rather than objects for flexibility. The actual 58 // These are raw pointers rather than objects for flexibility. The actual
58 // memory is either managed by local_counts_ above or by an external object 59 // memory is either managed by local_counts_ above or by an external object
59 // and passed in directly. 60 // and passed in directly.
60 HistogramBase::AtomicCount* counts_; 61 HistogramBase::AtomicCount* counts_;
61 size_t counts_size_; 62 size_t counts_size_;
62 63
(...skipping 28 matching lines...) Expand all
91 const HistogramBase::AtomicCount* counts_; 92 const HistogramBase::AtomicCount* counts_;
92 size_t counts_size_; 93 size_t counts_size_;
93 const BucketRanges* bucket_ranges_; 94 const BucketRanges* bucket_ranges_;
94 95
95 size_t index_; 96 size_t index_;
96 }; 97 };
97 98
98 } // namespace base 99 } // namespace base
99 100
100 #endif // BASE_METRICS_SAMPLE_VECTOR_H_ 101 #endif // BASE_METRICS_SAMPLE_VECTOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698