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

Unified Diff: base/metrics/sparse_histogram.h

Issue 1734033003: Add support for persistent sparse histograms. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased Created 4 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/metrics/sample_map.cc ('k') | base/metrics/sparse_histogram.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/metrics/sparse_histogram.h
diff --git a/base/metrics/sparse_histogram.h b/base/metrics/sparse_histogram.h
index 7f363133802a0219f6ca3f029d53e4ae8101b881..b8767377ab167187cbfca354030afaa66153e0b2 100644
--- a/base/metrics/sparse_histogram.h
+++ b/base/metrics/sparse_histogram.h
@@ -51,6 +51,7 @@ namespace base {
} while (0)
class HistogramSamples;
+class PersistentMemoryAllocator;
class BASE_EXPORT SparseHistogram : public HistogramBase {
public:
@@ -58,6 +59,13 @@ class BASE_EXPORT SparseHistogram : public HistogramBase {
// new one.
static HistogramBase* FactoryGet(const std::string& name, int32_t flags);
+ // Create a histogram using data in persistent storage.
+ static scoped_ptr<HistogramBase> PersistentCreate(
+ PersistentMemoryAllocator* allocator,
+ const std::string& name,
+ HistogramSamples::Metadata* meta,
+ HistogramSamples::Metadata* logged_meta);
+
~SparseHistogram() override;
// HistogramBase implementation:
@@ -83,6 +91,11 @@ class BASE_EXPORT SparseHistogram : public HistogramBase {
// Clients should always use FactoryGet to create SparseHistogram.
explicit SparseHistogram(const std::string& name);
+ SparseHistogram(PersistentMemoryAllocator* allocator,
+ const std::string& name,
+ HistogramSamples::Metadata* meta,
+ HistogramSamples::Metadata* logged_meta);
+
friend BASE_EXPORT HistogramBase* DeserializeHistogramInfo(
base::PickleIterator* iter);
static HistogramBase* DeserializeInfoImpl(base::PickleIterator* iter);
@@ -107,8 +120,8 @@ class BASE_EXPORT SparseHistogram : public HistogramBase {
// Protects access to |samples_|.
mutable base::Lock lock_;
- SampleMap samples_;
- SampleMap logged_samples_;
+ scoped_ptr<HistogramSamples> samples_;
+ scoped_ptr<HistogramSamples> logged_samples_;
DISALLOW_COPY_AND_ASSIGN(SparseHistogram);
};
« no previous file with comments | « base/metrics/sample_map.cc ('k') | base/metrics/sparse_histogram.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698