blob: 05a68b53540a1f5daf23c62c8ac6b6faa94e4006 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "base/metrics/sparse_histogram.h"
#include "base/metrics/statistics_recorder.h"
using std::string;
namespace base {
// static
HistogramBase* SparseHistogram::FactoryGet(const string& name,
int32 flags) {
// TODO(kaiwang): Register and get SparseHistogram with StatisticsRecorder.
HistogramBase* histogram = new SparseHistogram(name);
histogram->SetFlags(flags);
return histogram;
}
SparseHistogram::~SparseHistogram() {}
void SparseHistogram::Add(Sample value) {
base::AutoLock auto_lock(lock_);
samples_[value]++;
}
void SparseHistogram::SnapshotSample(std::map<Sample, Count>* samples) const {
base::AutoLock auto_lock(lock_);
*samples = samples_;
}
void SparseHistogram::WriteHTMLGraph(string* output) const {
// TODO(kaiwang): Implement.
}
void SparseHistogram::WriteAscii(string* output) const {
// TODO(kaiwang): Implement.
}
SparseHistogram::SparseHistogram(const string& name)
: HistogramBase(name) {}
} // namespace base
|