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

Unified Diff: base/metrics/histogram_persistence.cc

Issue 1693463003: Track number of instances with a corrupt allocator. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/metrics/histogram_persistence.cc
diff --git a/base/metrics/histogram_persistence.cc b/base/metrics/histogram_persistence.cc
index 7c60079ef9ced823ea06d16470e5ff14780ed7a4..a036787a2ee0a1fe2195f07a5225e04a3e3e4794 100644
--- a/base/metrics/histogram_persistence.cc
+++ b/base/metrics/histogram_persistence.cc
@@ -46,6 +46,9 @@ enum CreateHistogramResultType {
// Histogram was of unknown type.
CREATE_HISTOGRAM_UNKNOWN_TYPE,
+ // Instance has detected a corrupt allocator (recorded only once).
+ CREATE_HISTOGRAM_ALLOCATOR_NEWLY_CORRUPT,
+
// Always keep this at the end.
CREATE_HISTOGRAM_MAX
};
@@ -342,6 +345,15 @@ HistogramBase* AllocatePersistentHistogram(
if (!allocator)
return nullptr;
+ // If the allocator is corrupt, don't waste time trying anything else.
+ // This also allows differentiating on the dashboard between allocations
+ // failed due to a corrupt allocator and the number of process instances
+ // with one, the latter being idicated by "newly corrupt", below.
+ if (allocator->IsCorrupt()) {
+ RecordCreateHistogramResult(CREATE_HISTOGRAM_ALLOCATOR_CORRUPT);
+ return nullptr;
+ }
+
size_t bucket_count = bucket_ranges->bucket_count();
// An overflow such as this, perhaps as the result of a milicious actor,
// could lead to writing beyond the allocation boundary and into other
@@ -400,6 +412,7 @@ HistogramBase* AllocatePersistentHistogram(
CreateHistogramResultType result;
if (allocator->IsCorrupt()) {
+ RecordCreateHistogramResult(CREATE_HISTOGRAM_ALLOCATOR_NEWLY_CORRUPT);
result = CREATE_HISTOGRAM_ALLOCATOR_CORRUPT;
} else if (allocator->IsFull()) {
result = CREATE_HISTOGRAM_ALLOCATOR_FULL;
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698