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

Unified Diff: base/metrics/histogram_flattener.h

Issue 10454086: Histograms - Support histograms for Plugins, GPU (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 5 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 | « base/base.gypi ('k') | base/metrics/histogram_snapshot_manager.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/metrics/histogram_flattener.h
===================================================================
--- base/metrics/histogram_flattener.h (working copy)
+++ base/metrics/histogram_flattener.h (working copy)
@@ -2,9 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_COMMON_METRICS_HISTOGRAM_SENDER_H_
-#define CHROME_COMMON_METRICS_HISTOGRAM_SENDER_H_
-#pragma once
+#ifndef BASE_METRICS_HISTOGRAM_FLATTENER_H_
+#define BASE_METRICS_HISTOGRAM_FLATTENER_H_
#include <map>
#include <string>
@@ -13,55 +12,29 @@
#include "base/memory/scoped_ptr.h"
#include "base/metrics/histogram.h"
-// HistogramSender handles the logistics of gathering up available histograms
-// for transmission (such as from renderer to browser, or from browser to UMA
-// upload). It has several pure virtual functions that are replaced in
-// derived classes to allow the exact lower level transmission mechanism,
-// or error report mechanism, to be replaced. Since histograms can sit in
-// memory for an extended period of time, and are vulnerable to memory
-// corruption, this class also validates as much rendundancy as it can before
-// calling for the marginal change (a.k.a., delta) in a histogram to be sent
-// onward.
-class HistogramSender {
- protected:
- HistogramSender();
- virtual ~HistogramSender();
+namespace base {
- // Snapshot all histograms, and transmit the delta.
- // The arguments allow a derived class to select only a subset for
- // transmission, or to set a flag in each transmitted histogram.
- void TransmitAllHistograms(base::Histogram::Flags flags_to_set,
- bool send_only_uma);
+// HistogramFlattener is an interface for the logistics of gathering up
+// available histograms for recording. The implementors handle the exact lower
+// level recording mechanism, or error report mechanism.
+class BASE_EXPORT HistogramFlattener {
+ public:
+ virtual void RecordDelta(const base::Histogram& histogram,
+ const base::Histogram::SampleSet& snapshot) = 0;
- // Send the histograms onward, as defined in a derived class.
- // This is only called with a delta, listing samples that have not previously
- // been transmitted.
- virtual void TransmitHistogramDelta(
- const base::Histogram& histogram,
- const base::Histogram::SampleSet& snapshot) = 0;
-
- // Record various errors found during attempts to send histograms.
+ // Record various errors found during attempts to record histograms.
virtual void InconsistencyDetected(int problem) = 0;
virtual void UniqueInconsistencyDetected(int problem) = 0;
virtual void SnapshotProblemResolved(int amount) = 0;
+ protected:
+ HistogramFlattener() {}
+ virtual ~HistogramFlattener() {}
+
private:
- // Maintain a map of histogram names to the sample stats we've sent.
- typedef std::map<std::string, base::Histogram::SampleSet> LoggedSampleMap;
- // List of histograms names, and their encontered corruptions.
- typedef std::map<std::string, int> ProblemMap;
+ DISALLOW_COPY_AND_ASSIGN(HistogramFlattener);
+};
- // Snapshot this histogram, and transmit the delta.
- void TransmitHistogram(const base::Histogram& histogram);
+} // namespace base
- // For histograms, record what we've already transmitted (as a sample for each
- // histogram) so that we can send only the delta with the next log.
- LoggedSampleMap logged_samples_;
-
- // List of histograms found corrupt to be corrupt, and their problems.
- scoped_ptr<ProblemMap> inconsistencies_;
-
- DISALLOW_COPY_AND_ASSIGN(HistogramSender);
-};
-
-#endif // CHROME_COMMON_METRICS_HISTOGRAM_SENDER_H_
+#endif // BASE_METRICS_HISTOGRAM_FLATTENER_H_
« no previous file with comments | « base/base.gypi ('k') | base/metrics/histogram_snapshot_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698