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

Side by Side Diff: base/metrics/histogram_delta_serialization.h

Issue 668783004: Standardize usage of virtual/override/final in base/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Formatted Created 6 years, 2 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
« no previous file with comments | « base/metrics/histogram.h ('k') | base/metrics/histogram_samples.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 16
17 namespace base { 17 namespace base {
18 18
19 class HistogramBase; 19 class HistogramBase;
20 20
21 // Serializes and restores histograms deltas. 21 // Serializes and restores histograms deltas.
22 class BASE_EXPORT HistogramDeltaSerialization : public HistogramFlattener { 22 class BASE_EXPORT HistogramDeltaSerialization : public HistogramFlattener {
23 public: 23 public:
24 // |caller_name| is string used in histograms for counting inconsistencies. 24 // |caller_name| is string used in histograms for counting inconsistencies.
25 explicit HistogramDeltaSerialization(const std::string& caller_name); 25 explicit HistogramDeltaSerialization(const std::string& caller_name);
26 virtual ~HistogramDeltaSerialization(); 26 ~HistogramDeltaSerialization() override;
27 27
28 // Computes deltas in histogram bucket counts relative to the previous call to 28 // Computes deltas in histogram bucket counts relative to the previous call to
29 // this method. Stores the deltas in serialized form into |serialized_deltas|. 29 // this method. Stores the deltas in serialized form into |serialized_deltas|.
30 // If |serialized_deltas| is NULL, no data is serialized, though the next call 30 // If |serialized_deltas| is NULL, no data is serialized, though the next call
31 // will compute the deltas relative to this one. 31 // will compute the deltas relative to this one.
32 void PrepareAndSerializeDeltas(std::vector<std::string>* serialized_deltas); 32 void PrepareAndSerializeDeltas(std::vector<std::string>* serialized_deltas);
33 33
34 // Deserialize deltas and add samples to corresponding histograms, creating 34 // Deserialize deltas and add samples to corresponding histograms, creating
35 // them if necessary. Silently ignores errors in |serialized_deltas|. 35 // them if necessary. Silently ignores errors in |serialized_deltas|.
36 static void DeserializeAndAddSamples( 36 static void DeserializeAndAddSamples(
37 const std::vector<std::string>& serialized_deltas); 37 const std::vector<std::string>& serialized_deltas);
38 38
39 private: 39 private:
40 // HistogramFlattener implementation. 40 // HistogramFlattener implementation.
41 virtual void RecordDelta(const HistogramBase& histogram, 41 void RecordDelta(const HistogramBase& histogram,
42 const HistogramSamples& snapshot) override; 42 const HistogramSamples& snapshot) override;
43 virtual void InconsistencyDetected( 43 void InconsistencyDetected(HistogramBase::Inconsistency problem) override;
44 void UniqueInconsistencyDetected(
44 HistogramBase::Inconsistency problem) override; 45 HistogramBase::Inconsistency problem) override;
45 virtual void UniqueInconsistencyDetected( 46 void InconsistencyDetectedInLoggedCount(int amount) override;
46 HistogramBase::Inconsistency problem) override;
47 virtual void InconsistencyDetectedInLoggedCount(int amount) override;
48 47
49 // Calculates deltas in histogram counters. 48 // Calculates deltas in histogram counters.
50 HistogramSnapshotManager histogram_snapshot_manager_; 49 HistogramSnapshotManager histogram_snapshot_manager_;
51 50
52 // Output buffer for serialized deltas. 51 // Output buffer for serialized deltas.
53 std::vector<std::string>* serialized_deltas_; 52 std::vector<std::string>* serialized_deltas_;
54 53
55 // Histograms to count inconsistencies in snapshots. 54 // Histograms to count inconsistencies in snapshots.
56 HistogramBase* inconsistencies_histogram_; 55 HistogramBase* inconsistencies_histogram_;
57 HistogramBase* inconsistencies_unique_histogram_; 56 HistogramBase* inconsistencies_unique_histogram_;
58 HistogramBase* inconsistent_snapshot_histogram_; 57 HistogramBase* inconsistent_snapshot_histogram_;
59 58
60 DISALLOW_COPY_AND_ASSIGN(HistogramDeltaSerialization); 59 DISALLOW_COPY_AND_ASSIGN(HistogramDeltaSerialization);
61 }; 60 };
62 61
63 } // namespace base 62 } // namespace base
64 63
65 #endif // BASE_METRICS_HISTOGRAM_DELTA_SERIALIZATION_H_ 64 #endif // BASE_METRICS_HISTOGRAM_DELTA_SERIALIZATION_H_
OLDNEW
« no previous file with comments | « base/metrics/histogram.h ('k') | base/metrics/histogram_samples.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698