diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-14 04:38:38 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-14 04:38:38 +0000 |
commit | 835d7c811c98f179090c57a827a9c9baa2130435 (patch) | |
tree | edcff6b2c9029c6f867f650d762837f2485d99fb /net | |
parent | 4b1deac7ba7e7a6bf0425e6ed4db26e0c29daa7f (diff) | |
download | chromium_src-835d7c811c98f179090c57a827a9c9baa2130435.zip chromium_src-835d7c811c98f179090c57a827a9c9baa2130435.tar.gz chromium_src-835d7c811c98f179090c57a827a9c9baa2130435.tar.bz2 |
Move Stats, histograms, and field trial into a metrics subdirectory of base and
put them in the base namespace.
TEST=it compiles
BUG=none
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@62510 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
51 files changed, 198 insertions, 179 deletions
diff --git a/net/base/bandwidth_metrics.h b/net/base/bandwidth_metrics.h index c82d1a9..80fa005 100644 --- a/net/base/bandwidth_metrics.h +++ b/net/base/bandwidth_metrics.h @@ -8,7 +8,7 @@ #include <list> -#include "base/histogram.h" +#include "base/metrics/histogram.h" #include "base/logging.h" #include "base/time.h" diff --git a/net/base/connection_type_histograms.cc b/net/base/connection_type_histograms.cc index de780f2..5146e91e 100644 --- a/net/base/connection_type_histograms.cc +++ b/net/base/connection_type_histograms.cc @@ -4,7 +4,7 @@ #include "net/base/connection_type_histograms.h" -#include "base/histogram.h" +#include "base/metrics/histogram.h" namespace net { diff --git a/net/base/cookie_monster.cc b/net/base/cookie_monster.cc index fae7671..455a739 100644 --- a/net/base/cookie_monster.cc +++ b/net/base/cookie_monster.cc @@ -48,8 +48,8 @@ #include "base/basictypes.h" #include "base/format_macros.h" -#include "base/histogram.h" #include "base/logging.h" +#include "base/metrics/histogram.h" #include "base/scoped_ptr.h" #include "base/string_tokenizer.h" #include "base/string_util.h" @@ -148,49 +148,49 @@ CookieMonster::~CookieMonster() { // initialization is based are included in comments below. void CookieMonster::InitializeHistograms() { // From UMA_HISTOGRAM_CUSTOM_COUNTS - histogram_expiration_duration_minutes_ = Histogram::FactoryGet( + histogram_expiration_duration_minutes_ = base::Histogram::FactoryGet( "Cookie.ExpirationDurationMinutes", 1, kMinutesInTenYears, 50, - Histogram::kUmaTargetedHistogramFlag); - histogram_between_access_interval_minutes_ = Histogram::FactoryGet( + base::Histogram::kUmaTargetedHistogramFlag); + histogram_between_access_interval_minutes_ = base::Histogram::FactoryGet( "Cookie.BetweenAccessIntervalMinutes", 1, kMinutesInTenYears, 50, - Histogram::kUmaTargetedHistogramFlag); - histogram_evicted_last_access_minutes_ = Histogram::FactoryGet( + base::Histogram::kUmaTargetedHistogramFlag); + histogram_evicted_last_access_minutes_ = base::Histogram::FactoryGet( "Cookie.EvictedLastAccessMinutes", 1, kMinutesInTenYears, 50, - Histogram::kUmaTargetedHistogramFlag); - histogram_count_ = Histogram::FactoryGet( + base::Histogram::kUmaTargetedHistogramFlag); + histogram_count_ = base::Histogram::FactoryGet( "Cookie.Count", 1, 4000, 50, - Histogram::kUmaTargetedHistogramFlag); - histogram_domain_count_ = Histogram::FactoryGet( + base::Histogram::kUmaTargetedHistogramFlag); + histogram_domain_count_ = base::Histogram::FactoryGet( "Cookie.DomainCount", 1, 4000, 50, - Histogram::kUmaTargetedHistogramFlag); - histogram_etldp1_count_ = Histogram::FactoryGet( + base::Histogram::kUmaTargetedHistogramFlag); + histogram_etldp1_count_ = base::Histogram::FactoryGet( "Cookie.Etldp1Count", 1, 4000, 50, - Histogram::kUmaTargetedHistogramFlag); - histogram_domain_per_etldp1_count_ = Histogram::FactoryGet( + base::Histogram::kUmaTargetedHistogramFlag); + histogram_domain_per_etldp1_count_ = base::Histogram::FactoryGet( "Cookie.DomainPerEtldp1Count", 1, 4000, 50, - Histogram::kUmaTargetedHistogramFlag); + base::Histogram::kUmaTargetedHistogramFlag); // From UMA_HISTOGRAM_COUNTS_10000 & UMA_HISTOGRAM_CUSTOM_COUNTS - histogram_number_duplicate_db_cookies_ = Histogram::FactoryGet( + histogram_number_duplicate_db_cookies_ = base::Histogram::FactoryGet( "Net.NumDuplicateCookiesInDb", 1, 10000, 50, - Histogram::kUmaTargetedHistogramFlag); + base::Histogram::kUmaTargetedHistogramFlag); // From UMA_HISTOGRAM_ENUMERATION - histogram_cookie_deletion_cause_ = LinearHistogram::FactoryGet( + histogram_cookie_deletion_cause_ = base::LinearHistogram::FactoryGet( "Cookie.DeletionCause", 1, DELETE_COOKIE_LAST_ENTRY - 1, DELETE_COOKIE_LAST_ENTRY, - Histogram::kUmaTargetedHistogramFlag); + base::Histogram::kUmaTargetedHistogramFlag); // From UMA_HISTOGRAM_{CUSTOM_,}TIMES - histogram_time_get_ = Histogram::FactoryTimeGet("Cookie.TimeGet", + histogram_time_get_ = base::Histogram::FactoryTimeGet("Cookie.TimeGet", base::TimeDelta::FromMilliseconds(1), base::TimeDelta::FromMinutes(1), - 50, Histogram::kUmaTargetedHistogramFlag); - histogram_time_load_ = Histogram::FactoryTimeGet("Cookie.TimeLoad", + 50, base::Histogram::kUmaTargetedHistogramFlag); + histogram_time_load_ = base::Histogram::FactoryTimeGet("Cookie.TimeLoad", base::TimeDelta::FromMilliseconds(1), base::TimeDelta::FromMinutes(1), - 50, Histogram::kUmaTargetedHistogramFlag); + 50, base::Histogram::kUmaTargetedHistogramFlag); } void CookieMonster::InitStore() { diff --git a/net/base/cookie_monster.h b/net/base/cookie_monster.h index 33953d9..2f18283 100644 --- a/net/base/cookie_monster.h +++ b/net/base/cookie_monster.h @@ -22,7 +22,10 @@ #include "net/base/cookie_store.h" class GURL; + +namespace base { class Histogram; +} namespace net { @@ -409,17 +412,17 @@ class CookieMonster : public CookieStore { // Histogram variables; see CookieMonster::InitializeHistograms() in // cookie_monster.cc for details. - scoped_refptr<Histogram> histogram_expiration_duration_minutes_; - scoped_refptr<Histogram> histogram_between_access_interval_minutes_; - scoped_refptr<Histogram> histogram_evicted_last_access_minutes_; - scoped_refptr<Histogram> histogram_count_; - scoped_refptr<Histogram> histogram_domain_count_; - scoped_refptr<Histogram> histogram_etldp1_count_; - scoped_refptr<Histogram> histogram_domain_per_etldp1_count_; - scoped_refptr<Histogram> histogram_number_duplicate_db_cookies_; - scoped_refptr<Histogram> histogram_cookie_deletion_cause_; - scoped_refptr<Histogram> histogram_time_get_; - scoped_refptr<Histogram> histogram_time_load_; + scoped_refptr<base::Histogram> histogram_expiration_duration_minutes_; + scoped_refptr<base::Histogram> histogram_between_access_interval_minutes_; + scoped_refptr<base::Histogram> histogram_evicted_last_access_minutes_; + scoped_refptr<base::Histogram> histogram_count_; + scoped_refptr<base::Histogram> histogram_domain_count_; + scoped_refptr<base::Histogram> histogram_etldp1_count_; + scoped_refptr<base::Histogram> histogram_domain_per_etldp1_count_; + scoped_refptr<base::Histogram> histogram_number_duplicate_db_cookies_; + scoped_refptr<base::Histogram> histogram_cookie_deletion_cause_; + scoped_refptr<base::Histogram> histogram_time_get_; + scoped_refptr<base::Histogram> histogram_time_load_; // Initialize the above variables; should only be called from // the constructor. diff --git a/net/base/file_stream_posix.cc b/net/base/file_stream_posix.cc index 45c4cfb..1e20efe 100644 --- a/net/base/file_stream_posix.cc +++ b/net/base/file_stream_posix.cc @@ -17,9 +17,9 @@ #include "base/callback.h" #include "base/eintr_wrapper.h" #include "base/file_path.h" -#include "base/histogram.h" #include "base/logging.h" #include "base/message_loop.h" +#include "base/metrics/histogram.h" #include "base/string_util.h" #include "base/waitable_event.h" #include "base/worker_pool.h" diff --git a/net/base/file_stream_win.cc b/net/base/file_stream_win.cc index 234ddf9..9408ae0 100644 --- a/net/base/file_stream_win.cc +++ b/net/base/file_stream_win.cc @@ -7,9 +7,9 @@ #include <windows.h> #include "base/file_path.h" -#include "base/histogram.h" #include "base/logging.h" #include "base/message_loop.h" +#include "base/metrics/histogram.h" #include "net/base/net_errors.h" namespace net { diff --git a/net/base/host_resolver_impl.cc b/net/base/host_resolver_impl.cc index 6d1e2ba..e3e3a94 100644 --- a/net/base/host_resolver_impl.cc +++ b/net/base/host_resolver_impl.cc @@ -17,9 +17,9 @@ #include "base/basictypes.h" #include "base/compiler_specific.h" #include "base/debug_util.h" -#include "base/histogram.h" #include "base/lock.h" #include "base/message_loop.h" +#include "base/metrics/histogram.h" #include "base/stl_util-inl.h" #include "base/string_util.h" #include "base/time.h" diff --git a/net/base/mime_sniffer.cc b/net/base/mime_sniffer.cc index 4ad4e1d..1a52b99 100644 --- a/net/base/mime_sniffer.cc +++ b/net/base/mime_sniffer.cc @@ -97,8 +97,8 @@ #include "net/base/mime_sniffer.h" #include "base/basictypes.h" -#include "base/histogram.h" #include "base/logging.h" +#include "base/metrics/histogram.h" #include "base/string_util.h" #include "googleurl/src/gurl.h" #include "net/base/mime_util.h" @@ -207,11 +207,11 @@ static const MagicNumber kSniffableTags[] = { MAGIC_HTML_TAG("p") // Mozilla }; -static scoped_refptr<Histogram> UMASnifferHistogramGet(const char* name, - int array_size) { - scoped_refptr<Histogram> counter = - LinearHistogram::FactoryGet(name, 1, array_size - 1, array_size, - Histogram::kUmaTargetedHistogramFlag); +static scoped_refptr<base::Histogram> UMASnifferHistogramGet(const char* name, + int array_size) { + scoped_refptr<base::Histogram> counter = + base::LinearHistogram::FactoryGet(name, 1, array_size - 1, array_size, + base::Histogram::kUmaTargetedHistogramFlag); return counter; } @@ -251,7 +251,7 @@ static bool MatchMagicNumber(const char* content, size_t size, static bool CheckForMagicNumbers(const char* content, size_t size, const MagicNumber* magic, size_t magic_len, - Histogram* counter, std::string* result) { + base::Histogram* counter, std::string* result) { for (size_t i = 0; i < magic_len; ++i) { if (MatchMagicNumber(content, size, &(magic[i]), result)) { if (counter) counter->Add(static_cast<int>(i)); @@ -292,7 +292,7 @@ static bool SniffForHTML(const char* content, if (!IsAsciiWhitespace(*pos)) break; } - static scoped_refptr<Histogram> counter = + static scoped_refptr<base::Histogram> counter = UMASnifferHistogramGet("mime_sniffer.kSniffableTags2", arraysize(kSniffableTags)); // |pos| now points to first non-whitespace character (or at end). @@ -310,7 +310,7 @@ static bool SniffForMagicNumbers(const char* content, *have_enough_content &= TruncateSize(kBytesRequiredForMagic, &size); // Check our big table of Magic Numbers - static scoped_refptr<Histogram> counter = + static scoped_refptr<base::Histogram> counter = UMASnifferHistogramGet("mime_sniffer.kMagicNumbers2", arraysize(kMagicNumbers)); return CheckForMagicNumbers(content, size, @@ -351,7 +351,7 @@ static bool SniffXML(const char* content, // We want to skip XML processing instructions (of the form "<?xml ...") // and stop at the first "plain" tag, then make a decision on the mime-type // based on the name (or possibly attributes) of that tag. - static scoped_refptr<Histogram> counter = + static scoped_refptr<base::Histogram> counter = UMASnifferHistogramGet("mime_sniffer.kMagicXML2", arraysize(kMagicXML)); const int kMaxTagIterations = 5; @@ -435,7 +435,7 @@ static bool SniffBinary(const char* content, const bool is_truncated = TruncateSize(kMaxBytesToSniff, &size); // First, we look for a BOM. - static scoped_refptr<Histogram> counter = + static scoped_refptr<base::Histogram> counter = UMASnifferHistogramGet("mime_sniffer.kByteOrderMark2", arraysize(kByteOrderMark)); std::string unused; @@ -477,7 +477,7 @@ static bool IsUnknownMimeType(const std::string& mime_type) { // Firefox rejects a mime type if it is exactly */* "*/*", }; - static scoped_refptr<Histogram> counter = + static scoped_refptr<base::Histogram> counter = UMASnifferHistogramGet("mime_sniffer.kUnknownMimeTypes2", arraysize(kUnknownMimeTypes) + 1); for (size_t i = 0; i < arraysize(kUnknownMimeTypes); ++i) { @@ -503,7 +503,7 @@ static bool SniffCRX(const char* content, const std::string& type_hint, bool* have_enough_content, std::string* result) { - static scoped_refptr<Histogram> counter = + static scoped_refptr<base::Histogram> counter = UMASnifferHistogramGet("mime_sniffer.kSniffCRX", 3); // Technically, the crx magic number is just Cr24, but the bytes after that @@ -541,7 +541,7 @@ static bool SniffCRX(const char* content, } bool ShouldSniffMimeType(const GURL& url, const std::string& mime_type) { - static scoped_refptr<Histogram> should_sniff_counter = + static scoped_refptr<base::Histogram> should_sniff_counter = UMASnifferHistogramGet("mime_sniffer.ShouldSniffMimeType2", 3); // We are willing to sniff the mime type for HTTP, HTTPS, and FTP bool sniffable_scheme = url.is_empty() || @@ -566,7 +566,7 @@ bool ShouldSniffMimeType(const GURL& url, const std::string& mime_type) { "text/xml", "application/xml", }; - static scoped_refptr<Histogram> counter = + static scoped_refptr<base::Histogram> counter = UMASnifferHistogramGet("mime_sniffer.kSniffableTypes2", arraysize(kSniffableTypes) + 1); for (size_t i = 0; i < arraysize(kSniffableTypes); ++i) { diff --git a/net/base/net_util.cc b/net/base/net_util.cc index 9afae4c..27621e6 100644 --- a/net/base/net_util.cc +++ b/net/base/net_util.cc @@ -34,7 +34,6 @@ #include "base/basictypes.h" #include "base/file_path.h" #include "base/file_util.h" -#include "base/histogram.h" #include "base/i18n/file_util_icu.h" #include "base/i18n/icu_string_conversions.h" #include "base/i18n/time_formatting.h" @@ -42,6 +41,7 @@ #include "base/lock.h" #include "base/logging.h" #include "base/message_loop.h" +#include "base/metrics/histogram.h" #include "base/path_service.h" #include "base/singleton.h" #include "base/stl_util-inl.h" diff --git a/net/base/run_all_unittests.cc b/net/base/run_all_unittests.cc index 5f2207d..685d8df 100644 --- a/net/base/run_all_unittests.cc +++ b/net/base/run_all_unittests.cc @@ -3,7 +3,7 @@ // found in the LICENSE file. #include "build/build_config.h" -#include "base/histogram.h" +#include "base/metrics/histogram.h" #include "base/nss_util.h" #include "net/base/net_test_suite.h" #include "net/http/http_stream_factory.h" @@ -13,7 +13,7 @@ int main(int argc, char** argv) { // Record histograms, so we can get histograms data in tests. - StatisticsRecorder recorder; + base::StatisticsRecorder recorder; NetTestSuite test_suite(argc, argv); #if defined(OS_WIN) diff --git a/net/base/sdch_filter.cc b/net/base/sdch_filter.cc index a2b13d4..cc9a1d6 100644 --- a/net/base/sdch_filter.cc +++ b/net/base/sdch_filter.cc @@ -7,8 +7,8 @@ #include <algorithm> #include "base/file_util.h" -#include "base/histogram.h" #include "base/logging.h" +#include "base/metrics/histogram.h" #include "net/base/sdch_filter.h" #include "net/base/sdch_manager.h" diff --git a/net/base/sdch_manager.cc b/net/base/sdch_manager.cc index 21cbe07..15850d6 100644 --- a/net/base/sdch_manager.cc +++ b/net/base/sdch_manager.cc @@ -5,9 +5,8 @@ #include "net/base/sdch_manager.h" #include "base/base64.h" -#include "base/field_trial.h" -#include "base/histogram.h" #include "base/logging.h" +#include "base/metrics/histogram.h" #include "base/sha2.h" #include "base/string_number_conversions.h" #include "base/string_util.h" diff --git a/net/base/x509_certificate.cc b/net/base/x509_certificate.cc index 6395b97..e21a3bc 100644 --- a/net/base/x509_certificate.cc +++ b/net/base/x509_certificate.cc @@ -6,8 +6,8 @@ #include <map> -#include "base/histogram.h" #include "base/logging.h" +#include "base/metrics/histogram.h" #include "base/singleton.h" #include "base/string_piece.h" #include "base/time.h" diff --git a/net/disk_cache/backend_impl.cc b/net/disk_cache/backend_impl.cc index 5086e2b..2ad91e0 100644 --- a/net/disk_cache/backend_impl.cc +++ b/net/disk_cache/backend_impl.cc @@ -4,11 +4,11 @@ #include "net/disk_cache/backend_impl.h" -#include "base/field_trial.h" #include "base/file_path.h" #include "base/file_util.h" -#include "base/histogram.h" #include "base/message_loop.h" +#include "base/metrics/field_trial.h" +#include "base/metrics/histogram.h" #include "base/rand_util.h" #include "base/string_util.h" #include "base/stringprintf.h" @@ -192,11 +192,12 @@ bool SetFieldTrialInfo(int size_group) { // Field trials involve static objects so we have to do this only once. first = false; - scoped_refptr<FieldTrial> trial1 = new FieldTrial("CacheSize", 10); + scoped_refptr<base::FieldTrial> trial1 = + new base::FieldTrial("CacheSize", 10); std::string group1 = base::StringPrintf("CacheSizeGroup_%d", size_group); - trial1->AppendGroup(group1, FieldTrial::kAllRemainingProbability); + trial1->AppendGroup(group1, base::FieldTrial::kAllRemainingProbability); - scoped_refptr<FieldTrial> trial2 = new FieldTrial("CacheThrottle", 100); + scoped_refptr<base::FieldTrial> trial2 = new base::FieldTrial("CacheThrottle", 100); int group2a = trial2->AppendGroup("CacheThrottle_On", 10); // 10 % in. trial2->AppendGroup("CacheThrottle_Off", 10); // 10 % control. @@ -1235,9 +1236,9 @@ void BackendImpl::OnOperationCompleted(base::TimeDelta elapsed_time) { if (cache_type() != net::DISK_CACHE) return; - UMA_HISTOGRAM_TIMES( - FieldTrial::MakeName("DiskCache.TotalIOTime", "CacheThrottle").data(), - elapsed_time); + UMA_HISTOGRAM_TIMES(base::FieldTrial::MakeName("DiskCache.TotalIOTime", + "CacheThrottle").data(), + elapsed_time); if (!throttle_requests_) return; diff --git a/net/disk_cache/block_files.cc b/net/disk_cache/block_files.cc index 2b849fc..9d5de62 100644 --- a/net/disk_cache/block_files.cc +++ b/net/disk_cache/block_files.cc @@ -5,7 +5,7 @@ #include "net/disk_cache/block_files.h" #include "base/file_util.h" -#include "base/histogram.h" +#include "base/metrics/histogram.h" #include "base/string_util.h" #include "base/stringprintf.h" #include "base/thread_checker.h" diff --git a/net/disk_cache/entry_impl.cc b/net/disk_cache/entry_impl.cc index 24796ea..7fabbe5 100644 --- a/net/disk_cache/entry_impl.cc +++ b/net/disk_cache/entry_impl.cc @@ -4,8 +4,8 @@ #include "net/disk_cache/entry_impl.h" -#include "base/histogram.h" #include "base/message_loop.h" +#include "base/metrics/histogram.h" #include "base/string_util.h" #include "net/base/io_buffer.h" #include "net/base/net_errors.h" diff --git a/net/disk_cache/histogram_macros.h b/net/disk_cache/histogram_macros.h index 2505a8a..044302c 100644 --- a/net/disk_cache/histogram_macros.h +++ b/net/disk_cache/histogram_macros.h @@ -20,10 +20,11 @@ #define CACHE_HISTOGRAM_CUSTOM_COUNTS(name, sample, min, max, bucket_count) \ do { \ - static scoped_refptr<Histogram> counter; \ + static scoped_refptr<base::Histogram> counter; \ if (!counter || name != counter->histogram_name()) \ - counter = Histogram::FactoryGet(name, min, max, bucket_count, \ - Histogram::kUmaTargetedHistogramFlag); \ + counter = base::Histogram::FactoryGet( \ + name, min, max, bucket_count, \ + base::Histogram::kUmaTargetedHistogramFlag); \ counter->Add(sample); \ } while (0) @@ -38,10 +39,11 @@ #define CACHE_HISTOGRAM_CUSTOM_TIMES(name, sample, min, max, bucket_count) \ do { \ - static scoped_refptr<Histogram> counter; \ + static scoped_refptr<base::Histogram> counter; \ if (!counter || name != counter->histogram_name()) \ - counter = Histogram::FactoryTimeGet(name, min, max, bucket_count, \ - Histogram::kUmaTargetedHistogramFlag); \ + counter = base::Histogram::FactoryTimeGet( \ + name, min, max, bucket_count, \ + base::Histogram::kUmaTargetedHistogramFlag); \ counter->AddTime(sample); \ } while (0) @@ -50,11 +52,11 @@ base::TimeDelta::FromSeconds(10), 50) #define CACHE_HISTOGRAM_ENUMERATION(name, sample, boundary_value) do { \ - static scoped_refptr<Histogram> counter; \ + static scoped_refptr<base::Histogram> counter; \ if (!counter || name != counter->histogram_name()) \ - counter = LinearHistogram::FactoryGet( \ + counter = base::LinearHistogram::FactoryGet( \ name, 1, boundary_value, boundary_value + 1, \ - Histogram::kUmaTargetedHistogramFlag); \ + base::Histogram::kUmaTargetedHistogramFlag); \ counter->Add(sample); \ } while (0) @@ -70,12 +72,13 @@ // HISTOGRAM_AGE will collect time elapsed since |initial_time|, with a // granularity of hours and normal values of a few months. #define CACHE_HISTOGRAM_AGE(name, initial_time) \ - CACHE_HISTOGRAM_COUNTS_10000(name, (Time::Now() - initial_time).InHours()) + CACHE_HISTOGRAM_COUNTS_10000(name, \ + (base::Time::Now() - initial_time).InHours()) // HISTOGRAM_AGE_MS will collect time elapsed since |initial_time|, with the // normal resolution of the UMA_HISTOGRAM_TIMES. #define CACHE_HISTOGRAM_AGE_MS(name, initial_time)\ - CACHE_HISTOGRAM_TIMES(name, TimeTicks::Now() - initial_time) + CACHE_HISTOGRAM_TIMES(name, base::TimeTicks::Now() - initial_time) #define CACHE_HISTOGRAM_CACHE_ERROR(name, sample) \ CACHE_HISTOGRAM_ENUMERATION(name, sample, 50) diff --git a/net/disk_cache/rankings.cc b/net/disk_cache/rankings.cc index 5c0313b..1e9e06b 100644 --- a/net/disk_cache/rankings.cc +++ b/net/disk_cache/rankings.cc @@ -4,7 +4,7 @@ #include "net/disk_cache/rankings.h" -#include "base/histogram.h" +#include "base/metrics/histogram.h" #include "net/disk_cache/backend_impl.h" #include "net/disk_cache/entry_impl.h" #include "net/disk_cache/errors.h" diff --git a/net/disk_cache/stats_histogram.cc b/net/disk_cache/stats_histogram.cc index e6eaf90..06ed1b3 100644 --- a/net/disk_cache/stats_histogram.cc +++ b/net/disk_cache/stats_histogram.cc @@ -9,6 +9,9 @@ namespace disk_cache { +using base::Histogram; +using base::StatisticsRecorder; + // Static. const Stats* StatsHistogram::stats_ = NULL; diff --git a/net/disk_cache/stats_histogram.h b/net/disk_cache/stats_histogram.h index 1c2e15a..cbd8f03 100644 --- a/net/disk_cache/stats_histogram.h +++ b/net/disk_cache/stats_histogram.h @@ -8,7 +8,7 @@ #include <string> -#include "base/histogram.h" +#include "base/metrics/histogram.h" namespace disk_cache { @@ -21,7 +21,7 @@ class Stats; // Class derivation of Histogram "deprecated," and should not be copied, and // may eventually go away. // -class StatsHistogram : public Histogram { +class StatsHistogram : public base::Histogram { public: class StatsSamples : public SampleSet { public: @@ -46,8 +46,6 @@ class StatsHistogram : public Histogram { virtual void SnapshotSample(SampleSet* sample) const; private: - friend class Histogram; - bool init_; static const Stats* stats_; DISALLOW_COPY_AND_ASSIGN(StatsHistogram); diff --git a/net/ftp/ftp_network_transaction.cc b/net/ftp/ftp_network_transaction.cc index 8812843..7197ae9b 100644 --- a/net/ftp/ftp_network_transaction.cc +++ b/net/ftp/ftp_network_transaction.cc @@ -5,7 +5,7 @@ #include "net/ftp/ftp_network_transaction.h" #include "base/compiler_specific.h" -#include "base/histogram.h" +#include "base/metrics/histogram.h" #include "base/string_number_conversions.h" #include "base/string_util.h" #include "base/utf_string_conversions.h" diff --git a/net/ftp/ftp_server_type_histograms.cc b/net/ftp/ftp_server_type_histograms.cc index de90d72..591545b 100644 --- a/net/ftp/ftp_server_type_histograms.cc +++ b/net/ftp/ftp_server_type_histograms.cc @@ -4,7 +4,7 @@ #include "net/ftp/ftp_server_type_histograms.h" -#include "base/histogram.h" +#include "base/metrics/histogram.h" namespace net { diff --git a/net/http/http_auth_controller.cc b/net/http/http_auth_controller.cc index 736ffa9..545ae2a 100644 --- a/net/http/http_auth_controller.cc +++ b/net/http/http_auth_controller.cc @@ -4,7 +4,7 @@ #include "net/http/http_auth_controller.h" -#include "base/histogram.h" +#include "base/metrics/histogram.h" #include "base/string_util.h" #include "base/utf_string_conversions.h" #include "net/base/auth.h" diff --git a/net/http/http_auth_handler.cc b/net/http/http_auth_handler.cc index ccb8766..d6e6a62 100644 --- a/net/http/http_auth_handler.cc +++ b/net/http/http_auth_handler.cc @@ -4,8 +4,8 @@ #include "net/http/http_auth_handler.h" -#include "base/histogram.h" #include "base/logging.h" +#include "base/metrics/histogram.h" #include "base/string_util.h" #include "base/stringprintf.h" #include "net/base/net_errors.h" @@ -52,11 +52,11 @@ bool HttpAuthHandler::InitFromChallenge( DCHECK(!ok || properties_ != -1); if (ok) - histogram_ = Histogram::FactoryTimeGet( + histogram_ = base::Histogram::FactoryTimeGet( GenerateHistogramNameFromScheme(scheme()), base::TimeDelta::FromMilliseconds(1), base::TimeDelta::FromSeconds(10), 50, - Histogram::kUmaTargetedHistogramFlag); + base::Histogram::kUmaTargetedHistogramFlag); return ok; } diff --git a/net/http/http_auth_handler.h b/net/http/http_auth_handler.h index 4c03a01..908b065 100644 --- a/net/http/http_auth_handler.h +++ b/net/http/http_auth_handler.h @@ -14,7 +14,9 @@ #include "net/base/net_log.h" #include "net/http/http_auth.h" +namespace base { class Histogram; +} namespace net { @@ -187,7 +189,7 @@ class HttpAuthHandler { CompletionCallbackImpl<HttpAuthHandler> wrapper_callback_; // When GenerateAuthToken was called. base::TimeTicks generate_auth_token_start_; - scoped_refptr<Histogram> histogram_; + scoped_refptr<base::Histogram> histogram_; }; } // namespace net diff --git a/net/http/http_cache_transaction.cc b/net/http/http_cache_transaction.cc index 138cd13..5d05616 100644 --- a/net/http/http_cache_transaction.cc +++ b/net/http/http_cache_transaction.cc @@ -13,8 +13,8 @@ #include <string> #include "base/compiler_specific.h" -#include "base/field_trial.h" -#include "base/histogram.h" +#include "base/metrics/field_trial.h" +#include "base/metrics/histogram.h" #include "base/ref_counted.h" #include "base/string_util.h" #include "base/time.h" @@ -856,11 +856,11 @@ int HttpCache::Transaction::DoAddToEntryComplete(int result) { base::TimeTicks::Now() - entry_lock_waiting_since_; UMA_HISTOGRAM_TIMES("HttpCache.EntryLockWait", entry_lock_wait); static const bool prefetching_fieldtrial = - FieldTrialList::Find("Prefetch") && - !FieldTrialList::Find("Prefetch")->group_name().empty(); + base::FieldTrialList::Find("Prefetch") && + !base::FieldTrialList::Find("Prefetch")->group_name().empty(); if (prefetching_fieldtrial) { UMA_HISTOGRAM_TIMES( - FieldTrial::MakeName("HttpCache.EntryLockWait", "Prefetch"), + base::FieldTrial::MakeName("HttpCache.EntryLockWait", "Prefetch"), entry_lock_wait); } diff --git a/net/http/http_network_layer.cc b/net/http/http_network_layer.cc index cf93500..38f95ef 100644 --- a/net/http/http_network_layer.cc +++ b/net/http/http_network_layer.cc @@ -4,7 +4,6 @@ #include "net/http/http_network_layer.h" -#include "base/field_trial.h" #include "base/logging.h" #include "base/string_split.h" #include "base/string_util.h" diff --git a/net/http/http_network_transaction.cc b/net/http/http_network_transaction.cc index 8ef9aca..bf1c0e9 100644 --- a/net/http/http_network_transaction.cc +++ b/net/http/http_network_transaction.cc @@ -8,11 +8,11 @@ #include <vector> #include "base/compiler_specific.h" -#include "base/field_trial.h" #include "base/format_macros.h" -#include "base/histogram.h" +#include "base/metrics/field_trial.h" +#include "base/metrics/histogram.h" +#include "base/metrics/stats_counters.h" #include "base/scoped_ptr.h" -#include "base/stats_counters.h" #include "base/stl_util-inl.h" #include "base/string_number_conversions.h" #include "base/string_util.h" @@ -976,11 +976,11 @@ void HttpNetworkTransaction::LogTransactionConnectedMetrics() { 100); static bool use_conn_impact_histogram( - FieldTrialList::Find("ConnCountImpact") && - !FieldTrialList::Find("ConnCountImpact")->group_name().empty()); + base::FieldTrialList::Find("ConnCountImpact") && + !base::FieldTrialList::Find("ConnCountImpact")->group_name().empty()); if (use_conn_impact_histogram) { UMA_HISTOGRAM_CLIPPED_TIMES( - FieldTrial::MakeName("Net.Transaction_Connected_New", + base::FieldTrial::MakeName("Net.Transaction_Connected_New", "ConnCountImpact"), total_duration, base::TimeDelta::FromMilliseconds(1), base::TimeDelta::FromMinutes(10), @@ -988,17 +988,19 @@ void HttpNetworkTransaction::LogTransactionConnectedMetrics() { } } - static bool use_spdy_histogram(FieldTrialList::Find("SpdyImpact") && - !FieldTrialList::Find("SpdyImpact")->group_name().empty()); + static bool use_spdy_histogram(base::FieldTrialList::Find("SpdyImpact") && + !base::FieldTrialList::Find("SpdyImpact")->group_name().empty()); if (use_spdy_histogram && response_.was_npn_negotiated) { UMA_HISTOGRAM_CLIPPED_TIMES( - FieldTrial::MakeName("Net.Transaction_Connected_Under_10", "SpdyImpact"), + base::FieldTrial::MakeName("Net.Transaction_Connected_Under_10", + "SpdyImpact"), total_duration, base::TimeDelta::FromMilliseconds(1), base::TimeDelta::FromMinutes(10), 100); if (!reused_socket) { UMA_HISTOGRAM_CLIPPED_TIMES( - FieldTrial::MakeName("Net.Transaction_Connected_New", "SpdyImpact"), + base::FieldTrial::MakeName("Net.Transaction_Connected_New", + "SpdyImpact"), total_duration, base::TimeDelta::FromMilliseconds(1), base::TimeDelta::FromMinutes(10), 100); } diff --git a/net/http/http_stream_parser.cc b/net/http/http_stream_parser.cc index 512f509..0e7610c 100644 --- a/net/http/http_stream_parser.cc +++ b/net/http/http_stream_parser.cc @@ -5,7 +5,7 @@ #include "net/http/http_stream_parser.h" #include "base/compiler_specific.h" -#include "base/histogram.h" +#include "base/metrics/histogram.h" #include "net/base/auth.h" #include "net/base/io_buffer.h" #include "net/base/ssl_cert_request_info.h" diff --git a/net/ocsp/nss_ocsp.cc b/net/ocsp/nss_ocsp.cc index 3faeb54..fbb734f 100644 --- a/net/ocsp/nss_ocsp.cc +++ b/net/ocsp/nss_ocsp.cc @@ -17,11 +17,11 @@ #include "base/basictypes.h" #include "base/compiler_specific.h" #include "base/condition_variable.h" -#include "base/histogram.h" #include "base/lazy_instance.h" #include "base/lock.h" #include "base/logging.h" #include "base/message_loop.h" +#include "base/metrics/histogram.h" #include "base/string_util.h" #include "base/stringprintf.h" #include "base/thread.h" diff --git a/net/proxy/proxy_resolver_winhttp.cc b/net/proxy/proxy_resolver_winhttp.cc index 4307b5e..962271f 100644 --- a/net/proxy/proxy_resolver_winhttp.cc +++ b/net/proxy/proxy_resolver_winhttp.cc @@ -7,7 +7,7 @@ #include <windows.h> #include <winhttp.h> -#include "base/histogram.h" +#include "base/metrics/histogram.h" #include "base/string_util.h" #include "base/utf_string_conversions.h" #include "googleurl/src/gurl.h" diff --git a/net/proxy/proxy_service.cc b/net/proxy/proxy_service.cc index 2884d27..632e63b 100644 --- a/net/proxy/proxy_service.cc +++ b/net/proxy/proxy_service.cc @@ -9,7 +9,6 @@ #include "base/compiler_specific.h" #include "base/logging.h" #include "base/values.h" -#include "base/histogram.h" #include "base/message_loop.h" #include "base/string_util.h" #include "googleurl/src/gurl.h" diff --git a/net/socket/client_socket.cc b/net/socket/client_socket.cc index 0edee70..8be3ae1 100644 --- a/net/socket/client_socket.cc +++ b/net/socket/client_socket.cc @@ -4,8 +4,8 @@ #include "net/socket/client_socket.h" -#include "base/field_trial.h" -#include "base/histogram.h" +#include "base/metrics/field_trial.h" +#include "base/metrics/histogram.h" namespace net { @@ -46,12 +46,12 @@ void ClientSocket::UseHistory::EmitPreconnectionHistograms() const { UMA_HISTOGRAM_ENUMERATION("Net.PreconnectUtilization2", result, 9); static const bool connect_backup_jobs_fieldtrial = - FieldTrialList::Find("ConnnectBackupJobs") && - !FieldTrialList::Find("ConnnectBackupJobs")->group_name().empty(); + base::FieldTrialList::Find("ConnnectBackupJobs") && + !base::FieldTrialList::Find("ConnnectBackupJobs")->group_name().empty(); if (connect_backup_jobs_fieldtrial) { UMA_HISTOGRAM_ENUMERATION( - FieldTrial::MakeName("Net.PreconnectUtilization2", - "ConnnectBackupJobs"), + base::FieldTrial::MakeName("Net.PreconnectUtilization2", + "ConnnectBackupJobs"), result, 9); } } diff --git a/net/socket/client_socket_handle.cc b/net/socket/client_socket_handle.cc index f9ab8985..6184905 100644 --- a/net/socket/client_socket_handle.cc +++ b/net/socket/client_socket_handle.cc @@ -5,7 +5,7 @@ #include "net/socket/client_socket_handle.h" #include "base/compiler_specific.h" -#include "base/histogram.h" +#include "base/metrics/histogram.h" #include "base/logging.h" #include "net/base/net_errors.h" #include "net/socket/client_socket_pool.h" diff --git a/net/socket/client_socket_pool_base.cc b/net/socket/client_socket_pool_base.cc index 13d8b68..75abae6d 100644 --- a/net/socket/client_socket_pool_base.cc +++ b/net/socket/client_socket_pool_base.cc @@ -7,7 +7,7 @@ #include "base/compiler_specific.h" #include "base/format_macros.h" #include "base/message_loop.h" -#include "base/stats_counters.h" +#include "base/metrics/stats_counters.h" #include "base/stl_util-inl.h" #include "base/string_util.h" #include "base/time.h" diff --git a/net/socket/client_socket_pool_histograms.cc b/net/socket/client_socket_pool_histograms.cc index 873bd5b..202112b 100644 --- a/net/socket/client_socket_pool_histograms.cc +++ b/net/socket/client_socket_pool_histograms.cc @@ -6,12 +6,15 @@ #include <string> -#include "base/field_trial.h" -#include "base/histogram.h" +#include "base/metrics/field_trial.h" +#include "base/metrics/histogram.h" #include "net/socket/client_socket_handle.h" namespace net { +using base::Histogram; +using base::LinearHistogram; + ClientSocketPoolHistograms::ClientSocketPoolHistograms( const std::string& pool_name) : is_http_proxy_connection_(false), @@ -56,11 +59,12 @@ void ClientSocketPoolHistograms::AddRequestTime(base::TimeDelta time) const { request_time_->AddTime(time); static bool proxy_connection_impact_trial_exists( - FieldTrialList::Find("ProxyConnectionImpact") && - !FieldTrialList::Find("ProxyConnectionImpact")->group_name().empty()); + base::FieldTrialList::Find("ProxyConnectionImpact") && + !base::FieldTrialList::Find("ProxyConnectionImpact")-> + group_name().empty()); if (proxy_connection_impact_trial_exists && is_http_proxy_connection_) { UMA_HISTOGRAM_CUSTOM_TIMES( - FieldTrial::MakeName("Net.HttpProxySocketRequestTime", + base::FieldTrial::MakeName("Net.HttpProxySocketRequestTime", "ProxyConnectionImpact"), time, base::TimeDelta::FromMilliseconds(1), base::TimeDelta::FromMinutes(10), @@ -68,7 +72,7 @@ void ClientSocketPoolHistograms::AddRequestTime(base::TimeDelta time) const { } if (proxy_connection_impact_trial_exists && is_socks_connection_) { UMA_HISTOGRAM_CUSTOM_TIMES( - FieldTrial::MakeName("Net.SocksSocketRequestTime", + base::FieldTrial::MakeName("Net.SocksSocketRequestTime", "ProxyConnectionImpact"), time, base::TimeDelta::FromMilliseconds(1), base::TimeDelta::FromMinutes(10), diff --git a/net/socket/client_socket_pool_histograms.h b/net/socket/client_socket_pool_histograms.h index 41aad57..ace8a0d 100644 --- a/net/socket/client_socket_pool_histograms.h +++ b/net/socket/client_socket_pool_histograms.h @@ -11,7 +11,9 @@ #include "base/time.h" #include "base/ref_counted.h" +namespace base { class Histogram; +} namespace net { @@ -26,10 +28,10 @@ class ClientSocketPoolHistograms { void AddReusedIdleTime(base::TimeDelta time) const; private: - scoped_refptr<Histogram> socket_type_; - scoped_refptr<Histogram> request_time_; - scoped_refptr<Histogram> unused_idle_time_; - scoped_refptr<Histogram> reused_idle_time_; + scoped_refptr<base::Histogram> socket_type_; + scoped_refptr<base::Histogram> request_time_; + scoped_refptr<base::Histogram> unused_idle_time_; + scoped_refptr<base::Histogram> reused_idle_time_; bool is_http_proxy_connection_; bool is_socks_connection_; diff --git a/net/socket/ssl_client_socket_nss.cc b/net/socket/ssl_client_socket_nss.cc index ba135e1..aa8c7fc 100644 --- a/net/socket/ssl_client_socket_nss.cc +++ b/net/socket/ssl_client_socket_nss.cc @@ -64,7 +64,7 @@ #include <limits> #include "base/compiler_specific.h" -#include "base/histogram.h" +#include "base/metrics/histogram.h" #include "base/logging.h" #include "base/nss_util.h" #include "base/singleton.h" diff --git a/net/socket/ssl_client_socket_openssl.cc b/net/socket/ssl_client_socket_openssl.cc index 4ff1b48..64852f2 100644 --- a/net/socket/ssl_client_socket_openssl.cc +++ b/net/socket/ssl_client_socket_openssl.cc @@ -11,7 +11,7 @@ #include <openssl/err.h> #include "net/base/cert_verifier.h" -#include "base/histogram.h" +#include "base/metrics/histogram.h" #include "net/base/net_errors.h" #include "net/base/openssl_util.h" #include "net/base/ssl_connection_status_flags.h" diff --git a/net/socket/ssl_client_socket_pool.cc b/net/socket/ssl_client_socket_pool.cc index 22d921a..a338a7f 100644 --- a/net/socket/ssl_client_socket_pool.cc +++ b/net/socket/ssl_client_socket_pool.cc @@ -4,7 +4,7 @@ #include "net/socket/ssl_client_socket_pool.h" -#include "base/histogram.h" +#include "base/metrics/histogram.h" #include "base/values.h" #include "net/base/net_errors.h" #include "net/base/ssl_cert_request_info.h" @@ -316,18 +316,19 @@ int SSLConnectJob::DoSSLConnectComplete(int result) { DCHECK(ssl_connect_start_time_ != base::TimeTicks()); base::TimeDelta connect_duration = base::TimeTicks::Now() - ssl_connect_start_time_; - if (using_spdy) + if (using_spdy) { UMA_HISTOGRAM_CUSTOM_TIMES("Net.SpdyConnectionLatency", connect_duration, base::TimeDelta::FromMilliseconds(1), base::TimeDelta::FromMinutes(10), 100); - else + } else { UMA_HISTOGRAM_CUSTOM_TIMES("Net.SSL_Connection_Latency", connect_duration, base::TimeDelta::FromMilliseconds(1), base::TimeDelta::FromMinutes(10), 100); + } } if (result == OK || IsCertificateError(result)) { diff --git a/net/socket/tcp_client_socket_libevent.cc b/net/socket/tcp_client_socket_libevent.cc index 889bfc0..86d6afe9 100644 --- a/net/socket/tcp_client_socket_libevent.cc +++ b/net/socket/tcp_client_socket_libevent.cc @@ -16,7 +16,7 @@ #include "base/eintr_wrapper.h" #include "base/logging.h" #include "base/message_loop.h" -#include "base/stats_counters.h" +#include "base/metrics/stats_counters.h" #include "base/string_util.h" #include "net/base/address_list_net_log_param.h" #include "net/base/io_buffer.h" @@ -139,7 +139,7 @@ int TCPClientSocketLibevent::Connect(CompletionCallback* callback) { if (socket_ != kInvalidSocket) return OK; - static StatsCounter connects("tcp.connect"); + static base::StatsCounter connects("tcp.connect"); connects.Increment(); DCHECK(!waiting_connect()); @@ -328,7 +328,7 @@ int TCPClientSocketLibevent::Read(IOBuffer* buf, int nread = HANDLE_EINTR(read(socket_, buf->data(), buf_len)); if (nread >= 0) { - static StatsCounter read_bytes("tcp.read_bytes"); + static base::StatsCounter read_bytes("tcp.read_bytes"); read_bytes.Add(nread); if (nread > 0) use_history_.set_was_used_to_convey_data(); @@ -367,7 +367,7 @@ int TCPClientSocketLibevent::Write(IOBuffer* buf, int nwrite = HANDLE_EINTR(write(socket_, buf->data(), buf_len)); if (nwrite >= 0) { - static StatsCounter write_bytes("tcp.write_bytes"); + static base::StatsCounter write_bytes("tcp.write_bytes"); write_bytes.Add(nwrite); if (nwrite > 0) use_history_.set_was_used_to_convey_data(); @@ -487,7 +487,7 @@ void TCPClientSocketLibevent::DidCompleteRead() { int result; if (bytes_transferred >= 0) { result = bytes_transferred; - static StatsCounter read_bytes("tcp.read_bytes"); + static base::StatsCounter read_bytes("tcp.read_bytes"); read_bytes.Add(bytes_transferred); if (bytes_transferred > 0) use_history_.set_was_used_to_convey_data(); @@ -514,7 +514,7 @@ void TCPClientSocketLibevent::DidCompleteWrite() { int result; if (bytes_transferred >= 0) { result = bytes_transferred; - static StatsCounter write_bytes("tcp.write_bytes"); + static base::StatsCounter write_bytes("tcp.write_bytes"); write_bytes.Add(bytes_transferred); if (bytes_transferred > 0) use_history_.set_was_used_to_convey_data(); diff --git a/net/socket/tcp_client_socket_pool.cc b/net/socket/tcp_client_socket_pool.cc index f11ae25..820f58e 100644 --- a/net/socket/tcp_client_socket_pool.cc +++ b/net/socket/tcp_client_socket_pool.cc @@ -5,9 +5,9 @@ #include "net/socket/tcp_client_socket_pool.h" #include "base/compiler_specific.h" -#include "base/histogram.h" #include "base/logging.h" #include "base/message_loop.h" +#include "base/metrics/histogram.h" #include "base/string_util.h" #include "base/time.h" #include "net/base/net_log.h" diff --git a/net/socket/tcp_client_socket_win.cc b/net/socket/tcp_client_socket_win.cc index 0275f18..9bbb034 100644 --- a/net/socket/tcp_client_socket_win.cc +++ b/net/socket/tcp_client_socket_win.cc @@ -7,7 +7,7 @@ #include "base/basictypes.h" #include "base/compiler_specific.h" #include "base/memory_debug.h" -#include "base/stats_counters.h" +#include "base/metrics/stats_counters.h" #include "base/string_util.h" #include "base/sys_info.h" #include "net/base/address_list_net_log_param.h" @@ -311,7 +311,7 @@ int TCPClientSocketWin::Connect(CompletionCallback* callback) { if (socket_ != INVALID_SOCKET) return OK; - static StatsCounter connects("tcp.connect"); + static base::StatsCounter connects("tcp.connect"); connects.Increment(); net_log_.BeginEvent(NetLog::TYPE_TCP_CONNECT, @@ -564,7 +564,7 @@ int TCPClientSocketWin::Read(IOBuffer* buf, // false error reports. // See bug 5297. base::MemoryDebug::MarkAsInitialized(core_->read_buffer_.buf, num); - static StatsCounter read_bytes("tcp.read_bytes"); + static base::StatsCounter read_bytes("tcp.read_bytes"); read_bytes.Add(num); if (num > 0) use_history_.set_was_used_to_convey_data(); @@ -594,7 +594,7 @@ int TCPClientSocketWin::Write(IOBuffer* buf, DCHECK_GT(buf_len, 0); DCHECK(!core_->write_iobuffer_); - static StatsCounter writes("tcp.writes"); + static base::StatsCounter writes("tcp.writes"); writes.Increment(); core_->write_buffer_.len = buf_len; @@ -616,7 +616,7 @@ int TCPClientSocketWin::Write(IOBuffer* buf, << " bytes, but " << rv << " bytes reported."; return ERR_WINSOCK_UNEXPECTED_WRITTEN_BYTES; } - static StatsCounter write_bytes("tcp.write_bytes"); + static base::StatsCounter write_bytes("tcp.write_bytes"); write_bytes.Add(rv); if (rv > 0) use_history_.set_was_used_to_convey_data(); @@ -777,7 +777,7 @@ void TCPClientSocketWin::DidCompleteRead() { waiting_read_ = false; core_->read_iobuffer_ = NULL; if (ok) { - static StatsCounter read_bytes("tcp.read_bytes"); + static base::StatsCounter read_bytes("tcp.read_bytes"); read_bytes.Add(num_bytes); if (num_bytes > 0) use_history_.set_was_used_to_convey_data(); @@ -808,7 +808,7 @@ void TCPClientSocketWin::DidCompleteWrite() { << " bytes reported."; rv = ERR_WINSOCK_UNEXPECTED_WRITTEN_BYTES; } else { - static StatsCounter write_bytes("tcp.write_bytes"); + static base::StatsCounter write_bytes("tcp.write_bytes"); write_bytes.Add(num_bytes); if (num_bytes > 0) use_history_.set_was_used_to_convey_data(); diff --git a/net/socket_stream/socket_stream_metrics.cc b/net/socket_stream/socket_stream_metrics.cc index 71239af..108e829 100644 --- a/net/socket_stream/socket_stream_metrics.cc +++ b/net/socket_stream/socket_stream_metrics.cc @@ -6,7 +6,7 @@ #include <string.h> -#include "base/histogram.h" +#include "base/metrics/histogram.h" #include "base/time.h" #include "googleurl/src/gurl.h" diff --git a/net/socket_stream/socket_stream_metrics_unittest.cc b/net/socket_stream/socket_stream_metrics_unittest.cc index 7d44f79..64718e3 100644 --- a/net/socket_stream/socket_stream_metrics_unittest.cc +++ b/net/socket_stream/socket_stream_metrics_unittest.cc @@ -3,12 +3,15 @@ // found in the LICENSE file. #include "base/basictypes.h" -#include "base/histogram.h" +#include "base/metrics/histogram.h" #include "googleurl/src/gurl.h" #include "net/socket_stream/socket_stream_metrics.h" #include "testing/gtest/include/gtest/gtest.h" #include "testing/platform_test.h" +using base::Histogram; +using base::StatisticsRecorder; + namespace net { TEST(SocketStreamMetricsTest, Initialize) { diff --git a/net/spdy/spdy_framer.cc b/net/spdy/spdy_framer.cc index b10eee8..af8e305 100644 --- a/net/spdy/spdy_framer.cc +++ b/net/spdy/spdy_framer.cc @@ -4,9 +4,8 @@ #include "net/spdy/spdy_framer.h" +#include "base/metrics/stats_counters.h" #include "base/scoped_ptr.h" -#include "base/stats_counters.h" - #include "net/spdy/spdy_frame_builder.h" #include "net/spdy/spdy_bitmasks.h" @@ -915,9 +914,9 @@ SpdyFrame* SpdyFramer::CompressFrameWithZStream(const SpdyFrame& frame, int header_length; const char* payload; - static StatsCounter compressed_frames("spdy.CompressedFrames"); - static StatsCounter pre_compress_bytes("spdy.PreCompressSize"); - static StatsCounter post_compress_bytes("spdy.PostCompressSize"); + static base::StatsCounter compressed_frames("spdy.CompressedFrames"); + static base::StatsCounter pre_compress_bytes("spdy.PreCompressSize"); + static base::StatsCounter post_compress_bytes("spdy.PostCompressSize"); if (!enable_compression_) return DuplicateFrame(frame); @@ -968,9 +967,9 @@ SpdyFrame* SpdyFramer::DecompressFrameWithZStream(const SpdyFrame& frame, int header_length; const char* payload; - static StatsCounter decompressed_frames("spdy.DecompressedFrames"); - static StatsCounter pre_decompress_bytes("spdy.PreDeCompressSize"); - static StatsCounter post_decompress_bytes("spdy.PostDeCompressSize"); + static base::StatsCounter decompressed_frames("spdy.DecompressedFrames"); + static base::StatsCounter pre_decompress_bytes("spdy.PreDeCompressSize"); + static base::StatsCounter post_decompress_bytes("spdy.PostDeCompressSize"); if (!enable_compression_) return DuplicateFrame(frame); diff --git a/net/spdy/spdy_session.cc b/net/spdy/spdy_session.cc index d0ebff9..3967a81 100644 --- a/net/spdy/spdy_session.cc +++ b/net/spdy/spdy_session.cc @@ -8,7 +8,7 @@ #include "base/linked_ptr.h" #include "base/logging.h" #include "base/message_loop.h" -#include "base/stats_counters.h" +#include "base/metrics/stats_counters.h" #include "base/stl_util-inl.h" #include "base/string_number_conversions.h" #include "base/string_util.h" @@ -284,7 +284,7 @@ net::Error SpdySession::InitializeWithSocket( ClientSocketHandle* connection, bool is_secure, int certificate_error_code) { - static StatsCounter spdy_sessions("spdy.sessions"); + static base::StatsCounter spdy_sessions("spdy.sessions"); spdy_sessions.Increment(); AdjustSocketBufferSizes(connection->socket()); @@ -452,7 +452,7 @@ int SpdySession::WriteSynStream( flags, false, headers.get())); QueueFrame(syn_frame.get(), priority, stream); - static StatsCounter spdy_requests("spdy.requests"); + static base::StatsCounter spdy_requests("spdy.requests"); spdy_requests.Increment(); streams_initiated_count_++; @@ -766,8 +766,9 @@ void SpdySession::WriteSocket() { } void SpdySession::CloseAllStreams(net::Error status) { - static StatsCounter abandoned_streams("spdy.abandoned_streams"); - static StatsCounter abandoned_push_streams("spdy.abandoned_push_streams"); + static base::StatsCounter abandoned_streams("spdy.abandoned_streams"); + static base::StatsCounter abandoned_push_streams( + "spdy.abandoned_push_streams"); if (!active_streams_.empty()) abandoned_streams.Add(active_streams_.size()); @@ -914,7 +915,7 @@ void SpdySession::RemoveFromPool() { scoped_refptr<SpdyStream> SpdySession::GetActivePushStream( const std::string& path) { - static StatsCounter used_push_streams("spdy.claimed_push_streams"); + static base::StatsCounter used_push_streams("spdy.claimed_push_streams"); PushedStreamMap::iterator it = unclaimed_pushed_streams_.find(path); if (it != unclaimed_pushed_streams_.end()) { @@ -1063,7 +1064,7 @@ void SpdySession::OnSyn(const spdy::SpdySynStreamControlFrame& frame, if (!Respond(*headers, stream)) return; - static StatsCounter push_requests("spdy.pushed_streams"); + static base::StatsCounter push_requests("spdy.pushed_streams"); push_requests.Increment(); } diff --git a/net/tools/fetch/fetch_client.cc b/net/tools/fetch/fetch_client.cc index 14f7afb..b976ce2 100644 --- a/net/tools/fetch/fetch_client.cc +++ b/net/tools/fetch/fetch_client.cc @@ -7,8 +7,8 @@ #include "base/at_exit.h" #include "base/command_line.h" #include "base/message_loop.h" +#include "base/metrics/stats_counters.h" #include "base/singleton.h" -#include "base/stats_counters.h" #include "base/string_number_conversions.h" #include "base/string_util.h" #include "net/base/completion_callback.h" @@ -86,7 +86,7 @@ class Client { } // Deal with received data here. - static StatsCounter bytes_read("FetchClient.bytes_read"); + static base::StatsCounter bytes_read("FetchClient.bytes_read"); bytes_read.Add(result); // Issue a read for more data. @@ -99,7 +99,7 @@ class Client { } void OnRequestComplete(int result) { - static StatsCounter requests("FetchClient.requests"); + static base::StatsCounter requests("FetchClient.requests"); requests.Increment(); driver_->ClientStopped(); printf("."); @@ -117,7 +117,7 @@ class Client { int main(int argc, char**argv) { base::AtExitManager exit; - StatsTable table("fetchclient", 50, 1000); + base::StatsTable table("fetchclient", 50, 1000); table.set_current(&table); CommandLine::Init(argc, argv); @@ -163,8 +163,8 @@ int main(int argc, char**argv) { } { - StatsCounterTimer driver_time("FetchClient.total_time"); - StatsScope<StatsCounterTimer> scope(driver_time); + base::StatsCounterTimer driver_time("FetchClient.total_time"); + base::StatsScope<base::StatsCounterTimer> scope(driver_time); Client** clients = new Client*[client_limit]; for (int i = 0; i < client_limit; i++) diff --git a/net/tools/fetch/fetch_server.cc b/net/tools/fetch/fetch_server.cc index 085bd46..ca058f1 100644 --- a/net/tools/fetch/fetch_server.cc +++ b/net/tools/fetch/fetch_server.cc @@ -1,12 +1,12 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 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. #include "base/at_exit.h" #include "base/command_line.h" #include "base/message_loop.h" +#include "base/metrics/stats_counters.h" #include "base/singleton.h" -#include "base/stats_counters.h" #include "net/base/completion_callback.h" #include "net/base/io_buffer.h" #include "net/base/net_errors.h" @@ -24,7 +24,7 @@ void usage(const char* program_name) { int main(int argc, char**argv) { base::AtExitManager exit; - StatsTable table("fetchserver", 50, 1000); + base::StatsTable table("fetchserver", 50, 1000); table.set_current(&table); #if defined(OS_WIN) diff --git a/net/url_request/url_request.cc b/net/url_request/url_request.cc index b4f9d51..ee52e0a 100644 --- a/net/url_request/url_request.cc +++ b/net/url_request/url_request.cc @@ -6,8 +6,8 @@ #include "base/compiler_specific.h" #include "base/message_loop.h" +#include "base/metrics/stats_counters.h" #include "base/singleton.h" -#include "base/stats_counters.h" #include "net/base/load_flags.h" #include "net/base/net_errors.h" #include "net/base/net_log.h" diff --git a/net/url_request/url_request_job.cc b/net/url_request/url_request_job.cc index 5ed3097..2a4d036 100644 --- a/net/url_request/url_request_job.cc +++ b/net/url_request/url_request_job.cc @@ -4,8 +4,8 @@ #include "net/url_request/url_request_job.h" -#include "base/histogram.h" #include "base/message_loop.h" +#include "base/metrics/histogram.h" #include "base/string_number_conversions.h" #include "base/string_util.h" #include "net/base/auth.h" |