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

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

Issue 11231025: Histogram argument related change (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add missed namespace 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
« no previous file with comments | « base/metrics/histogram_base.h ('k') | base/metrics/sparse_histogram.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #ifndef BASE_METRICS_SPARSE_HISTOGRAM_H_ 5 #ifndef BASE_METRICS_SPARSE_HISTOGRAM_H_
6 #define BASE_METRICS_SPARSE_HISTOGRAM_H_ 6 #define BASE_METRICS_SPARSE_HISTOGRAM_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 10
(...skipping 10 matching lines...) Expand all
21 21
22 class BASE_EXPORT_PRIVATE SparseHistogram : public HistogramBase { 22 class BASE_EXPORT_PRIVATE SparseHistogram : public HistogramBase {
23 public: 23 public:
24 // If there's one with same name, return the existing one. If not, create a 24 // If there's one with same name, return the existing one. If not, create a
25 // new one. 25 // new one.
26 static HistogramBase* FactoryGet(const std::string& name, int32 flags); 26 static HistogramBase* FactoryGet(const std::string& name, int32 flags);
27 27
28 virtual ~SparseHistogram(); 28 virtual ~SparseHistogram();
29 29
30 // HistogramBase implementation: 30 // HistogramBase implementation:
31 virtual bool HasConstructionArguments(Sample minimum,
32 Sample maximum,
33 size_t bucket_count) const OVERRIDE;
31 virtual void Add(Sample value) OVERRIDE; 34 virtual void Add(Sample value) OVERRIDE;
32 virtual void WriteHTMLGraph(std::string* output) const OVERRIDE; 35 virtual void WriteHTMLGraph(std::string* output) const OVERRIDE;
33 virtual void WriteAscii(std::string* output) const OVERRIDE; 36 virtual void WriteAscii(std::string* output) const OVERRIDE;
34
35 virtual scoped_ptr<HistogramSamples> SnapshotSamples() const OVERRIDE; 37 virtual scoped_ptr<HistogramSamples> SnapshotSamples() const OVERRIDE;
36 38
37 private: 39 private:
38 // Clients should always use FactoryGet to create SparseHistogram. 40 // Clients should always use FactoryGet to create SparseHistogram.
39 SparseHistogram(const std::string& name); 41 SparseHistogram(const std::string& name);
40 42
41 virtual void GetParameters(DictionaryValue* params) const OVERRIDE; 43 virtual void GetParameters(DictionaryValue* params) const OVERRIDE;
42 virtual void GetCountAndBucketData(Count* count, 44 virtual void GetCountAndBucketData(Count* count,
43 ListValue* buckets) const OVERRIDE; 45 ListValue* buckets) const OVERRIDE;
44 46
45 friend class SparseHistogramTest; // For constuctor calling. 47 friend class SparseHistogramTest; // For constuctor calling.
46 48
47 // Protects access to |sample_counts_| and |redundant_count_|. 49 // Protects access to |sample_counts_| and |redundant_count_|.
48 mutable base::Lock lock_; 50 mutable base::Lock lock_;
49 std::map<HistogramBase::Sample, HistogramBase::Count> sample_counts_; 51 std::map<HistogramBase::Sample, HistogramBase::Count> sample_counts_;
50 HistogramBase::Count redundant_count_; 52 HistogramBase::Count redundant_count_;
51 53
52 DISALLOW_COPY_AND_ASSIGN(SparseHistogram); 54 DISALLOW_COPY_AND_ASSIGN(SparseHistogram);
53 }; 55 };
54 56
55 } // namespace base 57 } // namespace base
56 58
57 #endif // BASE_METRICS_SPARSE_HISTOGRAM_H_ 59 #endif // BASE_METRICS_SPARSE_HISTOGRAM_H_
OLDNEW
« no previous file with comments | « base/metrics/histogram_base.h ('k') | base/metrics/sparse_histogram.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698