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

Unified Diff: chromecast/base/metrics/cast_histograms.h

Issue 652353003: Chromecast: adds class to help record complex histograms. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: resets initial buffering state on flush Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chromecast/base/DEPS ('k') | chromecast/base/metrics/cast_metrics_helper.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromecast/base/metrics/cast_histograms.h
diff --git a/chromecast/base/metrics/cast_histograms.h b/chromecast/base/metrics/cast_histograms.h
new file mode 100644
index 0000000000000000000000000000000000000000..4907c1a84ef69985a2890642769a140d0d8bc2ea
--- /dev/null
+++ b/chromecast/base/metrics/cast_histograms.h
@@ -0,0 +1,49 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROMECAST_BASE_METRICS_CAST_HISTOGRAMS_H_
+#define CHROMECAST_BASE_METRICS_CAST_HISTOGRAMS_H_
+
+#include "base/metrics/histogram.h"
+
+// STATIC_HISTOGRAM_POINTER_BLOCK only calls histogram_factory_get_invocation
+// at the first time and uses the cached histogram_pointer for subsequent calls
+// through base::subtle::Release_Store() and base::subtle::Acquire_Load().
+// If the histogram name changes between subsequent calls, use this non-cached
+// version that always calls histogram_factory_get_invocation.
+#define STATIC_HISTOGRAM_POINTER_BLOCK_NO_CACHE( \
+ constant_histogram_name, \
+ histogram_add_method_invocation, \
+ histogram_factory_get_invocation) \
+ do { \
+ base::HistogramBase* histogram_pointer = histogram_factory_get_invocation; \
+ if (DCHECK_IS_ON) \
+ histogram_pointer->CheckName(constant_histogram_name); \
+ histogram_pointer->histogram_add_method_invocation; \
+ } while (0)
+
+#define UMA_HISTOGRAM_CUSTOM_TIMES_NO_CACHE( \
+ name, sample, min, max, bucket_count) \
+ STATIC_HISTOGRAM_POINTER_BLOCK_NO_CACHE(name, AddTime(sample), \
+ base::Histogram::FactoryTimeGet(name, min, max, bucket_count, \
+ base::Histogram::kUmaTargetedHistogramFlag))
+
+#define UMA_HISTOGRAM_CUSTOM_COUNTS_NO_CACHE(name, sample, min, max, \
+ bucket_count) \
+ STATIC_HISTOGRAM_POINTER_BLOCK_NO_CACHE(name, Add(sample), \
+ base::Histogram::FactoryGet(name, min, max, bucket_count, \
+ base::HistogramBase::kUmaTargetedHistogramFlag))
+
+#define UMA_HISTOGRAM_ENUMERATION_NO_CACHE(name, sample, boundary_value) \
+ STATIC_HISTOGRAM_POINTER_BLOCK_NO_CACHE(name, Add(sample), \
+ base::LinearHistogram::FactoryGet(name, 1, boundary_value, \
+ boundary_value + 1, base::Histogram::kUmaTargetedHistogramFlag))
+
+#define UMA_HISTOGRAM_ENUMERATION_COUNT_NO_CACHE(name, sample, count, \
+ boundary_value) \
+ STATIC_HISTOGRAM_POINTER_BLOCK_NO_CACHE(name, AddCount(sample, count), \
+ base::LinearHistogram::FactoryGet(name, 1, boundary_value, \
+ boundary_value + 1, base::HistogramBase::kUmaTargetedHistogramFlag))
+
+#endif // CHROMECAST_BASE_METRICS_CAST_HISTOGRAMS_H_
« no previous file with comments | « chromecast/base/DEPS ('k') | chromecast/base/metrics/cast_metrics_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698