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/local_histogram_macros.h

Issue 2361933002: Refactor histogram_macros.h. This improves documentation for the macros in the file, moves LOCAL_* … (Closed)
Patch Set: Created 4 years, 3 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.
Mark P 2016/09/23 19:30:42 Consider histogram_macros_local instead for better
rkaplow 2016/09/26 20:16:11 Done.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef BASE_METRICS_LOCAL_HISTOGRAM_MACROS_H_
6 #define BASE_METRICS_LOCAL_HISTOGRAM_MACROS_H_
7
8
Mark P 2016/09/23 19:30:42 nit: remove extra blank line
rkaplow 2016/09/26 20:16:11 Done.
9 #include "base/logging.h"
10 #include "base/metrics/histogram.h"
11 #include "base/metrics/histogram_macros_internal.h"
12 #include "base/time/time.h"
13
14 // TODO(rkaplow): Migrate all LOCAL_* usage within Chromium to include this
15 // file instead of the histogram_macros.h file.
16
17
18 //------------------------------------------------------------------------------
19 // Count histograms. These are used for collecting numeric data. Note that we
20 // have macros for more specialized use cases below (memory, time, percentages).
21 // For usage details, see the equivalents in histogram_macros.h.
22
23 #define LOCAL_HISTOGRAM_COUNTS_100(name, sample) \
Mark P 2016/09/23 19:30:42 FYI, in this file, it looks like you merely copied
rkaplow 2016/09/26 20:16:11 I just did reordering in general - I don't think I
24 LOCAL_HISTOGRAM_CUSTOM_COUNTS(name, sample, 1, 100, 50)
25
26 #define LOCAL_HISTOGRAM_COUNTS_10000(name, sample) \
27 LOCAL_HISTOGRAM_CUSTOM_COUNTS(name, sample, 1, 10000, 50)
28
29 #define LOCAL_HISTOGRAM_COUNTS_1000000(name, sample) \
30 LOCAL_HISTOGRAM_CUSTOM_COUNTS(name, sample, 1, 1000000, 50)
31
32 #define LOCAL_HISTOGRAM_CUSTOM_COUNTS(name, sample, min, max, bucket_count) \
33 INTERNAL_HISTOGRAM_CUSTOM_COUNTS_WITH_FLAG( \
34 name, sample, min, max, bucket_count, base::HistogramBase::kNoFlags)
35
36
37 //------------------------------------------------------------------------------
Mark P 2016/09/23 19:30:43 optional nit: here and below the two blanks lines
rkaplow 2016/09/26 20:16:11 Done.
38 // Timing histograms. These are used for collecting timing data (generally
39 // latencies).
40 // For usage details, see the equivalents in histogram_macros.h.
Mark P 2016/09/23 19:30:42 nit: I know this duplicates the same sentence as a
rkaplow 2016/09/26 20:16:11 Done.
41
42 #define LOCAL_HISTOGRAM_TIMES(name, sample) LOCAL_HISTOGRAM_CUSTOM_TIMES( \
43 name, sample, base::TimeDelta::FromMilliseconds(1), \
44 base::TimeDelta::FromSeconds(10), 50)
45
46 #define LOCAL_HISTOGRAM_CUSTOM_TIMES(name, sample, min, max, bucket_count) \
47 STATIC_HISTOGRAM_POINTER_BLOCK(name, AddTime(sample), \
48 base::Histogram::FactoryTimeGet(name, min, max, bucket_count, \
49 base::HistogramBase::kNoFlags))
50
51
52 //------------------------------------------------------------------------------
53 // Memory histograms.
54 // For usage details, see the equivalents in histogram_macros.h.
55
56 #define LOCAL_HISTOGRAM_MEMORY_KB(name, sample) LOCAL_HISTOGRAM_CUSTOM_COUNTS( \
57 name, sample, 1000, 500000, 50)
58
59
60 //------------------------------------------------------------------------------
61 // Enumeration histograms.
62
Mark P 2016/09/23 19:30:42 Missing usage details line?
rkaplow 2016/09/26 20:16:11 Done.
63 #define LOCAL_HISTOGRAM_ENUMERATION(name, sample, enum_max) \
64 INTERNAL_HISTOGRAM_ENUMERATION_WITH_FLAG( \
65 name, sample, enum_max, \
66 base::HistogramBase::kNoFlags)
67
68 #define LOCAL_HISTOGRAM_BOOLEAN(name, sample) \
69 STATIC_HISTOGRAM_POINTER_BLOCK(name, AddBoolean(sample), \
70 base::BooleanHistogram::FactoryGet(name, base::Histogram::kNoFlags))
71
72 #define LOCAL_HISTOGRAM_PERCENTAGE(name, under_one_hundred) \
Mark P 2016/09/23 19:30:43 A questionable section to put this in.. Maybe it'
rkaplow 2016/09/26 20:16:11 agreed - I ended up putting it with enums since it
73 LOCAL_HISTOGRAM_ENUMERATION(name, under_one_hundred, 101)
74
75
76 //------------------------------------------------------------------------------
77 // Deprecated histograms. Not recommended for current use.
78
79 // Legacy non-explicit version. We suggest using LOCAL_HISTOGRAM_COUNTS_1000000
80 // instead.
81 #define LOCAL_HISTOGRAM_COUNTS(name, sample) \
Mark P 2016/09/23 19:30:43 This is only used in 7 files in the codepath (incl
rkaplow 2016/09/26 20:16:11 Ack
82 LOCAL_HISTOGRAM_CUSTOM_COUNTS(name, sample, 1, 1000000, 50)
83
84 #define LOCAL_HISTOGRAM_CUSTOM_ENUMERATION(name, sample, custom_ranges) \
Mark P 2016/09/23 19:30:42 Appears to not be used anywhere. You can probably
rkaplow 2016/09/26 20:16:11 I did consider this. I was thinking it might make
85 STATIC_HISTOGRAM_POINTER_BLOCK(name, Add(sample), \
86 base::CustomHistogram::FactoryGet(name, custom_ranges, \
87 base::HistogramBase::kNoFlags))
88
89 #endif // BASE_METRICS_LOCAL_HISTOGRAM_MACROS_H_
OLDNEW
« base/metrics/histogram_macros_internal.h ('K') | « base/metrics/histogram_snapshot_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698