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

Side by Side Diff: components/metrics/histogram_manager.h

Issue 794493002: Add UMA Histogram Manager to Cronet. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: moved histogram_manager_unittest to components/metrics Created 6 years 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
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef COMPONENTS_CRONET_ANDROID_CRONET_HISTOGRAM_MANAGER_H_
6 #define COMPONENTS_CRONET_ANDROID_CRONET_HISTOGRAM_MANAGER_H_
7
8 #include <string>
9 #include <vector>
10
11 #include "base/basictypes.h"
12 #include "base/macros.h"
13 #include "base/memory/scoped_ptr.h"
14 #include "base/memory/singleton.h"
15 #include "base/metrics/histogram_flattener.h"
16 #include "base/metrics/histogram_snapshot_manager.h"
17 #include "components/metrics/proto/chrome_user_metrics_extension.pb.h"
18
19 namespace metrics {
20
21 // A HistogramManager instance is created by Android. It is the central
22 // controller for the acquisition of log data, and the automatic transmission of
23 // that log data to an external server.
24 class HistogramManager : public base::HistogramFlattener {
25 public:
26 HistogramManager();
27 ~HistogramManager();
28
29 // Snapshot all histograms to record the delta into |uma_proto_| and then
30 // returns the serialized protobuf representation of the record.
31 std::vector<uint8> GetDeltas();
32
33 // TODO(mef): Hang Histogram Manager off java object instead of singleton.
34 static HistogramManager* GetInstance();
35
36 private:
37 friend struct DefaultSingletonTraits<HistogramManager>;
38
39 // HistogramFlattener methods:
Alexei Svitkine (slow) 2014/12/11 20:09:09 Nit: This comment syntax is preferred instead: //
ramant (doing other things) 2014/12/11 20:23:53 Done.
40 void RecordDelta(const base::HistogramBase& histogram,
41 const base::HistogramSamples& snapshot) override;
42 void InconsistencyDetected(
43 base::HistogramBase::Inconsistency problem) override;
44 void UniqueInconsistencyDetected(
45 base::HistogramBase::Inconsistency problem) override;
46 void InconsistencyDetectedInLoggedCount(int amount) override;
47
48 void RecordHistogramDelta(const std::string& histogram_name,
Alexei Svitkine (slow) 2014/12/11 20:09:09 This can be removed.
ramant (doing other things) 2014/12/11 20:23:53 Done.
49 const base::HistogramSamples& snapshot);
50
51 base::HistogramSnapshotManager histogram_snapshot_manager_;
52
53 // Stores the protocol buffer representation for this log.
54 metrics::ChromeUserMetricsExtension uma_proto_;
55
56 DISALLOW_COPY_AND_ASSIGN(HistogramManager);
57 };
58
59 } // namespace metrics
60
61 #endif // COMPONENTS_CRONET_ANDROID_CRONET_HISTOGRAM_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698