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

Side by Side Diff: chrome/common/metrics/metrics_service_base.h

Issue 12207058: Connect SparseHistogram with the rest of stats system (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_COMMON_METRICS_METRICS_SERVICE_BASE_H_ 5 #ifndef CHROME_COMMON_METRICS_METRICS_SERVICE_BASE_H_
6 #define CHROME_COMMON_METRICS_METRICS_SERVICE_BASE_H_ 6 #define CHROME_COMMON_METRICS_METRICS_SERVICE_BASE_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/metrics/histogram_base.h" 9 #include "base/metrics/histogram_base.h"
10 #include "base/metrics/histogram_flattener.h" 10 #include "base/metrics/histogram_flattener.h"
11 #include "base/metrics/histogram_snapshot_manager.h" 11 #include "base/metrics/histogram_snapshot_manager.h"
12 #include "chrome/common/metrics/metrics_log_manager.h" 12 #include "chrome/common/metrics/metrics_log_manager.h"
13 13
14 namespace base { 14 namespace base {
15 class HistogramSamples; 15 class HistogramSamples;
16 } // namespace base 16 } // namespace base
17 17
18 // This class provides base functionality for logging metrics data. 18 // This class provides base functionality for logging metrics data.
19 // TODO(ananta): Factor out more common code from chrome and chrome frame 19 // TODO(ananta): Factor out more common code from chrome and chrome frame
20 // metrics service into this class. 20 // metrics service into this class.
21 class MetricsServiceBase : public base::HistogramFlattener { 21 class MetricsServiceBase : public base::HistogramFlattener {
22 public: 22 public:
23 // HistogramFlattener interface (override) methods. 23 // HistogramFlattener interface (override) methods.
24 virtual void RecordDelta(const base::HistogramBase& histogram, 24 virtual void RecordDelta(const base::HistogramBase& histogram,
25 const base::HistogramSamples& snapshot) OVERRIDE; 25 const base::HistogramSamples& snapshot) OVERRIDE;
26 virtual void InconsistencyDetected( 26 virtual void InconsistencyDetected(
27 base::Histogram::Inconsistencies problem) OVERRIDE; 27 base::HistogramBase::Inconsistency problem) OVERRIDE;
28 virtual void UniqueInconsistencyDetected( 28 virtual void UniqueInconsistencyDetected(
29 base::Histogram::Inconsistencies problem) OVERRIDE; 29 base::HistogramBase::Inconsistency problem) OVERRIDE;
30 virtual void InconsistencyDetectedInLoggedCount(int amount) OVERRIDE; 30 virtual void InconsistencyDetectedInLoggedCount(int amount) OVERRIDE;
31 31
32 protected: 32 protected:
33 MetricsServiceBase(); 33 MetricsServiceBase();
34 virtual ~MetricsServiceBase(); 34 virtual ~MetricsServiceBase();
35 35
36 // The metrics servers' URLs, for XML and protobuf uploads. 36 // The metrics servers' URLs, for XML and protobuf uploads.
37 static const char kServerUrlXml[]; 37 static const char kServerUrlXml[];
38 static const char kServerUrlProto[]; 38 static const char kServerUrlProto[];
39 39
40 // The MIME types for the uploaded metrics data, for XML and protobuf uploads. 40 // The MIME types for the uploaded metrics data, for XML and protobuf uploads.
41 static const char kMimeTypeXml[]; 41 static const char kMimeTypeXml[];
42 static const char kMimeTypeProto[]; 42 static const char kMimeTypeProto[];
43 43
44 // Record complete list of histograms into the current log. 44 // Record complete list of histograms into the current log.
45 // Called when we close a log. 45 // Called when we close a log.
46 void RecordCurrentHistograms(); 46 void RecordCurrentHistograms();
47 47
48 // Manager for the various in-flight logs. 48 // Manager for the various in-flight logs.
49 MetricsLogManager log_manager_; 49 MetricsLogManager log_manager_;
50 50
51 private: 51 private:
52 // |histogram_snapshot_manager_| prepares histogram deltas for transmission. 52 // |histogram_snapshot_manager_| prepares histogram deltas for transmission.
53 base::HistogramSnapshotManager histogram_snapshot_manager_; 53 base::HistogramSnapshotManager histogram_snapshot_manager_;
54 54
55 DISALLOW_COPY_AND_ASSIGN(MetricsServiceBase); 55 DISALLOW_COPY_AND_ASSIGN(MetricsServiceBase);
56 }; 56 };
57 57
58 #endif // CHROME_COMMON_METRICS_METRICS_SERVICE_BASE_H_ 58 #endif // CHROME_COMMON_METRICS_METRICS_SERVICE_BASE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698