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

Unified Diff: base/metrics/histogram_snapshot_manager.cc

Issue 1471073007: Reorganize histograms for persistence. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@shmem-alloc
Patch Set: addressed some 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
Index: base/metrics/histogram_snapshot_manager.cc
diff --git a/base/metrics/histogram_snapshot_manager.cc b/base/metrics/histogram_snapshot_manager.cc
index a7605aa14179ac6b89a747a201fe0b285eb6dd2d..0b3e9a4550c978c37852a7c2dd5e3539e7f38c14 100644
--- a/base/metrics/histogram_snapshot_manager.cc
+++ b/base/metrics/histogram_snapshot_manager.cc
@@ -42,6 +42,7 @@ void HistogramSnapshotManager::PrepareDelta(const HistogramBase& histogram) {
// Get up-to-date snapshot of sample stats.
scoped_ptr<HistogramSamples> snapshot(histogram.SnapshotSamples());
const std::string& histogram_name = histogram.histogram_name();
Alexei Svitkine (slow) 2015/12/04 18:21:00 Inline this into the DLOG(ERROR) since that's the
bcwhite 2015/12/04 19:34:46 Done.
+ const uint64_t histogram_id = histogram.name_hash();
Alexei Svitkine (slow) 2015/12/04 18:21:00 Nit: Move this closer to where it's first used - i
bcwhite 2015/12/04 19:34:47 Done.
int corruption = histogram.FindCorruption(*snapshot);
@@ -65,23 +66,23 @@ void HistogramSnapshotManager::PrepareDelta(const HistogramBase& histogram) {
histogram_flattener_->InconsistencyDetected(
static_cast<HistogramBase::Inconsistency>(corruption));
// Don't record corrupt data to metrics services.
- int old_corruption = inconsistencies_[histogram_name];
+ int old_corruption = inconsistencies_[histogram_id];
if (old_corruption == (corruption | old_corruption))
return; // We've already seen this corruption for this histogram.
- inconsistencies_[histogram_name] |= corruption;
+ inconsistencies_[histogram_id] |= corruption;
histogram_flattener_->UniqueInconsistencyDetected(
static_cast<HistogramBase::Inconsistency>(corruption));
return;
}
HistogramSamples* to_log;
- std::map<std::string, HistogramSamples*>::iterator it =
- logged_samples_.find(histogram_name);
+ std::map<uint64_t, HistogramSamples*>::iterator it =
+ logged_samples_.find(histogram_id);
Alexei Svitkine (slow) 2015/12/04 18:21:00 nit: auto it =
bcwhite 2015/12/04 19:34:47 Done.
if (it == logged_samples_.end()) {
to_log = snapshot.release();
// This histogram has not been logged before, add a new entry.
- logged_samples_[histogram_name] = to_log;
+ logged_samples_[histogram_id] = to_log;
} else {
HistogramSamples* already_logged = it->second;
InspectLoggedSamplesInconsistency(*snapshot, already_logged);

Powered by Google App Engine
This is Rietveld 408576698