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(); |
} |