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

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

Issue 27460003: Consolidate serialization code in base::HistogramDeltasSerializer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef BASE_METRICS_HISTOGRAM_DELTA_SERIALIZER_BASE_H_
6 #define BASE_METRICS_HISTOGRAM_DELTA_SERIALIZER_BASE_H_
7
8 #include <string>
9 #include <vector>
10
11 #include "base/base_export.h"
12 #include "base/basictypes.h"
13 #include "base/memory/scoped_ptr.h"
14 #include "base/metrics/histogram_flattener.h"
15 #include "base/metrics/histogram_snapshot_manager.h"
16
17 namespace base {
18
19 class HistogramBase;
20
21 // Serializes and restores histograms deltas.
22 class BASE_EXPORT HistogramDeltasSerializer : public HistogramFlattener {
23 public:
24 // |caller_name| is string used in histograms for counting inconsistencies.
25 explicit HistogramDeltasSerializer(const std::string& caller_name);
26 virtual ~HistogramDeltasSerializer();
27
28 // Returns serialized deltas in histograms counters happened after previous
29 // call.
Ilya Sherman 2013/10/17 22:41:47 nit: I'd suggest a wording more like: "Computes de
Vitaly Buka (NO REVIEWS) 2013/10/18 05:33:35 Done.
30 const std::vector<std::string>& GetNewDeltas();
31
32 // Deserialize deltas and add samples to corresponding histograms, creating
33 // them if necessary. Silently ignores errors in |deltas|.
34 static void DeserializeAndAddSamples(const std::vector<std::string>& deltas);
35
36 private:
37 // HistogramFlattener implementation.
38 virtual void RecordDelta(const HistogramBase& histogram,
39 const HistogramSamples& snapshot) OVERRIDE;
40 virtual void InconsistencyDetected(
41 HistogramBase::Inconsistency problem) OVERRIDE;
42 virtual void UniqueInconsistencyDetected(
43 HistogramBase::Inconsistency problem) OVERRIDE;
44 virtual void InconsistencyDetectedInLoggedCount(int amount) OVERRIDE;
45
46 // Calculates deltas in histogram counters.
47 HistogramSnapshotManager histogram_snapshot_manager_;
48
49 // Output buffet for serialized deltas.
Ilya Sherman 2013/10/17 22:41:47 nit: "buffet" -> "buffer"
Vitaly Buka (NO REVIEWS) 2013/10/18 05:33:35 Done.
50 std::vector<std::string> serialized_deltas_;
51
52 // Histograms to count inconsistencies in snapshots.
53 HistogramBase* inconsistencies_histogram_;
54 HistogramBase* inconsistencies_unique_histogram_;
55 HistogramBase* inconsistent_stapshot_histogram_;
Ilya Sherman 2013/10/17 22:41:47 nit: "stapshot" -> "snapshot"
Vitaly Buka (NO REVIEWS) 2013/10/18 05:33:35 Done.
56
57 DISALLOW_COPY_AND_ASSIGN(HistogramDeltasSerializer);
58 };
59
60 } // namespace base
61
62 #endif // BASE_METRICS_HISTOGRAM_DELTA_SERIALIZER_BASE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698