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

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

Issue 2973863002: Remove std::string histogram name from HistogramBase object.
Patch Set: rebased Created 3 years, 3 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
« no previous file with comments | « base/metrics/persistent_histogram_allocator.cc ('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 <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 17 matching lines...) Expand all
28 class BASE_EXPORT SparseHistogram : public HistogramBase { 28 class BASE_EXPORT SparseHistogram : public HistogramBase {
29 public: 29 public:
30 // If there's one with same name, return the existing one. If not, create a 30 // If there's one with same name, return the existing one. If not, create a
31 // new one. 31 // new one.
32 static HistogramBase* FactoryGet(const std::string& name, int32_t flags); 32 static HistogramBase* FactoryGet(const std::string& name, int32_t flags);
33 33
34 // Create a histogram using data in persistent storage. The allocator must 34 // Create a histogram using data in persistent storage. The allocator must
35 // live longer than the created sparse histogram. 35 // live longer than the created sparse histogram.
36 static std::unique_ptr<HistogramBase> PersistentCreate( 36 static std::unique_ptr<HistogramBase> PersistentCreate(
37 PersistentHistogramAllocator* allocator, 37 PersistentHistogramAllocator* allocator,
38 const std::string& name, 38 const char* name,
39 HistogramSamples::Metadata* meta, 39 HistogramSamples::Metadata* meta,
40 HistogramSamples::Metadata* logged_meta); 40 HistogramSamples::Metadata* logged_meta);
41 41
42 ~SparseHistogram() override; 42 ~SparseHistogram() override;
43 43
44 // HistogramBase implementation: 44 // HistogramBase implementation:
45 uint64_t name_hash() const override; 45 uint64_t name_hash() const override;
46 HistogramType GetHistogramType() const override; 46 HistogramType GetHistogramType() const override;
47 bool HasConstructionArguments(Sample expected_minimum, 47 bool HasConstructionArguments(Sample expected_minimum,
48 Sample expected_maximum, 48 Sample expected_maximum,
49 uint32_t expected_bucket_count) const override; 49 uint32_t expected_bucket_count) const override;
50 void Add(Sample value) override; 50 void Add(Sample value) override;
51 void AddCount(Sample value, int count) override; 51 void AddCount(Sample value, int count) override;
52 void AddSamples(const HistogramSamples& samples) override; 52 void AddSamples(const HistogramSamples& samples) override;
53 bool AddSamplesFromPickle(base::PickleIterator* iter) override; 53 bool AddSamplesFromPickle(base::PickleIterator* iter) override;
54 std::unique_ptr<HistogramSamples> SnapshotSamples() const override; 54 std::unique_ptr<HistogramSamples> SnapshotSamples() const override;
55 std::unique_ptr<HistogramSamples> SnapshotDelta() override; 55 std::unique_ptr<HistogramSamples> SnapshotDelta() override;
56 std::unique_ptr<HistogramSamples> SnapshotFinalDelta() const override; 56 std::unique_ptr<HistogramSamples> SnapshotFinalDelta() const override;
57 void WriteHTMLGraph(std::string* output) const override; 57 void WriteHTMLGraph(std::string* output) const override;
58 void WriteAscii(std::string* output) const override; 58 void WriteAscii(std::string* output) const override;
59 59
60 protected: 60 protected:
61 // HistogramBase implementation: 61 // HistogramBase implementation:
62 bool SerializeInfoImpl(base::Pickle* pickle) const override; 62 bool SerializeInfoImpl(base::Pickle* pickle) const override;
63 63
64 private: 64 private:
65 // Clients should always use FactoryGet to create SparseHistogram. 65 // Clients should always use FactoryGet to create SparseHistogram.
66 explicit SparseHistogram(const std::string& name); 66 explicit SparseHistogram(const char* name);
67 67
68 SparseHistogram(PersistentHistogramAllocator* allocator, 68 SparseHistogram(PersistentHistogramAllocator* allocator,
69 const std::string& name, 69 const char* name,
70 HistogramSamples::Metadata* meta, 70 HistogramSamples::Metadata* meta,
71 HistogramSamples::Metadata* logged_meta); 71 HistogramSamples::Metadata* logged_meta);
72 72
73 friend BASE_EXPORT HistogramBase* DeserializeHistogramInfo( 73 friend BASE_EXPORT HistogramBase* DeserializeHistogramInfo(
74 base::PickleIterator* iter); 74 base::PickleIterator* iter);
75 static HistogramBase* DeserializeInfoImpl(base::PickleIterator* iter); 75 static HistogramBase* DeserializeInfoImpl(base::PickleIterator* iter);
76 76
77 void GetParameters(DictionaryValue* params) const override; 77 void GetParameters(DictionaryValue* params) const override;
78 void GetCountAndBucketData(Count* count, 78 void GetCountAndBucketData(Count* count,
79 int64_t* sum, 79 int64_t* sum,
(...skipping 19 matching lines...) Expand all
99 99
100 std::unique_ptr<HistogramSamples> unlogged_samples_; 100 std::unique_ptr<HistogramSamples> unlogged_samples_;
101 std::unique_ptr<HistogramSamples> logged_samples_; 101 std::unique_ptr<HistogramSamples> logged_samples_;
102 102
103 DISALLOW_COPY_AND_ASSIGN(SparseHistogram); 103 DISALLOW_COPY_AND_ASSIGN(SparseHistogram);
104 }; 104 };
105 105
106 } // namespace base 106 } // namespace base
107 107
108 #endif // BASE_METRICS_SPARSE_HISTOGRAM_H_ 108 #endif // BASE_METRICS_SPARSE_HISTOGRAM_H_
OLDNEW
« no previous file with comments | « base/metrics/persistent_histogram_allocator.cc ('k') | base/metrics/sparse_histogram.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698