Index: sync/util/data_type_histogram.h |
diff --git a/sync/util/data_type_histogram.h b/sync/util/data_type_histogram.h |
index 0f7e6a99e594fb5d678ae8a4d4a3a875a3dc3584..c17d6d65ca7cf05a9a50ca96bd947ccf98b24339 100644 |
--- a/sync/util/data_type_histogram.h |
+++ b/sync/util/data_type_histogram.h |
@@ -6,9 +6,21 @@ |
#define SYNC_UTIL_DATA_TYPE_HISTOGRAM_H_ |
#include "base/metrics/histogram.h" |
+#include "base/metrics/sparse_histogram.h" |
#include "base/time/time.h" |
#include "sync/internal_api/public/base/model_type.h" |
+// This macro adds |value| to |sample| bucket of histogram |name|. |value| |
+// should be greater or equal to 1 and |name| can be variable. DataTypes are |
+// mapped to proper |sample| bucket by using ModelTypeToHistogramInt() function. |
+// So different DataTypes play the role of different buckets in this histogram. |
+#define SYNC_RECORD_DATATYPE_BIN(name, sample, value) \ |
sclittle
2015/08/19 22:41:35
Does this have to be a macro? Would this be better
amohammadkhan
2015/08/20 00:20:13
Done.
Nicolas Zea
2015/08/20 17:59:50
Actually, if I recall how histograms work you migh
amohammadkhan
2015/08/20 18:12:51
I see your point. But I used it without static poi
|
+ do { \ |
+ base::HistogramBase* histogram = base::SparseHistogram::FactoryGet( \ |
+ name, base::HistogramBase::kUmaTargetedHistogramFlag); \ |
+ histogram->AddCount(sample, value); \ |
+ } while (0) |
+ |
// For now, this just implements UMA_HISTOGRAM_LONG_TIMES. This can be adjusted |
// if we feel the min, max, or bucket count amount are not appropriate. |
#define SYNC_FREQ_HISTOGRAM(name, time) UMA_HISTOGRAM_CUSTOM_TIMES( \ |