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

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
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 #include "base/synchronization/lock.h"
9
10 using std::string;
Ilya Sherman 2012/08/04 01:18:35 nit: This sort of using statement is not permitted
kaiwang 2012/08/08 03:59:33 are you sure about this? This is allowed in google
Ilya Sherman 2012/08/08 05:00:29 Sorry, you're right, this sort of using statement
11
12 namespace base {
13
14 // static
15 HistogramBase* SparseHistogram::FactoryGet(const string& name,
16 Flags flags) {
Ilya Sherman 2012/08/04 01:18:35 nit: Should this be |int32 flags|, as it is everyw
kaiwang 2012/08/08 03:59:33 Done. Good catch
17 HistogramBase* histogram = new SparseHistogram(name);
Ilya Sherman 2012/08/04 01:18:35 nit: I believe this is an intentional leak, right?
18 histogram->SetFlags(flags);
19 return histogram;
20 }
Ilya Sherman 2012/08/04 01:18:35 Is this method eventually going to look up the his
kaiwang 2012/08/08 03:59:33 You are right. FactoryGet will eventually register
21
22 SparseHistogram::~SparseHistogram() {}
23
24 void SparseHistogram::Add(Sample value) {
25 base::AutoLock auto_lock(*lock_);
26 sample_[value]++;
27 }
28
29 void SparseHistogram::SnapshotSample(
30 SparseHistogram::SampleCounts* sample) const {
31 base::AutoLock auto_lock(*lock_);
32 *sample = sample_;
33 }
34
35 void SparseHistogram::WriteHTMLGraph(string* output) const {
Ilya Sherman 2012/08/04 01:18:35 nit: Please add a TODO, linked to a crbug, to impl
kaiwang 2012/08/08 03:59:33 Added todo. Most code is in histogram.cc. Seems no
36 }
37
38 void SparseHistogram::WriteAscii(string* output) const {
39 }
40
41 SparseHistogram::SparseHistogram(const string& name)
42 : HistogramBase(name),
43 lock_(new base::Lock()) {}
44
45 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698