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

Unified Diff: base/metrics/histogram_macros.h

Issue 1829973002: Cache pointers to histograms for recording event times. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ui/events/event.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/metrics/histogram_macros.h
diff --git a/base/metrics/histogram_macros.h b/base/metrics/histogram_macros.h
index fa23bea720ce3f825a32551c14f2062891cd94bf..5a5c1bd346f4030a154937aaa0031ee59026499b 100644
--- a/base/metrics/histogram_macros.h
+++ b/base/metrics/histogram_macros.h
@@ -109,6 +109,23 @@
histogram_factory_get_invocation); \
} while (0)
+// Support a collection of histograms, perhaps one for each entry in an
Alexei Svitkine (slow) 2016/03/30 16:47:38 This seems to be an esoteric use case - and while
bcwhite 2016/03/30 17:33:08 This macro just manages a vector. It knows nothin
Alexei Svitkine (slow) 2016/04/06 19:57:17 Right, but it requires having an index that also c
bcwhite 2016/04/07 16:37:42 Gotcha. Right.
+// enumeration. This macro manages a block of pointers, adding to a specific
+// one by its index.
+#define STATIC_HISTOGRAM_POINTER_GROUP(constant_histogram_name, index, \
+ constant_maximum, \
+ histogram_add_method_invocation, \
+ histogram_factory_get_invocation) \
+ do { \
+ static base::subtle::AtomicWord atomic_histograms[constant_maximum]; \
+ DCHECK_LE(0, index); \
+ DCHECK_LT(index, constant_maximum); \
+ HISTOGRAM_POINTER_USE(&atomic_histograms[index], constant_histogram_name, \
+ histogram_add_method_invocation, \
+ histogram_factory_get_invocation); \
+ } while (0)
+
+
//------------------------------------------------------------------------------
// Provide easy general purpose histogram in a macro, just like stats counters.
// The first four macros use 50 buckets.
« no previous file with comments | « no previous file | ui/events/event.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698