summaryrefslogtreecommitdiffstats
path: root/chrome/renderer/renderer_histogram_snapshots.h
diff options
context:
space:
mode:
authorjar@chromium.org <jar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-10 17:03:55 +0000
committerjar@chromium.org <jar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-10 17:03:55 +0000
commitbb007d4da961915d7e0b4c70c369a03d0f36c3db (patch)
tree4c2e27e2b09898df89bebd3a8ab7067afc7ae4ba /chrome/renderer/renderer_histogram_snapshots.h
parent6dc910cce4694950c3e29275d0eb733d7abfc749 (diff)
downloadchromium_src-bb007d4da961915d7e0b4c70c369a03d0f36c3db.zip
chromium_src-bb007d4da961915d7e0b4c70c369a03d0f36c3db.tar.gz
chromium_src-bb007d4da961915d7e0b4c70c369a03d0f36c3db.tar.bz2
Detect corruption of previous snapshots in histograms
Having verified that histograms can be corrupted by random memory smashers (or DRAM problems), this CL looks at one last example of histograms that are at rest for an extended period of time, and hence vulnerable. Between each UMA upload, we save snapshots of the data we've already sent, so that we can just send "new samples." If those snapshots are corrupted, the noise would be directly injected into the UMA uploads. This CL checks for consistency in those snapshots, and if there is any inconsistency, it skips over the recent changes (since it has no baseline). Since the code to do this was getting larger, I factored it out a bit. The hassle is that I wanted to keep separate records of corruption in the renderer vs browser, which complicates the factoring a bit. BUG=61281 r=mbelshe Review URL: http://codereview.chromium.org/4733002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@65675 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/renderer_histogram_snapshots.h')
-rw-r--r--chrome/renderer/renderer_histogram_snapshots.h23
1 files changed, 13 insertions, 10 deletions
diff --git a/chrome/renderer/renderer_histogram_snapshots.h b/chrome/renderer/renderer_histogram_snapshots.h
index eff6f3e..5155b6f 100644
--- a/chrome/renderer/renderer_histogram_snapshots.h
+++ b/chrome/renderer/renderer_histogram_snapshots.h
@@ -14,8 +14,9 @@
#include "base/metrics/histogram.h"
#include "base/process.h"
#include "base/task.h"
+#include "chrome/common/metrics_helpers.h"
-class RendererHistogramSnapshots {
+class RendererHistogramSnapshots : public HistogramSender {
public:
RendererHistogramSnapshots();
~RendererHistogramSnapshots();
@@ -23,26 +24,28 @@ class RendererHistogramSnapshots {
// Send the histogram data.
void SendHistograms(int sequence_number);
+ private:
// Maintain a map of histogram names to the sample stats we've sent.
typedef std::map<std::string, base::Histogram::SampleSet> LoggedSampleMap;
typedef std::vector<std::string> HistogramPickledList;
- private:
// Extract snapshot data and then send it off the the Browser process.
// Send only a delta to what we have already sent.
void UploadAllHistrograms(int sequence_number);
- void UploadHistrogram(const base::Histogram& histogram,
- HistogramPickledList* histograms);
- void UploadHistogramDelta(const base::Histogram& histogram,
- const base::Histogram::SampleSet& snapshot,
- HistogramPickledList* histograms);
ScopedRunnableMethodFactory<RendererHistogramSnapshots>
renderer_histogram_snapshots_factory_;
- // For histograms, record what we've already logged (as a sample for each
- // histogram) so that we can send only the delta with the next log.
- LoggedSampleMap logged_samples_;
+ // HistogramSender interface (override) methods.
+ void TransmitHistogramDelta(
+ const base::Histogram& histogram,
+ const base::Histogram::SampleSet& snapshot);
+ void InconsistencyDetected(int problem);
+ void UniqueInconsistencyDetected(int problem);
+ void SnapshotProblemResolved(int amount);
+
+ // Collection of histograms to send to the browser.
+ HistogramPickledList pickled_histograms_;
DISALLOW_COPY_AND_ASSIGN(RendererHistogramSnapshots);
};