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

Unified Diff: base/metrics/statistics_recorder.cc

Issue 1719363002: Collect information about failing histogram factory calls. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased Created 4 years, 9 months 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/statistics_recorder.cc
diff --git a/base/metrics/statistics_recorder.cc b/base/metrics/statistics_recorder.cc
index 2bb50ad3a33da3117475170fbefe152814c3e3e4..50c4836cbc05a8977c4ae54a37843e64de3a9d70 100644
--- a/base/metrics/statistics_recorder.cc
+++ b/base/metrics/statistics_recorder.cc
@@ -5,6 +5,7 @@
#include "base/metrics/statistics_recorder.h"
#include "base/at_exit.h"
+#include "base/debug/alias.h"
#include "base/debug/leak_annotations.h"
#include "base/json/string_escape.h"
#include "base/logging.h"
@@ -132,13 +133,17 @@ HistogramBase* StatisticsRecorder::RegisterOrDeleteDuplicate(
histogram_to_return = histogram;
} else {
// We already have one histogram with this name.
- DCHECK_EQ(histogram->histogram_name(),
- it->second->histogram_name()) << "hash collision";
+ CHECK_EQ(histogram->histogram_name(),
+ it->second->histogram_name()) << "hash collision";
histogram_to_return = it->second;
histogram_to_delete = histogram;
}
+ base::debug::Alias(&it);
+ base::debug::Alias(&name);
+ base::debug::Alias(&name_hash);
}
}
+ base::debug::Alias(&histogram);
delete histogram_to_delete;
return histogram_to_return;
}
@@ -288,10 +293,22 @@ HistogramBase* StatisticsRecorder::FindHistogram(base::StringPiece name) {
if (histograms_ == NULL)
return NULL;
- HistogramMap::iterator it = histograms_->find(HashMetricName(name));
+ const uint64_t lookup_hash = HashMetricName(name);
+ HistogramMap::iterator it = histograms_->find(lookup_hash);
if (histograms_->end() == it)
return NULL;
- DCHECK_EQ(name, it->second->histogram_name()) << "hash collision";
+
+ const uint64_t existing_hash = it->first;
+ const char* existing_name = it->second->histogram_name().c_str();
+ HistogramMap* histograms = histograms_;
+ CHECK_EQ(name, it->second->histogram_name()) << "hash collision";
+ base::debug::Alias(&lookup_hash);
+ base::debug::Alias(&existing_hash);
+ base::debug::Alias(&name);
+ base::debug::Alias(&existing_name);
+ base::debug::Alias(&it);
+ base::debug::Alias(&histograms);
+
return it->second;
}
« no previous file with comments | « base/metrics/persistent_histogram_allocator.cc ('k') | chrome/browser/extensions/api/metrics_private/metrics_apitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698