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. |