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

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: addressed review comments by Alexei Created 5 years 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/histogram.h ('k') | base/metrics/histogram_base.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/metrics/histogram.cc
diff --git a/base/metrics/histogram.cc b/base/metrics/histogram.cc
index 1bbcab7023a8be9e45e3ca72fb631abee31ef4a6..083856bf87618379a964eb2095aa6cae4d7039c1 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::name_hash() const {
+ return samples_->id();
+}
+
HistogramType Histogram::GetHistogramType() const {
return HISTOGRAM;
}
@@ -335,7 +340,7 @@ Histogram::Histogram(const std::string& name,
declared_min_(minimum),
declared_max_(maximum) {
if (ranges)
- samples_.reset(new SampleVector(ranges));
+ samples_.reset(new SampleVector(HashMetricName(name), ranges));
}
Histogram::~Histogram() {
@@ -392,7 +397,8 @@ 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(samples_->id(), bucket_ranges()));
samples->Add(*samples_);
return samples;
}
« no previous file with comments | « base/metrics/histogram.h ('k') | base/metrics/histogram_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698