OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 BASE_METRICS_HISTOGRAM_DELTA_SERIALIZATION_H_ | 5 #ifndef BASE_METRICS_HISTOGRAM_DELTA_SERIALIZATION_H_ |
6 #define BASE_METRICS_HISTOGRAM_DELTA_SERIALIZATION_H_ | 6 #define BASE_METRICS_HISTOGRAM_DELTA_SERIALIZATION_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 10 matching lines...) Expand all Loading... | |
21 | 21 |
22 // Serializes and restores histograms deltas. | 22 // Serializes and restores histograms deltas. |
23 class BASE_EXPORT HistogramDeltaSerialization : public HistogramFlattener { | 23 class BASE_EXPORT HistogramDeltaSerialization : public HistogramFlattener { |
24 public: | 24 public: |
25 // |caller_name| is string used in histograms for counting inconsistencies. | 25 // |caller_name| is string used in histograms for counting inconsistencies. |
26 explicit HistogramDeltaSerialization(const std::string& caller_name); | 26 explicit HistogramDeltaSerialization(const std::string& caller_name); |
27 ~HistogramDeltaSerialization() override; | 27 ~HistogramDeltaSerialization() override; |
28 | 28 |
29 // Computes deltas in histogram bucket counts relative to the previous call to | 29 // Computes deltas in histogram bucket counts relative to the previous call to |
30 // this method. Stores the deltas in serialized form into |serialized_deltas|. | 30 // this method. Stores the deltas in serialized form into |serialized_deltas|. |
31 // If |serialized_deltas| is NULL, no data is serialized, though the next call | 31 // If |serialized_deltas| is NULL, no data is serialized, though the next call |
Alexei Svitkine (slow)
2016/01/18 19:25:35
Nit: "is NULL" -> "is null" per new conventions si
bcwhite
2016/01/22 15:24:53
Done.
| |
32 // will compute the deltas relative to this one. | 32 // will compute the deltas relative to this one. Setting |include_persistent| |
33 void PrepareAndSerializeDeltas(std::vector<std::string>* serialized_deltas); | 33 // will include histograms held in persistent memory (and thus may be reported |
34 // elsewhere); otherwise only histograms local to this process are serialized. | |
35 void PrepareAndSerializeDeltas(std::vector<std::string>* serialized_deltas, | |
36 bool include_persistent); | |
34 | 37 |
35 // Deserialize deltas and add samples to corresponding histograms, creating | 38 // Deserialize deltas and add samples to corresponding histograms, creating |
36 // them if necessary. Silently ignores errors in |serialized_deltas|. | 39 // them if necessary. Silently ignores errors in |serialized_deltas|. |
37 static void DeserializeAndAddSamples( | 40 static void DeserializeAndAddSamples( |
38 const std::vector<std::string>& serialized_deltas); | 41 const std::vector<std::string>& serialized_deltas); |
39 | 42 |
40 private: | 43 private: |
41 // HistogramFlattener implementation. | 44 // HistogramFlattener implementation. |
42 void RecordDelta(const HistogramBase& histogram, | 45 void RecordDelta(const HistogramBase& histogram, |
43 const HistogramSamples& snapshot) override; | 46 const HistogramSamples& snapshot) override; |
(...skipping 14 matching lines...) Expand all Loading... | |
58 HistogramBase* inconsistencies_histogram_; | 61 HistogramBase* inconsistencies_histogram_; |
59 HistogramBase* inconsistencies_unique_histogram_; | 62 HistogramBase* inconsistencies_unique_histogram_; |
60 HistogramBase* inconsistent_snapshot_histogram_; | 63 HistogramBase* inconsistent_snapshot_histogram_; |
61 | 64 |
62 DISALLOW_COPY_AND_ASSIGN(HistogramDeltaSerialization); | 65 DISALLOW_COPY_AND_ASSIGN(HistogramDeltaSerialization); |
63 }; | 66 }; |
64 | 67 |
65 } // namespace base | 68 } // namespace base |
66 | 69 |
67 #endif // BASE_METRICS_HISTOGRAM_DELTA_SERIALIZATION_H_ | 70 #endif // BASE_METRICS_HISTOGRAM_DELTA_SERIALIZATION_H_ |
OLD | NEW |