OLD | NEW |
---|---|
(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 <jni.h> | |
9 #include <string> | |
10 #include <vector> | |
11 | |
12 #include "base/basictypes.h" | |
13 #include "base/macros.h" | |
14 #include "base/memory/scoped_ptr.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 cronet { | |
20 | |
21 bool HistogramManagerRegisterJni(JNIEnv* env); | |
22 | |
23 // A HistogramManager instance is created by Android. It is the central | |
24 // controller for the acquisition of log data, and the automatic transmission of | |
25 // that log data to an external server. | |
26 class HistogramManager : public base::HistogramFlattener { | |
27 public: | |
28 HistogramManager(); | |
29 ~HistogramManager(); | |
30 | |
31 // Snapshot all histograms to record the delta into |uma_proto_| and then | |
32 // returns the serialized protobuf representation of the record. | |
33 std::vector<uint8> GetDeltas(); | |
34 | |
35 const metrics::ChromeUserMetricsExtension& uma_proto() const { | |
Alexei Svitkine (slow)
2014/12/10 22:36:37
I don't think you need to have this method anymore
ramant (doing other things)
2014/12/11 02:21:53
Done.
| |
36 return uma_proto_; | |
37 } | |
38 | |
39 private: | |
40 // HistogramFlattener methods: | |
41 void RecordDelta(const base::HistogramBase& histogram, | |
42 const base::HistogramSamples& snapshot) override; | |
43 void InconsistencyDetected( | |
44 base::HistogramBase::Inconsistency problem) override; | |
45 void UniqueInconsistencyDetected( | |
46 base::HistogramBase::Inconsistency problem) override; | |
47 void InconsistencyDetectedInLoggedCount(int amount) override; | |
48 | |
49 void RecordHistogramDelta(const std::string& histogram_name, | |
50 const base::HistogramSamples& snapshot); | |
51 | |
52 base::HistogramSnapshotManager histogram_snapshot_manager_; | |
53 | |
54 // Stores the protocol buffer representation for this log. | |
55 metrics::ChromeUserMetricsExtension uma_proto_; | |
56 | |
57 DISALLOW_COPY_AND_ASSIGN(HistogramManager); | |
58 }; | |
59 | |
60 } // namespace cronet | |
61 | |
62 #endif // COMPONENTS_CRONET_ANDROID_CRONET_HISTOGRAM_MANAGER_H_ | |
OLD | NEW |