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

Unified Diff: chrome/renderer/renderer_histogram_snapshots.cc

Issue 4174002: Try to detect internal corruption of histogram instances.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 2 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 | « chrome/common/metrics_helpers.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/renderer_histogram_snapshots.cc
===================================================================
--- chrome/renderer/renderer_histogram_snapshots.cc (revision 64486)
+++ chrome/renderer/renderer_histogram_snapshots.cc (working copy)
@@ -52,17 +52,33 @@
sequence_number, pickled_histograms));
}
-// Extract snapshot data and then send it off the the Browser process
-// to save it.
+// Extract snapshot data, remember what we've seen so far, and then send off the
+// delta to the browser.
void RendererHistogramSnapshots::UploadHistrogram(
const Histogram& histogram,
HistogramPickledList* pickled_histograms) {
-
// Get up-to-date snapshot of sample stats.
Histogram::SampleSet snapshot;
histogram.SnapshotSample(&snapshot);
const std::string& histogram_name = histogram.histogram_name();
+ int corruption = histogram.FindCorruption(snapshot);
+ if (corruption) {
+ NOTREACHED();
+ // Don't send corrupt data to the browser.
+ UMA_HISTOGRAM_ENUMERATION("Histogram.InconsistenciesRenderer",
+ corruption, Histogram::NEVER_EXCEEDED_VALUE);
+ typedef std::map<std::string, int> ProblemMap;
+ static ProblemMap* inconsistencies = new ProblemMap;
+ int old_corruption = (*inconsistencies)[histogram_name];
+ if (old_corruption == (corruption | old_corruption))
+ return; // We've already seen this corruption for this histogram.
+ (*inconsistencies)[histogram_name] |= corruption;
+ UMA_HISTOGRAM_ENUMERATION("Histogram.InconsistenciesRendererUnique",
+ corruption, Histogram::NEVER_EXCEEDED_VALUE);
+ return;
+ }
+
// Find the already sent stats, or create an empty set.
LoggedSampleMap::iterator it = logged_samples_.find(histogram_name);
Histogram::SampleSet* already_logged;
@@ -89,7 +105,6 @@
const Histogram& histogram,
const Histogram::SampleSet& snapshot,
HistogramPickledList* pickled_histograms) {
-
DCHECK(0 != snapshot.TotalCount());
snapshot.CheckSize(histogram);
« no previous file with comments | « chrome/common/metrics_helpers.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698