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

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

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/sparse_histogram.h ('k') | base/metrics/sparse_histogram_unittest.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 #include "base/metrics/sparse_histogram.h"
6
7 #include "base/metrics/statistics_recorder.h"
8
9 using std::string;
10
11 namespace base {
12
13 // static
14 HistogramBase* SparseHistogram::FactoryGet(const string& name,
15 int32 flags) {
16 // TODO(kaiwang): Register and get SparseHistogram with StatisticsRecorder.
17 HistogramBase* histogram = new SparseHistogram(name);
18 histogram->SetFlags(flags);
19 return histogram;
20 }
21
22 SparseHistogram::~SparseHistogram() {}
23
24 void SparseHistogram::Add(Sample value) {
25 base::AutoLock auto_lock(lock_);
26 samples_[value]++;
27 }
28
29 void SparseHistogram::SnapshotSample(std::map<Sample, Count>* samples) const {
30 base::AutoLock auto_lock(lock_);
31 *samples = samples_;
32 }
33
34 void SparseHistogram::WriteHTMLGraph(string* output) const {
35 // TODO(kaiwang): Implement.
36 }
37
38 void SparseHistogram::WriteAscii(string* output) const {
39 // TODO(kaiwang): Implement.
40 }
41
42 SparseHistogram::SparseHistogram(const string& name)
43 : HistogramBase(name) {}
44
45 } // namespace base
OLDNEW
« no previous file with comments | « base/metrics/sparse_histogram.h ('k') | base/metrics/sparse_histogram_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698