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

Unified Diff: net/disk_cache/blockfile/histogram_macros.h

Issue 196383016: Put histogram code in disk_cache on a diet. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Restored more code. Created 6 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 | net/disk_cache/blockfile/histogram_macros_v3.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/disk_cache/blockfile/histogram_macros.h
diff --git a/net/disk_cache/blockfile/histogram_macros.h b/net/disk_cache/blockfile/histogram_macros.h
index a5d6f56f5c10ca888b78c97e5c4cb8ac6793d24b..ecffc8f0a4f6ca1d4d052d2472625bfa86b606a0 100644
--- a/net/disk_cache/blockfile/histogram_macros.h
+++ b/net/disk_cache/blockfile/histogram_macros.h
@@ -14,16 +14,11 @@
// -----------------------------------------------------------------------------
// These histograms follow the definition of UMA_HISTOGRAMN_XXX except that
-// whenever the name changes (the experiment group changes), the histrogram
-// object is re-created.
-// Note: These macros are only run on one thread, so the declarations of
-// |counter| was made static (i.e., there will be no race for reinitialization).
+// the counter is not cached locally.
#define CACHE_HISTOGRAM_CUSTOM_COUNTS(name, sample, min, max, bucket_count) \
do { \
- static base::HistogramBase* counter(NULL); \
- if (!counter || name != counter->histogram_name()) \
- counter = base::Histogram::FactoryGet( \
+ base::HistogramBase* counter = base::Histogram::FactoryGet( \
name, min, max, bucket_count, \
base::Histogram::kUmaTargetedHistogramFlag); \
counter->Add(sample); \
@@ -40,9 +35,7 @@
#define CACHE_HISTOGRAM_CUSTOM_TIMES(name, sample, min, max, bucket_count) \
do { \
- static base::HistogramBase* counter(NULL); \
- if (!counter || name != counter->histogram_name()) \
- counter = base::Histogram::FactoryTimeGet( \
+ base::HistogramBase* counter = base::Histogram::FactoryTimeGet( \
name, min, max, bucket_count, \
base::Histogram::kUmaTargetedHistogramFlag); \
counter->AddTime(sample); \
@@ -53,9 +46,7 @@
base::TimeDelta::FromSeconds(10), 50)
#define CACHE_HISTOGRAM_ENUMERATION(name, sample, boundary_value) do { \
- static base::HistogramBase* counter(NULL); \
- if (!counter || name != counter->histogram_name()) \
- counter = base::LinearHistogram::FactoryGet( \
+ base::HistogramBase* counter = base::LinearHistogram::FactoryGet( \
name, 1, boundary_value, boundary_value + 1, \
base::Histogram::kUmaTargetedHistogramFlag); \
counter->Add(sample); \
@@ -98,24 +89,16 @@
const std::string my_name =\
CACHE_UMA_BACKEND_IMPL_OBJ->HistogramName(name, experiment);\
switch (CACHE_UMA_BACKEND_IMPL_OBJ->cache_type()) {\
+ default:\
+ NOTREACHED();\
+ /* Fall-through. */\
case net::DISK_CACHE:\
- CACHE_HISTOGRAM_##type(my_name.data(), sample);\
- break;\
case net::MEDIA_CACHE:\
- CACHE_HISTOGRAM_##type(my_name.data(), sample);\
- break;\
case net::APP_CACHE:\
- CACHE_HISTOGRAM_##type(my_name.data(), sample);\
- break;\
case net::SHADER_CACHE:\
- CACHE_HISTOGRAM_##type(my_name.data(), sample);\
- break;\
case net::PNACL_CACHE:\
CACHE_HISTOGRAM_##type(my_name.data(), sample);\
break;\
- default:\
- NOTREACHED();\
- break;\
}\
}
« no previous file with comments | « no previous file | net/disk_cache/blockfile/histogram_macros_v3.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698