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

Unified Diff: base/metrics/histogram.cc

Issue 1471073007: Reorganize histograms for persistence. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@shmem-alloc
Patch Set: added GN changes Created 5 years, 1 month 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
Index: base/metrics/histogram.cc
diff --git a/base/metrics/histogram.cc b/base/metrics/histogram.cc
index b37bc4c4685c5476c9145a81bb953ddfbc2532d5..8913471f6c86b2165e48367fa94e9cde8ef5f943 100644
--- a/base/metrics/histogram.cc
+++ b/base/metrics/histogram.cc
@@ -18,6 +18,7 @@
#include "base/debug/alias.h"
#include "base/logging.h"
#include "base/metrics/histogram_macros.h"
+#include "base/metrics/metrics_hashes.h"
#include "base/metrics/sample_vector.h"
#include "base/metrics/statistics_recorder.h"
#include "base/pickle.h"
@@ -259,6 +260,10 @@ bool Histogram::InspectConstructionArguments(const std::string& name,
return true;
}
+uint64_t Histogram::id() const {
+ return samples_->id();
+}
+
HistogramType Histogram::GetHistogramType() const {
return HISTOGRAM;
}
@@ -297,6 +302,7 @@ scoped_ptr<HistogramSamples> Histogram::SnapshotSamples() const {
}
void Histogram::AddSamples(const HistogramSamples& samples) {
+ DCHECK(samples.id() == 0 || samples.id() == samples_->id());
samples_->Add(samples);
}
@@ -335,7 +341,7 @@ Histogram::Histogram(const std::string& name,
declared_min_(minimum),
declared_max_(maximum) {
if (ranges)
- samples_.reset(new SampleVector(ranges));
+ samples_.reset(new SampleVector(metrics::HashMetricName(name), ranges));
}
Histogram::~Histogram() {
@@ -392,7 +398,9 @@ HistogramBase* Histogram::DeserializeInfoImpl(PickleIterator* iter) {
}
scoped_ptr<SampleVector> Histogram::SnapshotSampleVector() const {
- scoped_ptr<SampleVector> samples(new SampleVector(bucket_ranges()));
+ scoped_ptr<SampleVector> samples(
+ new SampleVector(metrics::HashMetricName(histogram_name()),
+ bucket_ranges()));
samples->Add(*samples_);
return samples.Pass();
}

Powered by Google App Engine
This is Rietveld 408576698