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

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: extra parameter no longer necessary in some files 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 1bbcab7023a8be9e45e3ca72fb631abee31ef4a6..5e24e005fabb23560870e6c8914859d263553ef4 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;
}
@@ -297,6 +302,7 @@ scoped_ptr<HistogramSamples> Histogram::SnapshotSamples() const {
}
void Histogram::AddSamples(const HistogramSamples& samples) {
+ DCHECK(samples.id() == 0 || samples.id() == samples_->id());
Alexei Svitkine (slow) 2015/12/01 16:32:14 This seems to be adding an implicit requirement to
bcwhite 2015/12/01 18:12:15 I always imagined that "id" (if present, that is n
Alexei Svitkine (slow) 2015/12/01 18:27:14 Well, my mental model is this method is just "add
bcwhite 2015/12/01 19:33:44 Okay, I can move the DCHECK no problem.
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(HashMetricName(name), ranges));
}
Histogram::~Histogram() {
@@ -392,7 +398,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(HashMetricName(histogram_name()), bucket_ranges()));
Alexei Svitkine (slow) 2015/12/01 16:32:14 Can this use the id from samples_ instead of re-co
bcwhite 2015/12/01 18:12:15 Done.
Alexei Svitkine (slow) 2015/12/01 18:27:14 Doesn't seem like you uploaded a new patch set?
bcwhite 2015/12/01 19:33:44 Not yet. So far all the changes have been cosmeti
samples->Add(*samples_);
return samples;
}

Powered by Google App Engine
This is Rietveld 408576698