| 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 |
| 11 #include "base/base_export.h" | 11 #include "base/base_export.h" |
| 12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/metrics/histogram_flattener.h" | 14 #include "base/metrics/histogram_flattener.h" |
| 15 #include "base/metrics/histogram_snapshot_manager.h" | 15 #include "base/metrics/histogram_snapshot_manager.h" |
| 16 #include "base/threading/thread_checker.h" |
| 16 | 17 |
| 17 namespace base { | 18 namespace base { |
| 18 | 19 |
| 19 class HistogramBase; | 20 class HistogramBase; |
| 20 | 21 |
| 21 // Serializes and restores histograms deltas. | 22 // Serializes and restores histograms deltas. |
| 22 class BASE_EXPORT HistogramDeltaSerialization : public HistogramFlattener { | 23 class BASE_EXPORT HistogramDeltaSerialization : public HistogramFlattener { |
| 23 public: | 24 public: |
| 24 // |caller_name| is string used in histograms for counting inconsistencies. | 25 // |caller_name| is string used in histograms for counting inconsistencies. |
| 25 explicit HistogramDeltaSerialization(const std::string& caller_name); | 26 explicit HistogramDeltaSerialization(const std::string& caller_name); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 38 | 39 |
| 39 private: | 40 private: |
| 40 // HistogramFlattener implementation. | 41 // HistogramFlattener implementation. |
| 41 void RecordDelta(const HistogramBase& histogram, | 42 void RecordDelta(const HistogramBase& histogram, |
| 42 const HistogramSamples& snapshot) override; | 43 const HistogramSamples& snapshot) override; |
| 43 void InconsistencyDetected(HistogramBase::Inconsistency problem) override; | 44 void InconsistencyDetected(HistogramBase::Inconsistency problem) override; |
| 44 void UniqueInconsistencyDetected( | 45 void UniqueInconsistencyDetected( |
| 45 HistogramBase::Inconsistency problem) override; | 46 HistogramBase::Inconsistency problem) override; |
| 46 void InconsistencyDetectedInLoggedCount(int amount) override; | 47 void InconsistencyDetectedInLoggedCount(int amount) override; |
| 47 | 48 |
| 49 ThreadChecker thread_checker_; |
| 50 |
| 48 // Calculates deltas in histogram counters. | 51 // Calculates deltas in histogram counters. |
| 49 HistogramSnapshotManager histogram_snapshot_manager_; | 52 HistogramSnapshotManager histogram_snapshot_manager_; |
| 50 | 53 |
| 51 // Output buffer for serialized deltas. | 54 // Output buffer for serialized deltas. |
| 52 std::vector<std::string>* serialized_deltas_; | 55 std::vector<std::string>* serialized_deltas_; |
| 53 | 56 |
| 54 // Histograms to count inconsistencies in snapshots. | 57 // Histograms to count inconsistencies in snapshots. |
| 55 HistogramBase* inconsistencies_histogram_; | 58 HistogramBase* inconsistencies_histogram_; |
| 56 HistogramBase* inconsistencies_unique_histogram_; | 59 HistogramBase* inconsistencies_unique_histogram_; |
| 57 HistogramBase* inconsistent_snapshot_histogram_; | 60 HistogramBase* inconsistent_snapshot_histogram_; |
| 58 | 61 |
| 59 DISALLOW_COPY_AND_ASSIGN(HistogramDeltaSerialization); | 62 DISALLOW_COPY_AND_ASSIGN(HistogramDeltaSerialization); |
| 60 }; | 63 }; |
| 61 | 64 |
| 62 } // namespace base | 65 } // namespace base |
| 63 | 66 |
| 64 #endif // BASE_METRICS_HISTOGRAM_DELTA_SERIALIZATION_H_ | 67 #endif // BASE_METRICS_HISTOGRAM_DELTA_SERIALIZATION_H_ |
| OLD | NEW |