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

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

Issue 2373523003: Clean up sparse_histogram.h header (Closed)
Patch Set: Add additional file in depot which depend on sparse_histogram.h Created 4 years, 2 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
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef BASE_METRICS_HISTOGRAM_MACROS_INTERNAL_H_ 5 #ifndef BASE_METRICS_HISTOGRAM_MACROS_INTERNAL_H_
6 #define BASE_METRICS_HISTOGRAM_MACROS_INTERNAL_H_ 6 #define BASE_METRICS_HISTOGRAM_MACROS_INTERNAL_H_
7 7
8 #include "base/atomicops.h" 8 #include "base/atomicops.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
11 #include "base/metrics/sparse_histogram.h"
11 #include "base/time/time.h" 12 #include "base/time/time.h"
12 13
13 // This is for macros internal to base/metrics. They should not be used outside 14 // This is for macros internal to base/metrics. They should not be used outside
14 // of this directory. For writing to UMA histograms, see histogram_macros.h. 15 // of this directory. For writing to UMA histograms, see histogram_macros.h.
15 16
16 // TODO(rkaplow): Improve commenting of these methods. 17 // TODO(rkaplow): Improve commenting of these methods.
17 18
18 //------------------------------------------------------------------------------ 19 //------------------------------------------------------------------------------
19 // Histograms are often put in areas where they are called many many times, and 20 // Histograms are often put in areas where they are called many many times, and
20 // performance is critical. As a result, they are designed to have a very low 21 // performance is critical. As a result, they are designed to have a very low
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 UMA_HISTOGRAM_LONG_TIMES_100(name, elapsed); \ 121 UMA_HISTOGRAM_LONG_TIMES_100(name, elapsed); \
121 } else { \ 122 } else { \
122 UMA_HISTOGRAM_TIMES(name, elapsed); \ 123 UMA_HISTOGRAM_TIMES(name, elapsed); \
123 } \ 124 } \
124 } \ 125 } \
125 private: \ 126 private: \
126 base::TimeTicks constructed_; \ 127 base::TimeTicks constructed_; \
127 } scoped_histogram_timer_##key 128 } scoped_histogram_timer_##key
128 129
129 #endif // BASE_METRICS_HISTOGRAM_MACROS_INTERNAL_H_ 130 #endif // BASE_METRICS_HISTOGRAM_MACROS_INTERNAL_H_
131
132 // Macro for sparse histogram. Each call to add sample to sparse
133 // histogram will do a lookup in map.
134 #define INTERNAL_HISTOGRAM_SPARSE_SLOWLY(name, sample) \
135 do { \
136 base::HistogramBase* histogram = base::SparseHistogram::FactoryGet( \
137 name, base::HistogramBase::kUmaTargetedHistogramFlag); \
138 histogram->Add(sample); \
139 } while (0)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698