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

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

Issue 1891913002: Support saving browser metrics to disk and reading them during next run. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: removed some unnecessary includes Created 4 years, 7 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_memory_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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 HistogramType GetHistogramType() const override; 74 HistogramType GetHistogramType() const override;
75 bool HasConstructionArguments(Sample expected_minimum, 75 bool HasConstructionArguments(Sample expected_minimum,
76 Sample expected_maximum, 76 Sample expected_maximum,
77 uint32_t expected_bucket_count) const override; 77 uint32_t expected_bucket_count) const override;
78 void Add(Sample value) override; 78 void Add(Sample value) override;
79 void AddCount(Sample value, int count) override; 79 void AddCount(Sample value, int count) override;
80 void AddSamples(const HistogramSamples& samples) override; 80 void AddSamples(const HistogramSamples& samples) override;
81 bool AddSamplesFromPickle(base::PickleIterator* iter) override; 81 bool AddSamplesFromPickle(base::PickleIterator* iter) override;
82 std::unique_ptr<HistogramSamples> SnapshotSamples() const override; 82 std::unique_ptr<HistogramSamples> SnapshotSamples() const override;
83 std::unique_ptr<HistogramSamples> SnapshotDelta() override; 83 std::unique_ptr<HistogramSamples> SnapshotDelta() override;
84 std::unique_ptr<HistogramSamples> SnapshotFinalDelta() const override;
84 void WriteHTMLGraph(std::string* output) const override; 85 void WriteHTMLGraph(std::string* output) const override;
85 void WriteAscii(std::string* output) const override; 86 void WriteAscii(std::string* output) const override;
86 87
87 protected: 88 protected:
88 // HistogramBase implementation: 89 // HistogramBase implementation:
89 bool SerializeInfoImpl(base::Pickle* pickle) const override; 90 bool SerializeInfoImpl(base::Pickle* pickle) const override;
90 91
91 private: 92 private:
92 // Clients should always use FactoryGet to create SparseHistogram. 93 // Clients should always use FactoryGet to create SparseHistogram.
93 explicit SparseHistogram(const std::string& name); 94 explicit SparseHistogram(const std::string& name);
(...skipping 20 matching lines...) Expand all
114 // Write a common header message describing this histogram. 115 // Write a common header message describing this histogram.
115 void WriteAsciiHeader(const Count total_count, 116 void WriteAsciiHeader(const Count total_count,
116 std::string* output) const; 117 std::string* output) const;
117 118
118 // For constuctor calling. 119 // For constuctor calling.
119 friend class SparseHistogramTest; 120 friend class SparseHistogramTest;
120 121
121 // Protects access to |samples_|. 122 // Protects access to |samples_|.
122 mutable base::Lock lock_; 123 mutable base::Lock lock_;
123 124
125 // Flag to indicate if PrepareFinalDelta has been previously called.
126 mutable bool final_delta_created_ = false;
127
124 std::unique_ptr<HistogramSamples> samples_; 128 std::unique_ptr<HistogramSamples> samples_;
125 std::unique_ptr<HistogramSamples> logged_samples_; 129 std::unique_ptr<HistogramSamples> logged_samples_;
126 130
127 DISALLOW_COPY_AND_ASSIGN(SparseHistogram); 131 DISALLOW_COPY_AND_ASSIGN(SparseHistogram);
128 }; 132 };
129 133
130 } // namespace base 134 } // namespace base
131 135
132 #endif // BASE_METRICS_SPARSE_HISTOGRAM_H_ 136 #endif // BASE_METRICS_SPARSE_HISTOGRAM_H_
OLDNEW
« no previous file with comments | « base/metrics/persistent_memory_allocator.cc ('k') | base/metrics/sparse_histogram.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698