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

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

Issue 10830156: Skeleton code of SparseHistogram (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 4 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
« no previous file with comments | « base/metrics/histogram_base.cc ('k') | base/metrics/sparse_histogram.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 // Copyright (c) 2012 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_SPARSE_HISTOGRAM_H_
6 #define BASE_METRICS_SPARSE_HISTOGRAM_H_
7
8 #include <map>
9 #include <string>
10
11 #include "base/base_export.h"
12 #include "base/basictypes.h"
13 #include "base/compiler_specific.h"
14 #include "base/metrics/histogram_base.h"
15 #include "base/synchronization/lock.h"
16
17 namespace base {
18
19 class BASE_EXPORT_PRIVATE SparseHistogram : public HistogramBase {
20 public:
21 // If there's one with same name, return the existing one. If not, create a
22 // new one.
23 static HistogramBase* FactoryGet(const std::string& name, int32 flags);
24
25 virtual ~SparseHistogram();
26
27 virtual void Add(Sample value) OVERRIDE;
28
29 virtual void SnapshotSample(std::map<Sample, Count>* sample) const;
30 virtual void WriteHTMLGraph(std::string* output) const OVERRIDE;
31 virtual void WriteAscii(std::string* output) const OVERRIDE;
32
33 protected:
34 // Clients should always use FactoryGet to create SparseHistogram.
35 SparseHistogram(const std::string& name);
36
37 private:
38 friend class SparseHistogramTest; // For constuctor calling.
39
40 std::map<Sample, Count> samples_;
41
42 // Protects access to above map.
43 mutable base::Lock lock_;
44
45 DISALLOW_COPY_AND_ASSIGN(SparseHistogram);
46 };
47
48 } // namespace base
49
50 #endif // BASE_METRICS_SPARSE_HISTOGRAM_H_
OLDNEW
« no previous file with comments | « base/metrics/histogram_base.cc ('k') | base/metrics/sparse_histogram.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698