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

Unified Diff: base/metrics/histogram.h

Issue 148063009: first pass histogram shrink (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 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 | base/metrics/histogram.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/metrics/histogram.h
diff --git a/base/metrics/histogram.h b/base/metrics/histogram.h
index 7a6c6885e5ecb74b54c753b5e31a2f7bb2716f3e..e3ac09ec5d052f979ee09c7685c2be5ada5d3e69 100644
--- a/base/metrics/histogram.h
+++ b/base/metrics/histogram.h
@@ -135,6 +135,25 @@ class Lock;
} while (0);
*/
+#define SMALL_STATIC_HISTOGRAM_POINTER_BLOCK(constant_histogram_name, \
+ histogram_add_method_invocation, \
+ histogram_factory_get_name, \
+ ...) \
+ do { \
+ static base::subtle::AtomicWord atomic_histogram_pointer = 0; \
+ base::HistogramBase* histogram_pointer( \
+ reinterpret_cast<base::HistogramBase*>( \
+ base::subtle::Acquire_Load(&atomic_histogram_pointer))); \
+ if (!histogram_pointer) { \
+ histogram_pointer = \
+ histogram_factory_get_name##AndAtomicRelease(&atomic_histogram_pointer, \
+ __VA_ARGS__); \
+ } \
+ DCHECK_EQ(histogram_pointer->histogram_name(), \
+ std::string(constant_histogram_name)); \
+ histogram_pointer->histogram_add_method_invocation; \
+ } while (0)
+
// The above pattern is repeated in several macros. The only elements that
// vary are the invocation of the Add(sample) vs AddTime(sample), and the choice
// of which FactoryGet method to use. The different FactoryGet methods have
@@ -152,7 +171,7 @@ class Lock;
base::subtle::Acquire_Load(&atomic_histogram_pointer))); \
if (!histogram_pointer) { \
histogram_pointer = histogram_factory_get_invocation; \
- base::subtle::Release_Store(&atomic_histogram_pointer, \
+ base::subtle::NoBarrier_Store(&atomic_histogram_pointer, \
reinterpret_cast<base::subtle::AtomicWord>(histogram_pointer)); \
} \
DCHECK_EQ(histogram_pointer->histogram_name(), \
@@ -171,10 +190,17 @@ class Lock;
// For folks that need real specific times, use this to select a precise range
// of times you want plotted, and the number of buckets you want used.
-#define HISTOGRAM_CUSTOM_TIMES(name, sample, min, max, bucket_count) \
- STATIC_HISTOGRAM_POINTER_BLOCK(name, AddTime(sample), \
+#if 1
+#define HISTOGRAM_CUSTOM_TIMES(name, sample, min, max, bucket_count) \
+ STATIC_HISTOGRAM_POINTER_BLOCK(name, AddTime(sample), \
base::Histogram::FactoryTimeGet(name, min, max, bucket_count, \
base::HistogramBase::kNoFlags))
+#else
+#define HISTOGRAM_CUSTOM_TIMES(name, sample, min, max, bucket_count) \
+ SMALL_STATIC_HISTOGRAM_POINTER_BLOCK( \
+ name, AddTime(sample), base::Histogram::FactoryTimeGet, \
+ name, min, max, bucket_count, base::HistogramBase::kNoFlags)
+#endif
#define HISTOGRAM_COUNTS(name, sample) HISTOGRAM_CUSTOM_COUNTS( \
name, sample, 1, 1000000, 50)
@@ -407,6 +433,13 @@ class BASE_EXPORT Histogram : public HistogramBase {
base::TimeDelta maximum,
size_t bucket_count,
int32 flags);
+ static HistogramBase* FactoryTimeGetAndAtomicRelease(
+ base::subtle::AtomicWord* atomic_histogram_pointer,
+ const std::string& name,
+ base::TimeDelta minimum,
+ base::TimeDelta maximum,
+ size_t bucket_count,
+ int32 flags);
// Time call for use with DHISTOGRAM*.
// Returns TimeTicks::Now() in debug and TimeTicks() in release build.
« no previous file with comments | « no previous file | base/metrics/histogram.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698