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

Side by Side Diff: third_party/WebKit/Source/platform/Histogram.cpp

Issue 1647883004: Support caching histograms so that a lookup isn't done in each iteration. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add explicit to protected ctor as well Created 4 years, 10 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
OLDNEW
(Empty)
1 // Copyright 2016 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 "platform/Histogram.h"
6
7 #include "base/metrics/histogram.h"
8 #include "base/metrics/sparse_histogram.h"
9
10 namespace blink {
11
12 CustomCountHistogram::CustomCountHistogram(const char* name, int32_t min, int32_ t max, int32_t bucketCount)
13 {
14 m_histogram = base::Histogram::FactoryGet(name, min, max, bucketCount, base: :HistogramBase::kNoFlags);
Alexei Svitkine (slow) 2016/02/01 19:55:31 I think you want kUmaTargetedHistogramFlag here an
15 }
16
17 CustomCountHistogram::CustomCountHistogram(base::HistogramBase* histogram)
18 : m_histogram(histogram)
19 {
20 }
21
22 void CustomCountHistogram::count(int32_t sample)
23 {
24 m_histogram->Add(sample);
25 }
26
27 EnumerationHistogram::EnumerationHistogram(const char* name, int32_t boundaryVal ue)
28 : CustomCountHistogram(base::LinearHistogram::FactoryGet(name, 1, boundaryVa lue, boundaryValue + 1, base::HistogramBase::kNoFlags))
29 {
30 }
31
32 SparseHistogram::SparseHistogram(const char* name)
33 {
34 m_histogram = base::SparseHistogram::FactoryGet(name, base::HistogramBase::k UmaTargetedHistogramFlag);
35 }
36
37 void SparseHistogram::sample(int32_t sample)
38 {
39 m_histogram->Add(sample);
40 }
41
42 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698